diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2024-03-22 08:19:44 +0100 |
|---|---|---|
| committer | Matthias Krüger <matthias.krueger@famsik.de> | 2024-03-22 08:19:44 +0100 |
| commit | 4d9ce7a1a2f78e26b58c4464f43aab21100ea1f3 (patch) | |
| tree | e17a590fc1bbc68f8e937aee81e56dc6a46ad4c1 | |
| parent | 1bcbed19d1629d8a67f322c76b8fc4a29e51539f (diff) | |
| download | rust-4d9ce7a1a2f78e26b58c4464f43aab21100ea1f3.tar.gz rust-4d9ce7a1a2f78e26b58c4464f43aab21100ea1f3.zip | |
add test for ice #121472
Fixes #121472
| -rw-r--r-- | tests/ui/type-alias-impl-trait/underef-index-out-of-bounds-121472.rs | 16 | ||||
| -rw-r--r-- | tests/ui/type-alias-impl-trait/underef-index-out-of-bounds-121472.stderr | 23 |
2 files changed, 39 insertions, 0 deletions
diff --git a/tests/ui/type-alias-impl-trait/underef-index-out-of-bounds-121472.rs b/tests/ui/type-alias-impl-trait/underef-index-out-of-bounds-121472.rs new file mode 100644 index 00000000000..37e0d89efc7 --- /dev/null +++ b/tests/ui/type-alias-impl-trait/underef-index-out-of-bounds-121472.rs @@ -0,0 +1,16 @@ +// test for ICE #121472 index out of bounds un_derefer.rs +#![feature(type_alias_impl_trait)] + +trait T {} + +type Alias<'a> = impl T; + +struct S; +impl<'a> T for &'a S {} + +fn with_positive(fun: impl Fn(Alias<'_>)) {} + +fn main() { + with_positive(|&n| ()); + //~^ ERROR mismatched types +} diff --git a/tests/ui/type-alias-impl-trait/underef-index-out-of-bounds-121472.stderr b/tests/ui/type-alias-impl-trait/underef-index-out-of-bounds-121472.stderr new file mode 100644 index 00000000000..a224bab0705 --- /dev/null +++ b/tests/ui/type-alias-impl-trait/underef-index-out-of-bounds-121472.stderr @@ -0,0 +1,23 @@ +error[E0308]: mismatched types + --> $DIR/underef-index-out-of-bounds-121472.rs:14:20 + | +LL | type Alias<'a> = impl T; + | ------ the expected opaque type +... +LL | with_positive(|&n| ()); + | ^^ + | | + | expected opaque type, found `&_` + | expected due to this + | + = note: expected opaque type `Alias<'_>` + found reference `&_` +help: consider removing `&` from the pattern + | +LL - with_positive(|&n| ()); +LL + with_positive(|n| ()); + | + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0308`. |
