about summary refs log tree commit diff
path: root/src/librustdoc
AgeCommit message (Collapse)AuthorLines
2021-05-10Rollup merge of #85118 - GuillaumeGomez:clipboard-svg, r=Nemo157Guillaume Gomez-11/+49
Use an SVG image for clipboard instead of unicode character Linked to https://github.com/rust-lang/docs.rs/pull/1394. cc `@jsha` r? `@Nemo157`
2021-05-10Rollup merge of #84465 - jyn514:primitive, r=GuillaumeGomezGuillaume Gomez-8/+1
rustdoc: Implement `is_primitive` in terms of `primitive_type()` Previously, they disagreed about what types were primitives. r? `@GuillaumeGomez`
2021-05-10Use an SVG image for clipboard instead of unicode characterGuillaume Gomez-11/+49
2021-05-10Fix line number not being clickable on source pagesGuillaume Gomez-19/+27
2021-05-10rustc_session: Move more option building code from the `options!` macroVadim Petrochenkov-7/+3
2021-05-10Update documentation for SharedContext::maybe_collapsed_doc_valueGuillaume Gomez-2/+2
2021-05-10Auto merge of #85074 - GuillaumeGomez:end-toggle-migration, r=jshabors-217/+68
Migrate top doc and non-exhaustive toggles to details tag Fixes #83332. r? `@jsha`
2021-05-10End toggle migrationGuillaume Gomez-217/+68
2021-05-09add bootstrap cfgAliénore Bouttefeux-0/+2
2021-05-08Add `#[track_caller]` to `FakeDefId::expect_real()`Camelid-0/+1
Now, in the case that the function is not inlined, the panic location will be the caller's location, which is more helpful since the panic is not `expect_real()`'s fault.
2021-05-08Remove `FakeDefId::expect_local()`Camelid-20/+16
This function returned a fake `DefIndex`, with no indication that it was fake, when it was provided with a `FakeDefId::Fake`. Every use of the function uses the returned `DefIndex` in a call to `tcx.local_def_id_to_hir_id()`, which I'm pretty sure would panic if it were given a fake `DefIndex`. I removed the function and replaced all calls to it with a call to `expect_real()` followed by `DefId::expect_local()` (that's a function on the *real* `DefId`).
2021-05-08Auto merge of #84470 - jyn514:lints, r=GuillaumeGomezbors-8/+1
rustdoc: Stop special casing `broken_intra_doc_links` unnecessarily
2021-05-08Rollup merge of #85052 - jyn514:disambiguator, r=camelidDylan DPC-1/+4
rustdoc: Link to the docs on namespaces when an unknown disambiguator is found This was reverted in https://github.com/rust-lang/rust/pull/84950; this re-lands the changes, but without different behavior depending on the channel. r? `@camelid` cc `@pietroalbini`
2021-05-07rustdoc: Link to the docs on namespaces when an unknown disambiguator is foundJoshua Nelson-1/+4
2021-05-07Rollup merge of #84442 - jyn514:doc-cfg, r=petrochenkovDylan DPC-39/+27
Unify rustc and rustdoc parsing of `cfg()` This extracts a new `parse_cfg` function that's used between both. - Treat `#[doc(cfg(x), cfg(y))]` the same as `#[doc(cfg(x)] #[doc(cfg(y))]`. Previously it would be completely ignored. - Treat `#[doc(inline, cfg(x))]` the same as `#[doc(inline)] #[doc(cfg(x))]`. Previously, the cfg would be ignored. - Pass the cfg predicate through to rustc_expand to be validated Technically this is a breaking change, but doc_cfg is still nightly so I don't think it matters. Fixes https://github.com/rust-lang/rust/issues/84437. r? `````````@petrochenkov`````````
2021-05-07Rollup merge of #84953 - ↵Dylan DPC-31/+33
GuillaumeGomez:remove-unneeded-with_default_session_globals, r=jyn514 Remove unneeded call to with_default_session_globals in rustdoc highlight This was the origin of the `Span` bug in https://github.com/rust-lang/rust/pull/84176. cc `````@Aaron1011````` r? `````@jyn514`````
2021-05-05Update highlight testsGuillaume Gomez-11/+16
2021-05-05Remove unneeded call to with_default_session_globals in rustdoc highlightGuillaume Gomez-20/+17
2021-05-05Use local and remapped paths where appropriateAndy Wang-20/+18
2021-05-05Remove impl Display for FileName and add FileNameDisplay wrapper typeAndy Wang-1/+1
2021-05-05Make local_path in RealFileName::Remapped Option to be removed in exported ↵Andy Wang-16/+42
metadata
2021-05-05Rename RealFileName::Named to LocalPath and Devirtualized to RemappedAndy Wang-8/+1
2021-05-05Revert PR 83866Pietro Albini-35/+8
That PR caused multiple test failures when Rust's channel is changed from nightly to anything else. The commit will have to be landed again after the test suite is fixed.
2021-05-04rustdoc: Remove unnecessary `StripItem` wrapperJoshua Nelson-16/+9
2021-05-04Auto merge of #84707 - Stupremee:remove-fake-defids-in-rustdoc, ↵bors-255/+336
r=jyn514,GuillaumeGomez Get rid of fake `DefId`s in rustdoc Right now there are *many* errors left, but I wanted to show the current state since all that is left to do is fixing the errors. Resolves #83183 r? `@jyn514`
2021-05-04Add type to differentiate between fake and real DefId'sJustus K-255/+336
2021-05-04Auto merge of #84017 - Smittyvb:int-literal-underscores, r=jyn514bors-2/+62
Valid underscores in hex/octal/binary literal docs Currently hex/octal/binary literals with computed values are displayed like `0_xff_fff_fffu32`, which is invalid since underscores can't be in the middle of integer prefixes. This properly formats prefixed integers. This causes [`std::u32::MAX`](https://doc.rust-lang.org/std/u32/constant.MAX.html) to be displayed as ```rust pub const MAX: u32 = u32::MAX; // 0_xff_fff_fffu32 ``` This PR changes it to be displayed as: ```rust pub const MAX: u32 = u32::MAX; // 0xffff_ffffu32 ```
2021-05-03Valid underscores in hex/octal/binary literal docsSmitty-2/+62
Currently hex/octal/binary literals with computed values are displayed like `0_xff_fff_fffu32`, which is invalid since underscores can't be in the middle of integer prefixes. This properly formats prefixed integers.
2021-05-03Make match in `register_res` easier to readJoshua Nelson-20/+33
- Don't duplicate DefKind -> ItemType handling; that's a good way to get bugs - Use exhaustive match - Add comments This found that register_res is very wrong in at least one way: if it registers a Res for `Variant`, it should also register one for `Field`. But I don't know whether the one for Variant should be removed or Field added. Maybe someone has ideas?
2021-05-03Unify rustc and rustdoc parsing of `cfg()`Joshua Nelson-39/+27
This extracts a new `parse_cfg` function that's used between both. - Treat `#[doc(cfg(x), cfg(y))]` the same as `#[doc(cfg(x)] #[doc(cfg(y))]`. Previously it would be completely ignored. - Treat `#[doc(inline, cfg(x))]` the same as `#[doc(inline)] #[doc(cfg(x))]`. Previously, the cfg would be ignored. - Pass the cfg predicate through to rustc_expand to be validated Co-authored-by: Vadim Petrochenkov <vadim.petrochenkov@gmail.com>
2021-05-03proof of concept add test type on printsAliénore Bouttefeux-1/+3
2021-05-03Change librustdoc write(.. \n) to writeln(..); fix comment in grammarmautamu-5/+5
More grammar
2021-05-03Rollup merge of #84832 - Stupremee:dont-print-vis-in-external-traits, r=jyn514Dylan DPC-3/+13
Do not print visibility in external traits This PR fixes the bug that caused traits, which were re-exported, having visibility modifiers in front of methods, which is invalid. It would be nice to add a test for this, but I don't even know if tests with multiple crates are possible. Resolves #81274
2021-05-03Rollup merge of #84811 - scottmcm:rustdoc-trait-alias-fix, r=jyn514Dylan DPC-17/+43
RustDoc: Fix bounds linking trait.Foo instead of traitalias.Foo Fixes #84782 The code was assuming `Trait` when adding bounds to the cache, so add a check on the DefId to see what its kind really is. r? `@jyn514` Before: ![image](https://user-images.githubusercontent.com/18526288/116775611-6a751e80-aa53-11eb-84d0-ed6b7782be3c.png) After: ![image](https://user-images.githubusercontent.com/18526288/116802227-d19cdc80-ab00-11eb-8133-7b34dd750da2.png)
2021-05-02Auto merge of #84754 - GuillaumeGomez:toggle-migration, r=jshabors-202/+144
Migrate trait and impl blocks' toggles into Part of #83332 After this, I think only the "global" doc comment will be used as JS toggle. Once this PR is merged, I check what remains and remove them. There is one change that this PR brings: ![Screenshot from 2021-04-30 15-39-04](https://user-images.githubusercontent.com/3050060/116713412-0f9ce200-a9d5-11eb-979c-2e7a73d16706.png) ![Screenshot from 2021-04-30 15-39-07](https://user-images.githubusercontent.com/3050060/116713415-10357880-a9d5-11eb-9868-1ba9e5ebf65e.png) As you can see, I had to move the "undocumented" items below, they're not mixed with the others anymore. Unfortunately, I don't see a way to keep the current appearance without JS. As a a reminder, currently it looks like this: ![Screenshot from 2021-04-30 15-39-12](https://user-images.githubusercontent.com/3050060/116713547-31966480-a9d5-11eb-90bb-686042eefeec.png) ![Screenshot from 2021-04-30 15-39-15](https://user-images.githubusercontent.com/3050060/116713549-322efb00-a9d5-11eb-94a9-cfea073120db.png) r? `@jsha`
2021-05-02PR feedbackScott McMurray-6/+9
2021-05-02Do not print visibility in external traitsJustus K-3/+13
2021-05-02Improve code readabilityGuillaume Gomez-18/+18
2021-05-02Rollup merge of #84763 - tdelabro:shrink-doctree-module, r=jyn514Dylan DPC-15/+14
shrink doctree::Module helps https://github.com/rust-lang/rust/issues/76382
2021-05-02Add missing CSS rules for associated typesGuillaume Gomez-8/+11
2021-05-02Migrate trait and impl blocks' toggles intoGuillaume Gomez-185/+124
2021-05-01RustDoc: Fix bounds linking trait.Foo instead of traitalias.FooScott McMurray-16/+39
2021-05-01Auto merge of #83857 - ABouttefeux:master, r=jyn514bors-1/+13
added --no-run option for rustdoc resolve #59053 add `--no-run` option for `rustdoc` for compiling doc test but not running them. Intended for use with `--persist-doctests`.
2021-05-01compute where_outer on demand, remove it from ModuleTimothée Delabrouille-15/+14
2021-05-01Apply suggestions from code reviewAliénore Bouttefeux-1/+1
Co-authored-by: Joshua Nelson <joshua@yottadb.com>
2021-05-01Rollup merge of #84740 - r00ster91:patch-6, r=GuillaumeGomezYuki Okushi-20/+35
Reset the docs' copy path button after 1 second I like that this copy path button on the top next to the type/module's name changes to a check mark when you successfully clicked and copied the path but I find it really weird how the icon stays that check mark forever after the first time of clicking it. Imagine you leave that documentation tab open and come back after 2 hours and you still see that check mark in that box because you copied the path 2 hours ago. You will probably be confused and you might've forgotten what that button even does (even more so currently where this is a new feature, or when you simply don't use it often), so I really think at some point it should go back to the ⎘ icon which, at least to me, pretty clearly indicates copying, whereas the check mark (if it stays there for so long) could falsely look like a verification mark indicating "this module is verified" or something like that. I believe after a longer period of time it's not logical to still tell the user "yes you've copied this successful". In addition to this timeout, maybe it could be made so that you can't copy again until this cooldown of 1 second is over, but I'm not sure how useful or user-friendly that feature would be so maybe it's fine the way it is now. Also the timeout is cleared every time you click again so if you constantly click it, it won't reset during that.
2021-05-01Rollup merge of #84601 - tdelabro:rustdoc-get-rid-of-cache-extern_locations, ↵Yuki Okushi-84/+88
r=jyn514 rustdoc: Only store locations in Cache::extern_locations and calculate the other info on-demand help #84588
2021-04-30Remove unnecessary `provided_trait_methods` field from ImplJoshua Nelson-30/+18
It can be calculated on-demand.
2021-04-30error when --no-run is present without --testAliénore Bouttefeux-1/+6
2021-04-30`copy_path` -> `window.copy_path` + add semicolonr00ster-2/+2