Commit Graph

152 Commits

Author SHA1 Message Date
Michael Howell
35830fe218 rustdoc: rename issue-\d+.rs tests to have meaningful names (part 5) 2024-01-03 15:33:12 -07:00
surechen
4897d5eccf Simple modification of diagnostic information
fixes #119067
2023-12-21 10:17:11 +08:00
bors
a90372c6e8 Auto merge of #118213 - Urgau:check-cfg-diagnostics-rustc-cargo, r=petrochenkov
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-13 19:45:57 +00:00
Urgau
5345a166fe Add more suggestion to unexpected cfg names and values 2023-12-13 17:48:04 +01:00
Guillaume Gomez
58327c10c5 Add a test for a codeblock with multiple invalid attributes 2023-12-12 19:41:09 +01:00
Guillaume Gomez
bb0fd665a8 Follow guidelines for lint suggestions 2023-12-12 15:43:20 +01:00
Guillaume Gomez
98aa20b0a7 Add test for rustX codeblock attribute 2023-12-12 15:42:49 +01:00
Nicholas Nethercote
5d1d384443 Rename HandlerInner::delay_span_bug as HandlerInner::span_delayed_bug.
Because the corresponding `Level` is `DelayedBug` and `span_delayed_bug`
follows the pattern used everywhere else: `span_err`, `span_warning`,
etc.
2023-12-02 09:01:19 +11:00
Nilstrieb
9b80d85722 Manual find replace updates 2023-11-24 21:04:51 +01:00
Nilstrieb
87a354b15d Bless rustdoc-ui tests
Co-authored-by: Adrian <adrian.iosdev@gmail.com>
2023-11-24 19:15:52 +01:00
Michael Howell
fdde5c77a8 rustdoc: move ICE tests to ui 2023-11-23 14:54:19 -07:00
Jake Goulding
469d34b39b Mark Rustdoc test as Linux-only
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-08 08:53:58 -05:00
Nicholas Nethercote
5c462a32bd Remove support for compiler plugins.
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-11-04 08:50:46 +11:00
Oli Scherer
4512f211ae Accept less invalid Rust in rustdoc 2023-10-31 13:58:03 +00:00
Oli Scherer
e96ce20b34 s/generator/coroutine/ 2023-10-20 21:14:01 +00:00
Matthias Krüger
ce407429dd
Rollup merge of #111072 - Urgau:check-cfg-new-syntax, r=petrochenkov
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-17 19:07:21 +02:00
Michael Howell
c0b6a5d340 rustdoc: add check-pass to ICE test with no expected output 2023-10-16 18:03:22 -07:00
Michael Howell
94b39e8c86 rustdoc: move ICE test to rustdoc-ui 2023-10-16 18:02:11 -07:00
Matthias Krüger
14663e09b7
Rollup merge of #116257 - estebank:issue-101351, r=b-naber
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-16 19:10:49 +02:00
Esteban Küber
20c622e456 Tweak wording 2023-10-13 19:18:46 +00:00
Esteban Küber
781e86477c 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-13 19:13:56 +00:00
Urgau
fc78d78988 MCP636: Adapt check-cfg tests to the new syntax 2023-10-13 13:51:03 +02:00
Urgau
ed922d8c72 check-cfg: update rustdoc ui check-cfg tests 2023-10-12 18:39:35 +02:00
Alex Macleod
5453a9f34d Add a note to duplicate diagnostics 2023-10-05 01:04:41 +00:00
Guillaume Gomez
79f3fe48b0 Add regression test for #102467 2023-09-24 14:09:38 +02:00
Guillaume Gomez
295ec09b63 Update tests for custom classes 2023-09-19 17:29:39 +02:00
Guillaume Gomez
494fdcd8ec Add new rustdoc-ui test for custom_code_classes_in_docs feature 2023-09-19 13:19:15 +02:00
Guillaume Gomez
c17abf124c Update tests for custom_code_classes_in_docs feature 2023-09-17 15:11:44 +02:00
Guillaume Gomez
7681f63cab Implement new eBNF for codeblock attributes 2023-09-15 21:32:28 +02:00
Guillaume Gomez
4ce17fa30e Add support for double quotes in markdown codeblock attributes 2023-09-15 21:32:28 +02:00
Guillaume Gomez
f5561842e3 Add tests for custom_code_classes_in_docs feature 2023-09-15 21:32:28 +02:00
Michael Howell
3df9b4d65d rustdoc: use unicode-aware checks for redundant explicit link fastpath
Fixes #115064
2023-08-21 14:25:26 -07:00
Kyle Lin
25919b09a9 Add regression test for inline doc 2023-08-18 15:31:36 +08:00
Kyle Lin
62113f6657 fix unescaped_backticks error 2023-08-18 15:31:32 +08:00
Kyle Lin
ecb26376e5 narrow down the lint trigger constraint 2023-08-18 15:19:22 +08:00
Kyle Lin
fe17ae3af6 add missing deny lint 2023-08-18 15:19:18 +08:00
Kyle Lin
0e2f2cccd7 Add check-pass tests and fix test behavior 2023-08-18 15:19:18 +08:00
Kyle Lin
5ce6cc7df3 Still resolving rustdoc resolution panicking 2023-08-18 15:19:17 +08:00
Kyle Lin
46df95817d Support Reference & ReferenceUnknown link lint 2023-08-18 15:19:16 +08:00
Kyle Lin
c7369891ba Refactor lint from rustc to rustdoc 2023-08-18 15:19:15 +08:00
Kyle Lin
e583318aa8 fix trailing whitespace 2023-08-18 15:19:12 +08:00
Kyle Lin
f1b23f29db bless test output 2023-08-18 15:19:11 +08:00
Kyle Lin
1c6b237f9e add more tests 2023-08-18 15:19:11 +08:00
Kyle Lin
65e24a57bb Fix resolution caching 2023-08-18 15:19:10 +08:00
Kyle Lin
da582a71d2 Add warn level lint redundant_explicit_links
- Currently it will panic due to the resolution's caching issue
2023-08-18 15:19:08 +08:00
Yuri Astrakhan
2c5ecf22a2 Fix windows test output. 2023-08-01 14:24:11 +02:00
Mara Bos
893bb8e1ce Fix test output. 2023-07-29 11:42:53 +02:00
Mara Bos
0e729404da Change default panic handler message format. 2023-07-29 11:42:50 +02:00
Lukas Markeffsky
637ea3f746 validate doc(masked) 2023-07-24 18:04:35 +02:00
Lukas Markeffsky
237ed1630f add tests for broken links in unused doc strings 2023-07-22 13:02:49 +02:00