diff options
| author | Dylan DPC <99973273+Dylan-DPC@users.noreply.github.com> | 2022-10-07 22:05:32 +0530 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-10-07 22:05:32 +0530 |
| commit | d70e56aef8aa63e823009ed81b4acaf21e628b0f (patch) | |
| tree | 271bfad948c5a758966b1396b2faf5487de7afce /src/test | |
| parent | 34dfd82de014ebc3ff6cd613ea9e3d4767f0d171 (diff) | |
| parent | fa767868dfba9eb1f2161cea789bc4d9828d53e2 (diff) | |
| download | rust-d70e56aef8aa63e823009ed81b4acaf21e628b0f.tar.gz rust-d70e56aef8aa63e823009ed81b4acaf21e628b0f.zip | |
Rollup merge of #102779 - TaKO8Ki:fix-type-of-ice-102768, r=fee1-dead
Fix `type_of` ICE Fixes #102768
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/ui/const-generics/generic_const_exprs/issue-102768.rs | 14 | ||||
| -rw-r--r-- | src/test/ui/const-generics/generic_const_exprs/issue-102768.stderr | 33 |
2 files changed, 47 insertions, 0 deletions
diff --git a/src/test/ui/const-generics/generic_const_exprs/issue-102768.rs b/src/test/ui/const-generics/generic_const_exprs/issue-102768.rs new file mode 100644 index 00000000000..7aea0d30d1a --- /dev/null +++ b/src/test/ui/const-generics/generic_const_exprs/issue-102768.rs @@ -0,0 +1,14 @@ +#![feature(generic_const_exprs)] +#![allow(incomplete_features)] + +trait X { + type Y<'a>; +} + +const _: () = { + fn f2<'a>(arg: Box<dyn X<Y<1> = &'a ()>>) {} + //~^ ERROR this associated type takes 1 lifetime argument but 0 lifetime arguments + //~| ERROR this associated type takes 0 generic arguments but 1 generic argument +}; + +fn main() {} diff --git a/src/test/ui/const-generics/generic_const_exprs/issue-102768.stderr b/src/test/ui/const-generics/generic_const_exprs/issue-102768.stderr new file mode 100644 index 00000000000..9deb9b26588 --- /dev/null +++ b/src/test/ui/const-generics/generic_const_exprs/issue-102768.stderr @@ -0,0 +1,33 @@ +error[E0107]: this associated type takes 1 lifetime argument but 0 lifetime arguments were supplied + --> $DIR/issue-102768.rs:9:30 + | +LL | fn f2<'a>(arg: Box<dyn X<Y<1> = &'a ()>>) {} + | ^ expected 1 lifetime argument + | +note: associated type defined here, with 1 lifetime parameter: `'a` + --> $DIR/issue-102768.rs:5:10 + | +LL | type Y<'a>; + | ^ -- +help: add missing lifetime argument + | +LL | fn f2<'a>(arg: Box<dyn X<Y<'a, 1> = &'a ()>>) {} + | +++ + +error[E0107]: this associated type takes 0 generic arguments but 1 generic argument was supplied + --> $DIR/issue-102768.rs:9:30 + | +LL | fn f2<'a>(arg: Box<dyn X<Y<1> = &'a ()>>) {} + | ^--- help: remove these generics + | | + | expected 0 generic arguments + | +note: associated type defined here, with 0 generic parameters + --> $DIR/issue-102768.rs:5:10 + | +LL | type Y<'a>; + | ^ + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0107`. |
