diff options
| author | Ellen <supbscripter@gmail.com> | 2021-02-15 11:38:20 +0000 |
|---|---|---|
| committer | Ellen <supbscripter@gmail.com> | 2021-02-15 11:38:20 +0000 |
| commit | 7e368e57f278b8073193c73001f4efc4af08fdfd (patch) | |
| tree | f20b80eac204744610ecdd1fa7552ced8a5d4b06 /src | |
| parent | b86674e7cc8ac9c846ed5aca84aaefc2d0d12e4a (diff) | |
| download | rust-7e368e57f278b8073193c73001f4efc4af08fdfd.tar.gz rust-7e368e57f278b8073193c73001f4efc4af08fdfd.zip | |
the environment round here is awfully empty
capitalism
Diffstat (limited to 'src')
| -rw-r--r-- | src/test/ui/const-generics/dont-evaluate-array-len-on-err-1.rs | 22 | ||||
| -rw-r--r-- | src/test/ui/const-generics/dont-evaluate-array-len-on-err-1.stderr | 12 |
2 files changed, 34 insertions, 0 deletions
diff --git a/src/test/ui/const-generics/dont-evaluate-array-len-on-err-1.rs b/src/test/ui/const-generics/dont-evaluate-array-len-on-err-1.rs new file mode 100644 index 00000000000..afef748ff46 --- /dev/null +++ b/src/test/ui/const-generics/dont-evaluate-array-len-on-err-1.rs @@ -0,0 +1,22 @@ +#![feature(const_generics, const_evaluatable_checked)] +#![allow(incomplete_features)] + +// This tests that during error handling for the "trait not implemented" error +// we dont try to evaluate std::mem::size_of::<Self::Assoc> causing an ICE + +struct Adt; + +trait Foo { + type Assoc; + fn foo() + where + [Adt; std::mem::size_of::<Self::Assoc>()]: , + { + <[Adt; std::mem::size_of::<Self::Assoc>()] as Foo>::bar() + //~^ Error: the trait bound + } + + fn bar() {} +} + +fn main() {} diff --git a/src/test/ui/const-generics/dont-evaluate-array-len-on-err-1.stderr b/src/test/ui/const-generics/dont-evaluate-array-len-on-err-1.stderr new file mode 100644 index 00000000000..d894fa90ba9 --- /dev/null +++ b/src/test/ui/const-generics/dont-evaluate-array-len-on-err-1.stderr @@ -0,0 +1,12 @@ +error[E0277]: the trait bound `[Adt; _]: Foo` is not satisfied + --> $DIR/dont-evaluate-array-len-on-err-1.rs:15:9 + | +LL | <[Adt; std::mem::size_of::<Self::Assoc>()] as Foo>::bar() + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `[Adt; _]` +... +LL | fn bar() {} + | -------- required by `Foo::bar` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. |
