Skip to content

Commit 4d9ce7a

Browse files
committed
add test for ice #121472
Fixes #121472
1 parent 1bcbed1 commit 4d9ce7a

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// test for ICE #121472 index out of bounds un_derefer.rs
2+
#![feature(type_alias_impl_trait)]
3+
4+
trait T {}
5+
6+
type Alias<'a> = impl T;
7+
8+
struct S;
9+
impl<'a> T for &'a S {}
10+
11+
fn with_positive(fun: impl Fn(Alias<'_>)) {}
12+
13+
fn main() {
14+
with_positive(|&n| ());
15+
//~^ ERROR mismatched types
16+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
error[E0308]: mismatched types
2+
--> $DIR/underef-index-out-of-bounds-121472.rs:14:20
3+
|
4+
LL | type Alias<'a> = impl T;
5+
| ------ the expected opaque type
6+
...
7+
LL | with_positive(|&n| ());
8+
| ^^
9+
| |
10+
| expected opaque type, found `&_`
11+
| expected due to this
12+
|
13+
= note: expected opaque type `Alias<'_>`
14+
found reference `&_`
15+
help: consider removing `&` from the pattern
16+
|
17+
LL - with_positive(|&n| ());
18+
LL + with_positive(|n| ());
19+
|
20+
21+
error: aborting due to 1 previous error
22+
23+
For more information about this error, try `rustc --explain E0308`.

0 commit comments

Comments
 (0)