about summary refs log tree commit diff
path: root/src/librustdoc
AgeCommit message (Collapse)AuthorLines
2021-04-05Take DiagnosticInfo in privacy_errorJoshua Nelson-3/+7
2021-04-05Take `DiagnosticInfo` in `ambiguity_error`Joshua Nelson-12/+3
2021-04-05Take DiagnosticInfo in disambiguator_errorJoshua Nelson-3/+2
2021-04-05Rename link_range -> disambiguator_range in disambiguator_errorJoshua Nelson-2/+2
It's not the range of the full link, it's only a partial range.
2021-04-05Take `DiagnosticInfo` in `resolution_failure`Joshua Nelson-30/+6
2021-04-05Use DiagnosticInfo for anchor failureJoshua Nelson-47/+15
This gets rid of a lot of parameters, as well as fixing a diagnostic bug.
2021-04-05Rename path_str -> ori_link in anchor_failureJoshua Nelson-3/+3
ori_link contains anchors, path_str does not. It's important that anchor_failure be passed a link with the anchors still present.
2021-04-05suggestion from review move no run option in run_test callAliénore Bouttefeux-3/+3
2021-04-05Update src/librustdoc/lib.rs from suggestionAliénore Bouttefeux-1/+1
Co-authored-by: Ivan Tham <pickfire@riseup.net>
2021-04-05Rollup merge of #83705 - jyn514:theme-error, r=GuillaumeGomezDylan DPC-1/+3
Give a better error when --theme is not a CSS file Before: ``` error: invalid argument: "bacon.toml" ``` After: ``` error: invalid argument: "bacon.toml" | = help: arguments to --theme must be CSS files ``` cc https://github.com/rust-lang/rust/pull/83478
2021-04-05Apply suggestions from code reviewJoshua Nelson-1/+1
Co-authored-by: Camelid <camelidcamel@gmail.com> Co-authored-by: Nemo157 <github@nemo157.com>
2021-04-05Use more appropriate return type for `resolve_associated_item`Joshua Nelson-83/+56
Previously, the types looked like this: - None means this is not an associated item (but may be a variant field) - Some(Err) means this is known to be an error. I think the only way that can happen is if it resolved and but you had your own anchor. - Some(Ok(_, None)) was impossible. Now, this returns a nested Option and does the error handling and fiddling with the side channel in the caller. As a side-effect, it also removes duplicate error handling. This has one small change in behavior, which is that `resolve_primitive_associated_item` now goes through `variant_field` if it fails to resolve something. This is not ideal, but since it will be quickly rejected anyway, I think the performance hit is worth the cleanup. This also fixes a bug where struct fields would forget to set the side channel, adds a test for the bug, and ignores `private_intra_doc_links` in rustc_resolve (since it's always documented with --document-private-items).
2021-04-05Reduce indentation in `resolve_associated_item`Joshua Nelson-45/+35
2021-04-05Remove duplicate unwrap_or_elseJoshua Nelson-43/+47
2021-04-05Rollup merge of #83865 - camelid:disamb-err-fix, r=jyn514Dylan DPC-4/+24
Don't report disambiguator error if link would have been ignored Fixes #83859. This prevents us from warning on links such as `<hello@example.com>`. Note that we still warn on links such as `<hello@localhost>` because they have no dots in them. However, the links will still work, even though a warning is reported. r? ````@jyn514````
2021-04-05Rollup merge of #83863 - eggyal:issue-83852, r=jyn514Dylan DPC-11/+1
Render destructured struct function param names as underscore Fixes #83852 r? ````@GuillaumeGomez````
2021-04-05Rollup merge of #83826 - slightlyoutofphase:rustdoc-sidebar-order-shuffle, ↵Dylan DPC-7/+8
r=jyn514 List trait impls before deref methods in doc's sidebar This PR is acting directly on a suggestion made by ```````@jyn514``````` in #83133. I've tested the changes locally, and can confirm that it does in fact properly achieve what he thought it would. This PR also in turn closes #83133.
2021-04-05Update Source Serif to release 4.004Trevor Spiteri-30/+29
Now the family name is Source Serif 4 (upstream issue 77) instead of Source Serif Pro.
2021-04-05Rename non_autolinks -> bare_urlsJoshua Nelson-21/+22
2021-04-05Remove 'unnecessary long for for link' warningJoshua Nelson-38/+22
This also makes the implementation slightly more efficient by only compiling the regex once. See https://github.com/rust-lang/rust/pull/81764#issuecomment-774122759 for why this was removed; essentially the benefit didn't seem great enough to deserve a lint.
2021-04-05Stabilize `non_autolinks` lintJoshua Nelson-8/+1
2021-04-05Merge branch 'master' of github.com:rust-lang/rust into issue-83852Alan Egerton-43/+127
2021-04-04Don't report disambiguator error if link would have been ignoredCamelid-4/+24
This prevents us from warning on links such as `<hello@example.com>`. Note that we still warn on links such as `<hello@localhost>` because they have no dots in them. However, the links will still work, even though a warning is reported.
2021-04-05Rollup merge of #83717 - notriddle:main-js-slice-loop, r=GuillaumeGomezDylan DPC-9/+12
rustdoc: Separate filter-empty-string out into its own function
2021-04-05Rollup merge of #80525 - devsnek:wasm64, r=nagisaDylan DPC-1/+2
wasm64 support There is still some upstream llvm work needed before this can land.
2021-04-04Render destructured struct function param names as underscore.Alan Egerton-11/+1
Fixes #83852 r? `@GuillaumeGomez`
2021-04-04use jemallocator in rustc/rustdocGus Wynn-0/+54
2021-04-04Get rid of unneeded `aliases` fieldMichael Howell-6/+6
2021-04-04added --no-run optionAliénore Bouttefeux-2/+8
2021-04-04Rollup merge of #83809 - GuillaumeGomez:remove-initial-ids, r=camelidDylan DPC-30/+11
Remove unneeded INITIAL_IDS const Some IDs inside this map didn't exist anymore, some others were duplicates of what we have inside `IdMap`. So instead of keeping the two around and since `INITIAL_IDS` was only used by `IdMap`, no need to keep both of them.
2021-04-04Rollup merge of #83793 - notriddle:single-span-macro-highlight, r=GuillaumeGomezDylan DPC-6/+10
rustdoc: highlight macros more efficiently Instead of producing `<span class=macro>assert_eq</span><span class=macro>!</span>`, just produce `<span class=macro>assert_eq!</span>`.
2021-04-04Rollup merge of #73945 - est31:unused_externs, r=Mark-SimulacrumDylan DPC-7/+106
Add an unstable --json=unused-externs flag to print unused externs This adds an unstable flag to print a list of the extern names not used by cargo. This PR will enable cargo to collect unused dependencies from all units and provide warnings. The companion PR to cargo is: https://github.com/rust-lang/cargo/pull/8437 The goal is eventual stabilization of this flag in rustc as well as in cargo. Discussion of this feature is mostly contained inside these threads: #57274 #72342 #72603 The feature builds upon the internal datastructures added by #72342 Externs are uniquely identified by name and the information is sufficient for cargo. If the mode is enabled, rustc will print json messages like: ``` {"unused_extern_names":["byteorder","openssl","webpki"]} ``` For a crate that got passed byteorder, openssl and webpki dependencies but needed none of them. ### Q: Why not pass -Wunused-crate-dependencies? A: See [ehuss's comment here](https://github.com/rust-lang/rust/issues/57274#issuecomment-624839355) TLDR: it's cleaner. Rust's warning system wasn't built to be filtered or edited by cargo. Even a basic implementation of the feature would have to change the "n warnings emitted" line that rustc prints at the end. Cargo ideally wants to synthesize its own warnings anyways. For example, it would be hard for rustc to emit warnings like "dependency foo is only used by dev targets", suggesting to make it a dev-dependency instead. ### Q: Make rustc emit used or unused externs? A: Emitting used externs has the advantage that it simplifies cargo's collection job. However, emitting unused externs creates less data to be communicated between rustc and cargo. Often you want to paste a cargo command obtained from `cargo build -vv` for doing something completely unrelated. The message is emitted always, even if no warning or error is emitted. At that point, even this tiny difference in "noise" matters. That's why I went with emitting unused externs. ### Q: One json msg per extern or a collective json msg? A: Same as above, the data format should be concise. Having 30 lines for the 30 crates a crate uses would be disturbing to readers. Also it helps the cargo implementation to know that there aren't more unused deps coming. ### Q: Why use names of externs instead of e.g. paths? A: Names are both sufficient as well as neccessary to uniquely identify a passed `--extern` arg. Names are sufficient because you *must* pass a name when passing an `--extern` arg. Passing a path is optional on the other hand so rustc might also figure out a crate's location from the file system. You can also put multiple paths for the same extern name, via e.g. `--extern hello=/usr/lib/hello.rmeta --extern hello=/usr/local/lib/hello.rmeta`, but rustc will only ever use one of those paths. Also, paths don't identify a dependency uniquely as it is possible to have multiple different extern names point to the same path. So paths are ill-suited for identification. ### Q: What about 2015 edition crates? A: They are fully supported. Even on the 2015 edition, an explicit `--extern` flag is is required to enable `extern crate foo;` to work (outside of sysroot crates, which this flag doesn't warn about anyways). So the lint would still fire on 2015 edition crates if you haven't included a dependency specified in Cargo.toml using `extern crate foo;` or similar. The lint won't fire if your sole use in the crate is through a `extern crate foo;` statement, but that's not its job. For detecting unused `extern crate foo` statements, there is the `unused_extern_crates` lint which can be enabled by `#![warn(unused_extern_crates)]` or similar. cc ```@jsgf``` ```@ehuss``` ```@petrochenkov``` ```@estebank```
2021-04-04wasm64Gus Caplan-1/+2
2021-04-03rustdoc: sort search index items for compressionMichael Howell-17/+20
This should not affect the appearance of the docs pages themselves. This makes the pre-compressed search index smaller, thanks to the empty-string path duplication format, and also the gzipped version, by giving the algorithm more structure to work with. rust$ wc -c search-index-old.js search-index-new.js 2628334 search-index-old.js 2586181 search-index-new.js 5214515 total rust$ gzip search-index-* rust$ wc -c search-index-old.js.gz search-index-new.js.gz 239486 search-index-old.js.gz 237386 search-index-new.js.gz 476872 total
2021-04-03Remove unneeded INITIAL_IDS constGuillaume Gomez-30/+11
2021-04-03Remove trailing whitespaceSlightlyOutOfPhase-1/+1
2021-04-03List trait impls before methods from deref in the sidebar of Rustdoc's outputSlightlyOutOfPhase-7/+8
2021-04-04Rollup merge of #83756 - camelid:internal-rename-doc-spotlight, r=GuillaumeGomezYuki Okushi-23/+21
rustdoc: Rename internal uses of `spotlight` I didn't make these renames in #80965 because I didn't want the PR to conflict with #80914.
2021-04-03Auto merge of #83738 - jyn514:only-load-some-crates, r=petrochenkovbors-36/+60
rustdoc: Don't load all extern crates unconditionally Instead, only load the crates that are linked to with intra-doc links. This doesn't help very much with any of rustdoc's fundamental issues with freezing the resolver, but it at least fixes a stable-to-stable regression, and makes the crate loading model somewhat more consistent with rustc's. I tested and it unfortunately does not help at all with https://github.com/rust-lang/rust/pull/82496. Closes https://github.com/rust-lang/rust/issues/68427. Let me know if you want me to open a separate issue for not freezing the resolver. r? `@petrochenkov` cc `@eddyb` `@ollie27`
2021-04-02rustdoc: update macro highlight testsMichael Howell-4/+4
2021-04-02Don't load all extern crates unconditionallyJoshua Nelson-36/+60
Instead, only load the crates that are linked to with intra-doc links. This doesn't help very much with any of rustdoc's fundamental issues with freezing the resolver, but it at least fixes a stable-to-stable regression, and makes the crate loading model somewhat more consistent with rustc's.
2021-04-02rustdoc: highlight macros more efficientlyMichael Howell-2/+6
Instead of producing `<span class=macro>assert_eq</span><span class=macro>!</span>`, just produce `<span class=macro>assert_eq!</span>`.
2021-04-02rustdoc: Remove unused `spotlight` CSSCamelid-4/+1
I couldn't find any uses of this CSS. I think it was superseded by the `.notable-traits` CSS class and other similarly-named CSS classes.
2021-04-02rustdoc: Rename internal uses of `spotlight`Camelid-19/+20
I didn't make these renames in #80965 because I didn't want the PR to conflict with #80914.
2021-04-02Rollup merge of #83478 - jyn514:fine-grained-files, r=Mark-SimulacrumDylan DPC-134/+234
rustdoc: Add unstable option to only emit shared/crate-specific files The intended use case is for docs.rs, which can now copy exactly the files it cares about, rather than having to guess based on whether they have a resource suffix or not. In particular, some files have a resource suffix but cannot be shared between crates: https://github.com/rust-lang/docs.rs/pull/1312#issuecomment-798783688 The end goal is to fix rust-lang/docs.rs#1327 by reverting rust-lang/docs.rs#1324. This obsoletes `--print=unversioned-files`, which I plan to remove as soon as docs.rs stops using it. I recommend reviewing this one commit at a time. r? ``@GuillaumeGomez`` cc ``@Nemo157`` ``@pietroalbini``
2021-04-02Rollup merge of #83721 - GuillaumeGomez:copy-use, r=Nemo157Yuki Okushi-13/+57
Add a button to copy the "use statement" Fixes https://github.com/rust-lang/rust/issues/50239 When clicking on the button, it'll add the elements prepended by "use " and will end with a ";". So in the images below, I now have in my clipboard `use std::fs::OpenOptions;`. A screenshot of the newly added button: ![Screenshot from 2021-03-31 22-12-12](https://user-images.githubusercontent.com/3050060/113205430-90e64500-926e-11eb-8538-529829f611ec.png) A screenshot after it was clicked: ![Screenshot from 2021-03-31 22-15-31](https://user-images.githubusercontent.com/3050060/113205532-ad827d00-926e-11eb-893d-35f2f8f92696.png) r? `@Nemo157`
2021-04-02Auto merge of #80965 - camelid:rename-doc-spotlight, r=jyn514bors-2/+2
Rename `#[doc(spotlight)]` to `#[doc(notable_trait)]` Fixes #80936. "spotlight" is not a very specific or self-explaining name. Additionally, the dialog that it triggers is called "Notable traits". So, "notable trait" is a better name. * Rename `#[doc(spotlight)]` to `#[doc(notable_trait)]` * Rename `#![feature(doc_spotlight)]` to `#![feature(doc_notable_trait)]` * Update documentation * Improve documentation r? `@Manishearth`
2021-04-01rustdoc: Separate filter-empty-string out into its own functionMichael Howell-2/+11
2021-03-31Fix `--external-css` to be invocation-specific and note main.js should be ↵Joshua Nelson-1/+10
invocation specific
2021-03-31Add a button to copy the "use statement"Guillaume Gomez-13/+57