summary refs log tree commit diff
path: root/tests/rustdoc-ui
AgeCommit message (Collapse)AuthorLines
2024-01-31Don't hash lints differently to non-lints.Nicholas Nethercote-3/+0
`Diagnostic::keys`, which is used for hashing and equating diagnostics, has a surprising behaviour: it ignores children, but only for lints. This was added in #88493 to fix some duplicated diagnostics, but it doesn't seem necessary any more. This commit removes the special case and only four tests have changed output, with additional errors. And those additional errors aren't exact duplicates, they're just similar. For example, in src/tools/clippy/tests/ui/same_name_method.rs we currently have this error: ``` error: method's name is the same as an existing method in a trait --> $DIR/same_name_method.rs:75:13 | LL | fn foo() {} | ^^^^^^^^^^^ | note: existing `foo` defined here --> $DIR/same_name_method.rs:79:9 | LL | impl T1 for S {} | ^^^^^^^^^^^^^^^^ ``` and with this change we also get this error: ``` error: method's name is the same as an existing method in a trait --> $DIR/same_name_method.rs:75:13 | LL | fn foo() {} | ^^^^^^^^^^^ | note: existing `foo` defined here --> $DIR/same_name_method.rs:81:9 | LL | impl T2 for S {} | ^^^^^^^^^^^^^^^^ ``` I think printing this second argument is reasonable, possibly even preferable to hiding it. And the other cases are similar.
2024-01-18Rollup merge of #119730 - vuittont60:master, r=GuillaumeGomezMatthias Krüger-1/+1
docs: fix typos
2024-01-14Rollup merge of #119561 - notriddle:master, r=fmeaseGuillaume Gomez-0/+210
rustdoc: rename `issue-\d+.rs` tests to have meaningful names (part 5) Follow up * https://github.com/rust-lang/rust/pull/116214 * https://github.com/rust-lang/rust/pull/116432 * https://github.com/rust-lang/rust/pull/116824 * https://github.com/rust-lang/rust/pull/118105
2024-01-13Bless testsGeorge-lewis-0/+7
Update tests
2024-01-11Rollup merge of #119841 - nnethercote:rm-DiagnosticBuilder-buffer, r=oli-obkMatthias Krüger-1/+1
Remove `DiagnosticBuilder::buffer` `DiagnosticBuilder::buffer` doesn't do much, and part of what it does (for `-Ztreat-err-as-bug`) it shouldn't. This PR strips it back, replaces its uses, and finally removes it, making a few cleanups in the vicinity along the way. r? ``@oli-obk``
2024-01-11Taint more aggressively in astconvOli Scherer-21/+3
2024-01-11Use the right level with `-Ztreat-err-as-bug`.Nicholas Nethercote-1/+1
Errors in `DiagCtxtInner::emit_diagnostic` are never set to `Level::Bug`, because the condition never succeeds, because `self.treat_err_as_bug()` is called *before* the error counts are incremented. This commit switches to `self.treat_next_err_as_bug()`, fixing the problem. This changes the error message output to actually say "internal compiler error".
2024-01-09fix typovuittont60-1/+1
2024-01-05Rollup merge of #119148 - estebank:bare-traits, r=davidtwcoMichael Goulet-0/+4
Tweak suggestions for bare trait used as a type ``` error[E0782]: trait objects must include the `dyn` keyword --> $DIR/not-on-bare-trait-2021.rs:11:11 | LL | fn bar(x: Foo) -> Foo { | ^^^ | help: use a generic type parameter, constrained by the trait `Foo` | LL | fn bar<T: Foo>(x: T) -> Foo { | ++++++++ ~ help: you can also use `impl Foo`, but users won't be able to specify the type paramer when calling the `fn`, having to rely exclusively on type inference | LL | fn bar(x: impl Foo) -> Foo { | ++++ help: alternatively, use a trait object to accept any type that implements `Foo`, accessing its methods at runtime using dynamic dispatch | LL | fn bar(x: &dyn Foo) -> Foo { | ++++ error[E0782]: trait objects must include the `dyn` keyword --> $DIR/not-on-bare-trait-2021.rs:11:19 | LL | fn bar(x: Foo) -> Foo { | ^^^ | help: use `impl Foo` to return an opaque type, as long as you return a single underlying type | LL | fn bar(x: Foo) -> impl Foo { | ++++ help: alternatively, you can return an owned trait object | LL | fn bar(x: Foo) -> Box<dyn Foo> { | +++++++ + ``` Fix #119525: ``` error[E0038]: the trait `Ord` cannot be made into an object --> $DIR/bare-trait-dont-suggest-dyn.rs:3:33 | LL | fn ord_prefer_dot(s: String) -> Ord { | ^^^ `Ord` cannot be made into an object | note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> --> $SRC_DIR/core/src/cmp.rs:LL:COL | = note: the trait cannot be made into an object because it uses `Self` as a type parameter ::: $SRC_DIR/core/src/cmp.rs:LL:COL | = note: the trait cannot be made into an object because it uses `Self` as a type parameter help: consider using an opaque type instead | LL | fn ord_prefer_dot(s: String) -> impl Ord { | ++++ ```
2024-01-04Rollup merge of #119184 - Rajveer100:branch-for-issue-118752, r=davidtwcoMatthias Krüger-5/+6
Switch from using `//~ERROR` annotations with `--error-format` to `error-pattern` Fixes #118752 As noticed by ```@jyn514``` while working on a patch, tests failed due to `//~ERROR` annotations used in combination with the older `--error-format` which is now `error-pattern`.
2024-01-04Silence redundant warning when E0038 will be emittedEsteban Küber-0/+4
2024-01-03Add `check-pass` to ice testsMichael Howell-0/+2
2024-01-03rustdoc: rename `issue-\d+.rs` tests to have meaningful names (part 5)Michael Howell-0/+208
2023-12-21Switch from using `//~ERROR` annotations with `--error-format` to ↵Rajveer-5/+6
`error-pattern` Resolves Issue #118752
2023-12-21Simple modification of diagnostic informationsurechen-2/+2
fixes #119067
2023-12-13Auto merge of #118213 - Urgau:check-cfg-diagnostics-rustc-cargo, r=petrochenkovbors-0/+4
Add more suggestions to unexpected cfg names and values This pull request adds more suggestion to unexpected cfg names and values diagnostics: - it first adds a links to the [rustc unstable book](https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html) or the [Cargo reference](https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#check-cfg), depending if rustc is invoked by Cargo - it secondly adds a suggestion on how to expect the cfg name or value: *excluding well known names and values* - for Cargo: it suggest using a feature or `cargo:rust-check-cfg` in build script - for rustc: it suggest using `--check-cfg` (with the correct invocation) Those diagnostics improvements are directed towards enabling users to fix the issue if the previous suggestions weren't good enough. r? `@petrochenkov`
2023-12-13Add more suggestion to unexpected cfg names and valuesUrgau-0/+4
2023-12-12Add a test for a codeblock with multiple invalid attributesGuillaume Gomez-1/+39
2023-12-12Follow guidelines for lint suggestionsGuillaume Gomez-27/+55
2023-12-12Add test for `rustX` codeblock attributeGuillaume Gomez-1/+20
2023-12-02Rename `HandlerInner::delay_span_bug` as `HandlerInner::span_delayed_bug`.Nicholas Nethercote-9/+9
Because the corresponding `Level` is `DelayedBug` and `span_delayed_bug` follows the pattern used everywhere else: `span_err`, `span_warning`, etc.
2023-11-24Manual find replace updatesNilstrieb-2/+2
2023-11-24Bless rustdoc-ui testsNilstrieb-64/+64
Co-authored-by: Adrian <adrian.iosdev@gmail.com>
2023-11-23rustdoc: move ICE tests to uiMichael Howell-0/+88
2023-11-08Mark Rustdoc test as Linux-onlyJake Goulding-1/+1
Due to incorrect CI configuration, this test was not being run on macOS. aarch64-apple-darwin will start running it, so we correct the configuration.
2023-11-04Remove support for compiler plugins.Nicholas Nethercote-2/+2
They've been deprecated for four years. This commit includes the following changes. - It eliminates the `rustc_plugin_impl` crate. - It changes the language used for lints in `compiler/rustc_driver_impl/src/lib.rs` and `compiler/rustc_lint/src/context.rs`. External lints are now called "loaded" lints, rather than "plugins" to avoid confusion with the old plugins. This only has a tiny effect on the output of `-W help`. - E0457 and E0498 are no longer used. - E0463 is narrowed, now only relating to unfound crates, not plugins. - The `plugin` feature was moved from "active" to "removed". - It removes the entire plugins chapter from the unstable book. - It removes quite a few tests, mostly all of those in `tests/ui-fulldeps/plugin/`. Closes #29597.
2023-10-31Accept less invalid Rust in rustdocOli Scherer-60/+376
2023-10-20s/generator/coroutine/Oli Scherer-1/+1
2023-10-17Rollup merge of #111072 - Urgau:check-cfg-new-syntax, r=petrochenkovMatthias Krüger-3/+3
Add new simpler and more explicit syntax for check-cfg <details> <summary> Old proposition (before the MCP) </summary> This PR adds a new simpler and more explicit syntax for check-cfg. It consist of two new form: - `exhaustive(names, values)` - `configure(name, "value1", "value2", ... "valueN")` The preview forms `names(...)` and `values(...)` have implicit meaning that are not strait-forward. In particular `values(foo)`&`values(bar)` and `names(foo, bar)` are not equivalent which has created [some confusions](https://github.com/rust-lang/rust/pull/98080). Also the `names()` and `values()` form are not clear either and again created some confusions where peoples believed that `values()`&`values(foo)` could be reduced to just `values(foo)`. To fix that the two new forms are made to be explicit and simpler. See the table of correspondence: - `names()` -> `exhaustive(names)` - `values()` -> `exhaustive(values)` - `names(foo)` -> `exhaustive(names)`&`configure(foo)` - `values(foo)` -> `configure(foo)` - `values(feat, "foo", "bar")` -> `configure(feat, "foo", "bar")` - `values(foo)`&`values(bar)` -> `configure(foo, bar)` - `names()`&`values()`&`values(my_cfg)` -> `exhaustive(names, values)`&`configure(my_cfg)` Another benefits of the new syntax is that it allow for further options (like conditional checking for --cfg, currently always on) without syntax change. The two previous forms are deprecated and will be removed once cargo and beta rustc have the necessary support. </details> This PR is the first part of the implementation of [MCP636 - Simplify and improve explicitness of the check-cfg syntax](https://github.com/rust-lang/compiler-team/issues/636). ## New `cfg` form It introduces the new [`cfg` form](https://github.com/rust-lang/compiler-team/issues/636) and deprecate the other two: ``` rustc --check-cfg 'cfg(name1, ..., nameN, values("value1", "value2", ... "valueN"))' ``` ## Default built-in names and values It also changes the default for the built-in names and values checking. - Built-in values checking would always be activated as long as a `--check-cfg` argument is present - Built-in names checking would always be activated as long as a `--check-cfg` argument is present **unless** if any `cfg(any())` arg is passed ~~**Note: depends on https://github.com/rust-lang/rust/pull/111068 but is reviewable (last two commits)!**~~ Resolve https://github.com/rust-lang/compiler-team/issues/636 r? `@petrochenkov`
2023-10-16rustdoc: add `check-pass` to ICE test with no expected outputMichael Howell-0/+2
2023-10-16rustdoc: move ICE test to rustdoc-uiMichael Howell-0/+14
2023-10-16Rollup merge of #116257 - estebank:issue-101351, r=b-naberMatthias Krüger-1/+6
Suggest trait bounds for used associated type on type param Fix #101351. When an associated type on a type parameter is used, and the type parameter isn't constrained by the correct trait, suggest the appropriate trait bound: ``` error[E0220]: associated type `Associated` not found for `T` --> file.rs:6:15 | 6 | field: T::Associated, | ^^^^^^^^^^ there is a similarly named associated type `Associated` in the trait `Foo` | help: consider restricting type parameter `T` | 5 | struct Generic<T: Foo> { | +++++ ``` When an associated type on a type parameter has a typo, suggest fixing it: ``` error[E0220]: associated type `Baa` not found for `T` --> $DIR/issue-55673.rs:9:8 | LL | T::Baa: std::fmt::Debug, | ^^^ there is a similarly named associated type `Bar` in the trait `Foo` | help: change the associated type name to use `Bar` from `Foo` | LL | T::Bar: std::fmt::Debug, | ~~~ ```
2023-10-13Tweak wordingEsteban Küber-1/+1
2023-10-13Suggest trait bounds for used associated type on type paramEsteban Küber-0/+5
Fix #101351. When an associated type on a type parameter is used, and the type parameter isn't constrained by the correct trait, suggest the appropriate trait bound: ``` error[E0220]: associated type `Associated` not found for `T` --> file.rs:6:15 | 6 | field: T::Associated, | ^^^^^^^^^^ there is a similarly named associated type `Associated` in the trait `Foo` | help: consider restricting type parameter `T` | 5 | struct Generic<T: Foo> { | +++++ ``` When an associated type on a type parameter has a typo, suggest fixing it: ``` error[E0220]: associated type `Baa` not found for `T` --> $DIR/issue-55673.rs:9:8 | LL | T::Baa: std::fmt::Debug, | ^^^ there is a similarly named associated type `Bar` in the trait `Foo` | help: change the associated type name to use `Bar` from `Foo` | LL | T::Bar: std::fmt::Debug, | ~~~ ```
2023-10-13MCP636: Adapt check-cfg tests to the new syntaxUrgau-3/+3
2023-10-12check-cfg: update rustdoc ui check-cfg testsUrgau-2/+2
2023-10-05Add a note to duplicate diagnosticsAlex Macleod-29/+26
2023-09-24Add regression test for #102467Guillaume Gomez-0/+24
2023-09-19Update tests for custom classesGuillaume Gomez-41/+9
2023-09-19Add new rustdoc-ui test for `custom_code_classes_in_docs` featureGuillaume Gomez-1/+20
2023-09-17Update tests for `custom_code_classes_in_docs` featureGuillaume Gomez-5/+9
2023-09-15Implement new eBNF for codeblock attributesGuillaume Gomez-61/+145
2023-09-15Add support for double quotes in markdown codeblock attributesGuillaume Gomez-0/+50
2023-09-15Add tests for `custom_code_classes_in_docs` featureGuillaume Gomez-0/+136
2023-08-21rustdoc: use unicode-aware checks for redundant explicit link fastpathMichael Howell-0/+18
Fixes #115064
2023-08-18Add regression test for inline docKyle Lin-0/+13
2023-08-18fix `unescaped_backticks` errorKyle Lin-64/+64
2023-08-18narrow down the lint trigger constraintKyle Lin-0/+1
2023-08-18add missing deny lintKyle Lin-0/+2
2023-08-18Add check-pass tests and fix test behaviorKyle Lin-0/+4