d013b5a462
This PR stabilizes the `#[diagnostic]` attribute namespace and a minimal option of the `#[diagnostic::on_unimplemented]` attribute. The `#[diagnostic]` attribute namespace is meant to provide a home for attributes that allow users to influence error messages emitted by the compiler. The compiler is not guaranteed to use any of this hints, however it should accept any (non-)existing attribute in this namespace and potentially emit lint-warnings for unused attributes and options. This is meant to allow discarding certain attributes/options in the future to allow fundamental changes to the compiler without the need to keep then non-meaningful options working. The `#[diagnostic::on_unimplemented]` attribute is allowed to appear on a trait definition. This allows crate authors to hint the compiler to emit a specific error message if a certain trait is not implemented. For the `#[diagnostic::on_unimplemented]` attribute the following options are implemented: * `message` which provides the text for the top level error message * `label` which provides the text for the label shown inline in the broken code in the error message * `note` which provides additional notes. The `note` option can appear several times, which results in several note messages being emitted. If any of the other options appears several times the first occurrence of the relevant option specifies the actually used value. Any other occurrence generates an lint warning. For any other non-existing option a lint-warning is generated. All three options accept a text as argument. This text is allowed to contain format parameters referring to generic argument or `Self` by name via the `{Self}` or `{NameOfGenericArgument}` syntax. For any non-existing argument a lint warning is generated. Tracking issue: #111996
48 lines
1.2 KiB
Plaintext
48 lines
1.2 KiB
Plaintext
error[E0277]: Foo
|
|
--> $DIR/multiple_notes.rs:12:15
|
|
|
|
|
LL | takes_foo(());
|
|
| --------- ^^ Bar
|
|
| |
|
|
| required by a bound introduced by this call
|
|
|
|
|
= help: the trait `Foo` is not implemented for `()`
|
|
= note: Baz
|
|
= note: Boom
|
|
help: this trait has no implementations, consider adding one
|
|
--> $DIR/multiple_notes.rs:2:1
|
|
|
|
|
LL | trait Foo {}
|
|
| ^^^^^^^^^
|
|
note: required by a bound in `takes_foo`
|
|
--> $DIR/multiple_notes.rs:8:22
|
|
|
|
|
LL | fn takes_foo(_: impl Foo) {}
|
|
| ^^^ required by this bound in `takes_foo`
|
|
|
|
error[E0277]: Bar
|
|
--> $DIR/multiple_notes.rs:14:15
|
|
|
|
|
LL | takes_bar(());
|
|
| --------- ^^ Foo
|
|
| |
|
|
| required by a bound introduced by this call
|
|
|
|
|
= help: the trait `Bar` is not implemented for `()`
|
|
= note: Baz
|
|
= note: Baz2
|
|
help: this trait has no implementations, consider adding one
|
|
--> $DIR/multiple_notes.rs:6:1
|
|
|
|
|
LL | trait Bar {}
|
|
| ^^^^^^^^^
|
|
note: required by a bound in `takes_bar`
|
|
--> $DIR/multiple_notes.rs:9:22
|
|
|
|
|
LL | fn takes_bar(_: impl Bar) {}
|
|
| ^^^ required by this bound in `takes_bar`
|
|
|
|
error: aborting due to 2 previous errors
|
|
|
|
For more information about this error, try `rustc --explain E0277`.
|