about summary refs log tree commit diff
path: root/src/test/rustdoc-ui
AgeCommit message (Collapse)AuthorLines
2021-05-05Suggest lint groupsCameron Steffen-1/+1
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-03change based on reviewAliénore Bouttefeux-30/+30
2021-05-03Unify rustc and rustdoc parsing of `cfg()`Joshua Nelson-0/+18
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-25/+61
2021-05-01Auto merge of #83857 - ABouttefeux:master, r=jyn514bors-0/+58
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-01Apply suggestions from code reviewAliénore Bouttefeux-1/+2
Co-authored-by: Joshua Nelson <joshua@yottadb.com>
2021-04-30error when --no-run is present without --testAliénore Bouttefeux-0/+7
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-07fix failing tidy checkAliénore Bouttefeux-1/+1
2021-04-07add testAliénore Bouttefeux-0/+50
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