mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-26 13:01:27 +03:00
Add test for coalescing of diagnostic attribute duplicates
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
error[E0277]: this message
|
||||
--> $DIR/duplicate_coalescing.rs:15:17
|
||||
|
|
||||
LL | takes_trait(());
|
||||
| ----------- ^^ this label
|
||||
| |
|
||||
| required by a bound introduced by this call
|
||||
|
|
||||
= help: the trait `Trait` is not implemented for `()`
|
||||
= note: a note
|
||||
= note: another note
|
||||
help: this trait has no implementations, consider adding one
|
||||
--> $DIR/duplicate_coalescing.rs:10:1
|
||||
|
|
||||
LL | trait Trait {}
|
||||
| ^^^^^^^^^^^
|
||||
note: required by a bound in `takes_trait`
|
||||
--> $DIR/duplicate_coalescing.rs:12:24
|
||||
|
|
||||
LL | fn takes_trait(_: impl Trait) {}
|
||||
| ^^^^^ required by this bound in `takes_trait`
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0277`.
|
||||
@@ -0,0 +1,24 @@
|
||||
error[E0277]: this message
|
||||
--> $DIR/duplicate_coalescing.rs:15:17
|
||||
|
|
||||
LL | takes_trait(());
|
||||
| ----------- ^^ this label
|
||||
| |
|
||||
| required by a bound introduced by this call
|
||||
|
|
||||
= help: the trait `Trait` is not implemented for `()`
|
||||
= note: a note
|
||||
help: this trait has no implementations, consider adding one
|
||||
--> $DIR/duplicate_coalescing.rs:10:1
|
||||
|
|
||||
LL | trait Trait {}
|
||||
| ^^^^^^^^^^^
|
||||
note: required by a bound in `takes_trait`
|
||||
--> $DIR/duplicate_coalescing.rs:12:24
|
||||
|
|
||||
LL | fn takes_trait(_: impl Trait) {}
|
||||
| ^^^^^ required by this bound in `takes_trait`
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0277`.
|
||||
@@ -0,0 +1,24 @@
|
||||
error[E0277]: this message
|
||||
--> $DIR/duplicate_coalescing.rs:15:17
|
||||
|
|
||||
LL | takes_trait(());
|
||||
| ----------- ^^ the trait `Trait` is not implemented for `()`
|
||||
| |
|
||||
| required by a bound introduced by this call
|
||||
|
|
||||
= note: a note
|
||||
= note: another note
|
||||
help: this trait has no implementations, consider adding one
|
||||
--> $DIR/duplicate_coalescing.rs:10:1
|
||||
|
|
||||
LL | trait Trait {}
|
||||
| ^^^^^^^^^^^
|
||||
note: required by a bound in `takes_trait`
|
||||
--> $DIR/duplicate_coalescing.rs:12:24
|
||||
|
|
||||
LL | fn takes_trait(_: impl Trait) {}
|
||||
| ^^^^^ required by this bound in `takes_trait`
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0277`.
|
||||
@@ -0,0 +1,22 @@
|
||||
//@ revisions: label note both
|
||||
//@[both] compile-flags: --cfg label --cfg note
|
||||
//@ dont-require-annotations: NOTE
|
||||
|
||||
//! Example and test of multiple diagnostic attributes coalescing together.
|
||||
|
||||
#[diagnostic::on_unimplemented(message = "this message", note = "a note")]
|
||||
#[cfg_attr(label, diagnostic::on_unimplemented(label = "this label"))]
|
||||
#[cfg_attr(note, diagnostic::on_unimplemented(note = "another note"))]
|
||||
trait Trait {}
|
||||
|
||||
fn takes_trait(_: impl Trait) {}
|
||||
|
||||
fn main() {
|
||||
takes_trait(());
|
||||
//~^ERROR this message
|
||||
//[label]~|NOTE this label
|
||||
//[both]~|NOTE this label
|
||||
//~|NOTE a note
|
||||
//[note]~|NOTE another note
|
||||
//[both]~|NOTE another note
|
||||
}
|
||||
Reference in New Issue
Block a user