the environment round here is awfully empty
capitalism
This commit is contained in:
parent
b86674e7cc
commit
7e368e57f2
4 changed files with 49 additions and 23 deletions
|
|
@ -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() {}
|
||||
|
|
@ -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`.
|
||||
Loading…
Add table
Add a link
Reference in a new issue