about summary refs log tree commit diff
path: root/src/test/rustdoc-ui
AgeCommit message (Collapse)AuthorLines
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-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``
2021-03-13Update `rustdoc-ui` versions of the `doc-attr` testCamelid-1/+61
It seems there are two copies of it: one in `src/test/ui/attributes/` and one in `src/test/rustdoc-ui/`. I'm guessing this is to test that the lint is emitted both when you run the compiler and when you run rustdoc.
2021-03-13Add hyphen to "crate level"Camelid-3/+3
"crate level attribute" -> "crate-level attribute"
2021-03-11Update doc alias ui testsGuillaume Gomez-12/+74
2021-03-07Rollup merge of #82651 - jyn514:rustdoc-warnings, r=GuillaumeGomezYuki Okushi-10/+51
Cleanup rustdoc warnings ## Clean up error reporting for deprecated passes Using `error!` here goes all the way back to the original commit, https://github.com/rust-lang/rust/pull/8540. I don't see any reason to use logging; rustdoc should use diagnostics wherever possible. See https://github.com/rust-lang/rust/pull/81932#issuecomment-785291244 for further context. - Use spans for deprecated attributes - Use a proper diagnostic for unknown passes, instead of error logging - Add tests for unknown passes - Improve some wording in diagnostics ## Report that `doc(plugins)` doesn't work using diagnostics instead of `eprintln!` This also adds a test for the output. This was added in https://github.com/rust-lang/rust/pull/52194. I don't see any particular reason not to use diagnostics here, I think it was just missed in https://github.com/rust-lang/rust/pull/50541.
2021-03-05Rollup merge of #82708 - GuillaumeGomez:doc-test-attr-check, r=ManishearthGuillaume Gomez-8/+47
Warn on `#![doc(test(...))]` on items other than the crate root and use future incompatible lint Part of #82672. This PR does multiple things: * Create a new `INVALID_DOC_ATTRIBUTE` lint which is also "future incompatible", allowing us to use it as a warning for the moment until it turns (eventually) into a hard error. * Use this link when `#![doc(test(...))]` isn't used at the crate level. * Make #82702 use this new lint as well. r? ``@jyn514``
2021-03-05Rename `rustdoc` to `rustdoc::all`Joshua Nelson-31/+40
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.
2021-03-05Make invalid_doc_attribute lint pluralGuillaume Gomez-2/+2
2021-03-04Also use INVALID_DOC_ATTRIBUTE for "unknown doc attribute" warningsGuillaume Gomez-8/+10
2021-03-04Add tests for #[doc(test(...)] checkGuillaume Gomez-0/+37
2021-03-04Update missing code example testGuillaume Gomez-5/+18
2021-03-04Rollup merge of #80527 - jyn514:rustdoc-lints, r=GuillaumeGomezYuki Okushi-98/+166
Make rustdoc lints a tool lint instead of built-in - Rename `broken_intra_doc_links` to `rustdoc::broken_intra_doc_links` (and similar for other rustdoc lints; I don't expect any others to be used frequently, though). - Ensure that the old lint names still work and give deprecation errors - Register lints even when running doctests - Move lint machinery into a separate file - Add `declare_rustdoc_lint!` macro Unblocks https://github.com/rust-lang/rust/pull/80300, https://github.com/rust-lang/rust/pull/79816, https://github.com/rust-lang/rust/pull/80965. Makes the strangeness in https://github.com/rust-lang/rust/pull/77364 more apparent to the end user (note that `missing_docs` is *not* moved to rustdoc in this PR). Closes https://github.com/rust-lang/rust/issues/78786. ## Current status This is blocked on #82620 (see https://github.com/rust-lang/rust/pull/80527#issuecomment-787401519)
2021-03-03Change error about unknown doc attributes to a warningJoshua Nelson-4/+19
This prevents breakage across the ecosystem, since the error was just introduced recently without first having a warning period.
2021-03-02Report that `doc(plugins)` doesn't work using diagnostics instead of `println!`Joshua Nelson-1/+14
This also adds a test for the output and fixes `rustc_attr` to properly know that `plugins` is a valid attribute.
2021-03-02Clean up error reporting for deprecated passesJoshua Nelson-10/+38
- Use spans for deprecated attributes - Use a proper diagnostic for unknown passes, instead of error logging - Add tests for unknown passes - Improve some wording in diagnostics
2021-03-01Test that using the previous lint names still applies the lintJoshua Nelson-0/+28
2021-03-01Address review commentsJoshua Nelson-5/+18
- Move MISSING_CRATE_LEVEL_DOCS to rustdoc directly - Update documentation This also takes the opportunity to make the `no-crate-level-doc-lint` test more specific.
2021-03-01Improve error messagesJoshua Nelson-9/+7
- Use `register_renamed` when rustdoc is running so the lint will still be active and use a structured suggestion - Test the behavior for rustc, not just for rustdoc (because it differs)
2021-03-01Rename rustdoc lints to be a tool lint instead of built-in.Joshua Nelson-93/+122
- Rename `broken_intra_doc_links` to `rustdoc::broken_intra_doc_links` - Ensure that the old lint names still work and give deprecation errors - Register lints even when running doctests Otherwise, all `rustdoc::` lints would be ignored. - Register all existing lints as removed This unfortunately doesn't work with `register_renamed` because tool lints have not yet been registered when rustc is running. For similar reasons, `check_backwards_compat` doesn't work either. Call `register_removed` directly instead. - Fix fallout + Rustdoc lints for compiler/ + Rustdoc lints for library/ Note that this does *not* suggest `rustdoc::broken_intra_doc_links` for `rustdoc::intra_doc_link_resolution_failure`, since there was no time when the latter was valid.
2021-03-02Rollup merge of #82662 - GuillaumeGomez:doc-attr-check, r=jyn514Guillaume Gomez-0/+19
Warn about unknown doc attributes Fixes #82652. For the text error, I decided to go for "invalid" instead of "unknown". What do you think? r? `@jyn514`
2021-03-02Rollup merge of #82598 - GuillaumeGomez:rustdoc-rustc-pass, r=jyn514Guillaume Gomez-0/+13
Check stability and feature attributes in rustdoc Fixes #82588. cc `@Nemo157` `@camelid` r? `@jyn514`
2021-03-01Add tests for doc attribute checkGuillaume Gomez-0/+19
2021-02-28Remove deleted pass from rustdoc test suiteJoshua Nelson-1/+1
`src/test/rustdoc-ui/deprecated-attrs.rs` tells rustdoc to run the `collapse-docs` pass, which no longer exists (it was removed in https://github.com/rust-lang/rust/pull/80261). Rustdoc doesn't actually give a proper diagnostic here; instead it prints an `error!` log. Now that tracing is compiled unconditionally, the log is now being emitted by default, because it's at the error level. rustdoc shouldn't be using `error!` logging for diagnostics in the first place, but in the meantime this change gets the testsuite to pass.
2021-02-28Add test for rustdoc new check passGuillaume Gomez-0/+13
2021-02-19[intra-doc links] Don't check feature gates of items re-exported across cratesJoshua Nelson-0/+8
It should be never break another crate to re-export a public item. Note that this doesn't check the feature gate at *all* for other crates: - Feature-gates aren't currently serialized, so the only way to check the gate is with ad-hoc attribute checking. - Checking the feature gate twice (once when documenting the original crate and one when documenting the current crate) seems not great. This should still catch using the feature most of the time though, since people tend to document their own crates.
2021-02-19Rollup merge of #82261 - ojeda:rustdoc-argfile, r=jyn514Dylan DPC-0/+48
rustdoc: Support argument files Factors out the `rustc_driver` logic that handles argument files so that rustdoc supports them as well, e.g.: rustdoc `@argfile` This is needed to be able to generate docs for projects that already use argument files when compiling them, e.g. projects that pass a huge number of `--cfg` arguments. The feature was stabilized for `rustc` in #66172.
2021-02-19rustdoc: Support argument filesMiguel Ojeda-0/+48
Factors out the `rustc_driver` logic that handles argument files so that rustdoc supports them as well, e.g.: rustdoc @argfile This is needed to be able to generate docs for projects that already use argument files when compiling them, e.g. projects that pass a huge number of `--cfg` arguments. The feature was stabilized for `rustc` in #66172. Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2021-02-11Fix private intra-doc warnings on associated itemsJoshua Nelson-5/+26
The issue was that the `kind, id` override was previously only being considered for the disambiguator check, not the privacy check. This uses the same ID for both.
2021-02-04Add a test for the shortness format in rustdocAlexis Bourget-0/+28
2021-01-30Balance sidebar `Deref` cycle check with main contentJ. Ryan Stinnett-0/+15
The `Deref` cycle checks added as part of #80653 were "unbalanced" in the sense that the main content code path checks for cycles _before_ descending, while the sidebar checks _after_. Checking _before_ is correct, so this changes the sidebar path to match the main content path.
2021-01-23Add option to control doctest run directoryArpad Borsos-0/+35
This option will allow splitting the compile-time from the run-time directory of doctest invocations and is one step to solve https://github.com/rust-lang/cargo/issues/8993#issuecomment-760088944
2021-01-17Feature-gate `pointer` and `reference` in intra-doc linksJoshua Nelson-9/+39
- Only feature gate associated items - Add docs to unstable book
2021-01-16Add a testÖmer Sinan Ağacan-0/+17
2021-01-13Update tests for extern block lintingMark Rousskov-3/+5
2021-01-08Auto merge of #80653 - jryans:doc-deref-recursive, r=jyn514,GuillaumeGomezbors-0/+17
Recursively document methods via `Deref` traits This changes `rustdoc` to recursively follow `Deref` targets so that methods from all levels are added to the rendered output. This implementation displays the methods from all levels in the expanded state with separate sections for each level. ![image](https://user-images.githubusercontent.com/279572/103482863-46723b00-4ddb-11eb-972b-c463351a425c.png) Fixes https://github.com/rust-lang/rust/issues/26207 Fixes https://github.com/rust-lang/rust/issues/53038 Fixes https://github.com/rust-lang/rust/issues/71640 r? `@jyn514`
2021-01-08Recursively document methods via `Deref` traitsJ. Ryan Stinnett-0/+17
2021-01-08Rollup merge of #80799 - jyn514:pretty-print, r=CraftSpiderYuki Okushi-0/+3
Get rid of custom pretty-printing in rustdoc and use rustc_hir_pretty directly instead. Closes https://github.com/rust-lang/rust/issues/79497. r? `@CraftSpider`
2021-01-08Rollup merge of #80372 - jyn514:fix-panics, r=ManishearthYuki Okushi-0/+20
Don't panic when an external crate can't be resolved This isn't actually a bug, it can occur when rustdoc tries to resolve a crate that isn't used in the main code. Fixes #72381. r? `@kinnison` if you have time, otherwise `@Manishearth`
2021-01-07Get rid of custom pretty-printing in rustdocJoshua Nelson-0/+3
and use rustc_hir_pretty directly instead
2021-01-08Rollup merge of #80660 - max-heller:issue-80559-fix, r=jyn514Yuki Okushi-0/+18
Properly handle primitive disambiguators in rustdoc Fixes #80559 r? ``@jyn514`` Is there a way to test that the generated intra-doc link is what I expect?
2021-01-05Remove useless doc_alias featureGuillaume Gomez-4/+2
2021-01-04fix incompatible disambiguator testmax-heller-0/+18