diff options
| author | Esteban Küber <esteban@kuber.com.ar> | 2024-05-07 22:29:52 +0000 |
|---|---|---|
| committer | Esteban Küber <esteban@kuber.com.ar> | 2024-05-07 22:31:22 +0000 |
| commit | 758e459427946d89a3d900973923e504f712babc (patch) | |
| tree | a147a6c6828e0084924c708937822ce96a6dceb1 /tests/ui/diagnostic_namespace | |
| parent | 4847f2249f03b249956d2daa90a12f4ee66543a8 (diff) | |
| download | rust-758e459427946d89a3d900973923e504f712babc.tar.gz rust-758e459427946d89a3d900973923e504f712babc.zip | |
Add test for #124651
Diffstat (limited to 'tests/ui/diagnostic_namespace')
3 files changed, 36 insertions, 0 deletions
diff --git a/tests/ui/diagnostic_namespace/auxiliary/bad_on_unimplemented.rs b/tests/ui/diagnostic_namespace/auxiliary/bad_on_unimplemented.rs new file mode 100644 index 00000000000..4a5fca43e36 --- /dev/null +++ b/tests/ui/diagnostic_namespace/auxiliary/bad_on_unimplemented.rs @@ -0,0 +1,2 @@ +#[diagnostic::on_unimplemented(aa = "broken")] +pub trait Test {} diff --git a/tests/ui/diagnostic_namespace/on_unimplemented_ice.rs b/tests/ui/diagnostic_namespace/on_unimplemented_ice.rs new file mode 100644 index 00000000000..8969f5030e2 --- /dev/null +++ b/tests/ui/diagnostic_namespace/on_unimplemented_ice.rs @@ -0,0 +1,17 @@ +//@ edition:2021 +//@ compile-flags:--test +//@ aux-build:bad_on_unimplemented.rs + +// Do not ICE when encountering a malformed `#[diagnostic::on_unimplemented]` annotation in a +// dependency when incorrectly used (#124651). + +extern crate bad_on_unimplemented; + +use bad_on_unimplemented::Test; + +fn breakage<T: Test>(_: T) {} + +#[test] +fn test() { + breakage(1); //~ ERROR E0277 +} diff --git a/tests/ui/diagnostic_namespace/on_unimplemented_ice.stderr b/tests/ui/diagnostic_namespace/on_unimplemented_ice.stderr new file mode 100644 index 00000000000..1c0da96abd9 --- /dev/null +++ b/tests/ui/diagnostic_namespace/on_unimplemented_ice.stderr @@ -0,0 +1,17 @@ +error[E0277]: the trait bound `{integer}: Test` is not satisfied + --> $DIR/on_unimplemented_ice.rs:16:14 + | +LL | breakage(1); + | -------- ^ the trait `Test` is not implemented for `{integer}` + | | + | required by a bound introduced by this call + | +note: required by a bound in `breakage` + --> $DIR/on_unimplemented_ice.rs:12:16 + | +LL | fn breakage<T: Test>(_: T) {} + | ^^^^ required by this bound in `breakage` + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0277`. |
