mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-23 07:14:28 +00:00
160b1793b2
notes This commit extends the `#[diagnostic::on_unimplemented]` (and `#[rustc_on_unimplemented]`) attributes to allow multiple `note` options. This enables emitting multiple notes for custom error messages. For now I've opted to not change any of the existing usages of `#[rustc_on_unimplemented]` and just updated the relevant compile tests.
19 lines
428 B
Rust
19 lines
428 B
Rust
#![feature(diagnostic_namespace)]
|
|
|
|
#[diagnostic::on_unimplemented(message = "Foo", label = "Bar", note = "Baz", note = "Boom")]
|
|
trait Foo {}
|
|
|
|
#[diagnostic::on_unimplemented(message = "Bar", label = "Foo", note = "Baz")]
|
|
#[diagnostic::on_unimplemented(note = "Baz2")]
|
|
trait Bar {}
|
|
|
|
fn takes_foo(_: impl Foo) {}
|
|
fn takes_bar(_: impl Bar) {}
|
|
|
|
fn main() {
|
|
takes_foo(());
|
|
//~^ERROR Foo
|
|
takes_bar(());
|
|
//~^ERROR Bar
|
|
}
|