-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
2 changed files
with
39 additions
and
0 deletions.
There are no files selected for viewing
16 changes: 16 additions & 0 deletions
16
tests/ui/type-alias-impl-trait/underef-index-out-of-bounds-121472.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
} |
23 changes: 23 additions & 0 deletions
23
tests/ui/type-alias-impl-trait/underef-index-out-of-bounds-121472.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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`. |