summary refs log tree commit diff
path: root/src/test/rustdoc-ui
AgeCommit message (Collapse)AuthorLines
2021-05-05Revert PR 83866Pietro Albini-12/+0
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-04manually crafted revert of PR #80653, to address issue #82465.Felix S. Klock II-17/+0
(update: placated tidy)
2021-04-24Revert "rustdoc: Hide `#text` in doc-tests"David Hewitt-31/+0
This reverts commit af6c3201fc3d5ec2559836454ea4f43eec583fa2.
2021-04-22rustdoc: Hide `#text` in doc-testsJoshua Nelson-0/+31
Since `#![attr]` and `#[attr]` are the only valid syntax that start with `#`, we can just special case those two tokens.
2021-04-17rustdoc: Give a more accurate span for anchor failuresJoshua Nelson-6/+18
2021-04-15Rollup merge of #84201 - jyn514:primitive-warnings, r=cuviperDylan DPC-0/+5
rustdoc: Note that forbidding anchors in links to primitives is a bug cc https://github.com/rust-lang/rust/issues/83083, https://github.com/rust-lang/rust/pull/84147#discussion_r613518820 r? `@cuviper`
2021-04-14rustdoc: Note that forbidding anchors in links to primitives is a bugJoshua Nelson-0/+5
2021-04-12Add explanatory note to `bare_urls` lintCamelid-0/+34
I think the lint is confusing otherwise since it doesn't fully explain what the problem is.
2021-04-12Rollup merge of #84079 - camelid:improve-bare-urls-test, r=jyn514Dylan DPC-18/+80
Improve test for `rustdoc::bare_urls` lint - Rename `url-improvements` test to `bare-urls` - Run rustfix for `bare-urls` test
2021-04-10Run rustfix for `bare-urls` testCamelid-18/+80
This will help us ensure that it emits valid suggestions.
2021-04-10Rename `url-improvements` test to `bare-urls`Camelid-18/+18
The lint used to be called `non-autolinks`, and linted more than just bare URLs. Now, it is called `bare-urls` and only lints against bare URLs. So, `bare-urls` is a better name for the test.
2021-04-09Auto merge of #84030 - jyn514:no-blanket-impls, r=GuillaumeGomezbors-9/+9
rustdoc: Don't generate blanket impls when running --show-coverage `get_blanket_impls` is the slowest part of rustdoc, and the coverage pass completely ignores blanket impls. This stops running it at all, and also removes some unnecessary checks in `calculate_doc_coverage` that ignored the impl anyway. We don't currently measure --show-coverage in perf.rlo, but I tested this locally on cargo and it brought the time down from 2.9 to 1.6 seconds. This also adds back a commented-out test; Rustdoc has been able to deal with `impl trait` for almost a year now. r? `@GuillaumeGomez`
2021-04-09Add back missing trait testJoshua Nelson-9/+8
Rustdoc has been able to deal with `impl trait` for almost a year now.
2021-04-09rustdoc: Don't generate blanket impls when running --show-coverageJoshua Nelson-0/+1
get_blanket_impls is the slowest part of rustdoc, and the coverage pass completely ignores blanket impls. This stops running it at all, and also removes some unnecessary checks in `calculate_doc_coverage` that ignored the impl anyway. We don't currently measure --show-coverage in perf.rlo, but I tested this locally on cargo and it brought the time down from 2.9 to 1.6 seconds.
2021-04-08Rollup merge of #81764 - jyn514:lint-links, r=GuillaumeGomezDylan DPC-51/+72
Stabilize `rustdoc::bare_urls` lint Closes https://github.com/rust-lang/rust/issues/77501. Closes https://github.com/rust-lang/rust/issues/83598.
2021-04-08Auto merge of #83866 - jyn514:disambiguator-error, r=camelidbors-0/+12
rustdoc: Link to the docs on namespaces when an unknown disambiguator is found cc https://github.com/rust-lang/rust/issues/83859 `@lopopolo` does this look about like what you expected? r? `@camelid`
2021-04-08Rollup merge of #82497 - jyn514:json, r=CraftSpiderDylan DPC-0/+4
Fix handling of `--output-format json` flag - Don't treat it as deprecated on stable and beta channels. Before, it would give confusing and incorrect output: ``` warning: the 'output-format' flag is considered deprecated | = warning: see issue #44136 <https://github.com/rust-lang/rust/issues/44136> for more information error: json output format isn't supported for doc generation ``` Both of those are wrong: output-format isn't deprecated, and json output is supported. - Require -Z unstable-options for `--output-format json` Previously, it was allowed by default on nightly, which made it hard to realize the flag wouldn't be accepted on beta or stable. To get the test working I had to remove `-Z unstable-options`, which x.py passed to compiletest unconditionally. It was first added in https://github.com/rust-lang/rust/commit/8c2ec689c159e7f021d5913efb991aff875be967 so `-Z miri` would be allowed. -Z miri is no longer passed unconditionally, so hopefully removing it won't break anything. r? ```@aDotInTheVoid``` cc ```@HeroicKatora``` ```@CraftSpider``` Thanks to ```@memoryruins``` for pointing it out on Discord! cc ```@Mark-Simulacrum``` for the change to compiletest.
2021-04-07rustdoc: Link to the docs on namespaces when an unknown disambiguator is foundJoshua Nelson-0/+12
2021-04-06Fix handling of `--output-format json` flagJoshua Nelson-0/+4
- Don't treat it as deprecated on stable and beta channels. Before, it would give confusing and incorrect output: ``` warning: the 'output-format' flag is considered deprecated | = warning: see issue #44136 <https://github.com/rust-lang/rust/issues/44136> for more information error: json output format isn't supported for doc generation ``` Both of those are wrong: output-format isn't deprecated, and json output is supported. - Require -Z unstable-options for `--output-format json` Previously, it was allowed by default on nightly, which made it hard to realize the flag wouldn't be accepted on beta or stable. Note that this still allows `--output-format html`, which has been stable since 1.0. - Remove unnecessary double-checking of the feature gate when parsing the output format - Add custom run-make test since compiletest passes -Zunstable-options by default
2021-04-06Auto merge of #83934 - Dylan-DPC:rollup-nw5dadn, r=Dylan-DPCbors-0/+33
Rollup of 7 pull requests Successful merges: - #82963 (Move `SharedContext` to `context.rs`) - #83829 (rustc_target: Rely on defaults more in target specs) - #83895 (Add listing of lints (eg via `-W help`) to rustdoc) - #83902 (Update LLVM to support more wasm simd ops) - #83903 (Fix typo in TokenStream documentation) - #83910 (Update cargo) - #83920 (Fix HashMap/HashSet LLDB pretty-printer after hashbrown 0.11.0) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2021-04-06Rollup merge of #83895 - eggyal:issue-83883, r=jyn514Dylan DPC-0/+33
Add listing of lints (eg via `-W help`) to rustdoc Fixes #83883 r? `@jyn514`
2021-04-06Auto merge of #83875 - jyn514:diag_info, r=bugadanibors-5/+15
rustdoc: Use DiagnosticInfo in more parts of intra-doc links This makes the code a lot less verbose. This is separated into lots of tiny commits because it was easier for me that way, but the overall diff isn't that big if you want to read it at once. r? `@bugadani`
2021-04-06Add listing of lints (eg via -W help) to rustdocAlan Egerton-0/+33
2021-04-06Rollup merge of #83849 - jyn514:intra-doc-cleanup, r=bugadaniYuki Okushi-13/+33
rustdoc: Cleanup handling of associated items for intra-doc links Helps with https://github.com/rust-lang/rust/issues/83761 (right now the uses of the resolver are all intermingled with uses of the tyctxt). Best reviewed one commit at a time. r? ```@bugadani``` maybe? Feel free to reassign :)
2021-04-05Use DiagnosticInfo for anchor failureJoshua Nelson-5/+15
This gets rid of a lot of parameters, as well as fixing a diagnostic bug.
2021-04-05Rollup merge of #83705 - jyn514:theme-error, r=GuillaumeGomezDylan DPC-0/+7
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-05Use more appropriate return type for `resolve_associated_item`Joshua Nelson-13/+33
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-05Rollup merge of #83865 - camelid:disamb-err-fix, r=jyn514Dylan DPC-0/+21
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-05Fix bug where rustc_lint would not apply renamed tool lintsJoshua Nelson-1/+26
2021-04-05Rename non_autolinks -> bare_urlsJoshua Nelson-8/+24
2021-04-05Remove 'unnecessary long for for link' warningJoshua Nelson-42/+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-04Don't report disambiguator error if link would have been ignoredCamelid-0/+21
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-03Remove redundant `ignore-tidy-linelength` annotationsSimon Jakobi-4/+1
This is step 2 towards fixing #77548. In the codegen and codegen-units test suites, the `//` comment markers were kept in order not to affect any source locations. This is because these tests cannot be automatically `--bless`ed.
2021-04-03Auto merge of #83738 - jyn514:only-load-some-crates, r=petrochenkovbors-0/+20
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-02Don't load all extern crates unconditionallyJoshua Nelson-0/+20
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-02Auto merge of #80965 - camelid:rename-doc-spotlight, r=jyn514bors-0/+34
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-03-31Give a better error when --theme is not a CSS fileJoshua Nelson-0/+7
Before: ``` error: invalid argument: "bacon.toml" ``` After: ``` error: invalid argument: "bacon.toml" | = help: arguments to --theme must be CSS files ```
2021-03-28Add test for weird backticks placementCamelid-8/+23
2021-03-28Point to disambiguator instead of whole linkCamelid-12/+5
And, now that we do that, we can remove the explanatory note since the error span should make it clear what the disambiguator is.
2021-03-26Lint on unknown intra-doc link disambiguatorsCamelid-0/+50
2021-03-26Update char::escape_debug_ext to handle different escapes in strings vs. charsÖmer Sinan Ağacan-2/+2
Fixes #83046 The program fn main() { println!("{:?}", '"'); println!("{:?}", "'"); } would previously print '\"' "\'" With this patch it now prints: '"' "'"
2021-03-22rustdoc: Record crate name instead of using `None`Camelid-0/+17
2021-03-19Rollup merge of #82846 - GuillaumeGomez:doc-alias-list, r=jyn514Dylan DPC-12/+74
rustdoc: allow list syntax for #[doc(alias)] attributes Fixes https://github.com/rust-lang/rust/issues/81205. It now allows to have: ```rust #[doc(alias = "x")] // and: #[doc(alias("y", "z"))] ``` cc ``@jplatte`` r? ``@jyn514``
2021-03-16Don't warn about old rustdoc lint names (temporarily)Joshua Nelson-21/+10
Right now, rustdoc users have an unpleasant situation: they can either use the new tool lint names (`rustdoc::non_autolinks`) or they can use the old names (`non_autolinks`). If they use the tool lints, they get a hard error on stable compilers, because rustc rejects all tool names it doesn't recognize. If they use the old name, they get a warning to rename the lint to the new name. The only way to compile without warnings is to add `#[allow(renamed_removed_lints)]`, which defeats the whole point of the change: we *want* people to switch to the new name. To avoid people silencing the lint and never migrating to the tool lint, this avoids warning about the old name, while still allowing you to use the new name. Once the new `rustdoc` tool name makes it to the stable channel, we can change these lints to warn again. This adds the new lint functions `register_alias` and `register_ignored` - I didn't see an existing way to do this.
2021-03-16Auto merge of #82898 - oli-obk:tait_🧊, r=nikomatsakisbors-2/+2
Add a `min_type_alias_impl_trait` feature gate This new feature gate only permits type alias impl trait to be constrained by function and trait method return types. All other possible constraining sites like const/static types, closure return types and binding types are now forbidden and gated under the `type_alias_impl_trait` and `impl_trait_in_bindings` feature gates (which are both marked as incomplete, as they have various ways to ICE the compiler or cause query cycles where they shouldn't). r? `@nikomatsakis` This is best reviewed commit-by-commit
2021-03-15Rename `#[doc(spotlight)]` to `#[doc(notable_trait)]`Camelid-0/+34
"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
2021-03-15Replace `type_alias_impl_trait` by `min_type_alias_impl_trait` with no ↵Oli Scherer-2/+2
actual changes in behaviour This makes `type_alias_impl_trait` not actually do anything anymore
2021-03-15Rollup merge of #83098 - camelid:more-doc-attr-check, r=davidtwcoDylan DPC-4/+64
Find more invalid doc attributes - Lint on `#[doc(123)]`, `#[doc("hello")]`, etc. - Lint every attribute; e.g., will now report two warnings for `#[doc(foo, bar)]` - Add hyphen to "crate level" - Display paths like `#[doc(foo::bar)]` correctly instead of as an empty string
2021-03-14Tweak diagnosticsCamelid-8/+8
- Tweak lint message - Display multi-segment paths correctly
2021-03-14Rollup merge of #82798 - jyn514:rustdoc-group, r=Manishearth,GuillaumeGomezYuki Okushi-31/+40
Rename `rustdoc` to `rustdoc::all` When rustdoc lints were changed to be tool lints, the `rustdoc` group was removed, leading to spurious warnings like ``` warning: unknown lint: `rustdoc` ``` The lint group still worked when rustdoc ran, since rustdoc added the group itself. This renames the group to `rustdoc::all` for consistency with `clippy::all` and the rest of the rustdoc lints. Follow-up to #80527. r? ``@Manishearth``