This commit is contained in:
Michael Goulet 2022-08-12 03:41:57 +00:00
parent 4ff587263e
commit d464d3a700
2 changed files with 44 additions and 0 deletions

View File

@ -0,0 +1,24 @@
#![allow(incomplete_features)]
#![feature(generic_const_exprs)]
trait True {}
struct Is<const V: bool>;
impl True for Is<true> {}
fn g<T>()
//~^ NOTE required by a bound in this
where
Is<{ std::mem::size_of::<T>() == 0 }>: True,
//~^ NOTE required by a bound in `g`
//~| NOTE required by this bound in `g`
{
}
fn main() {
g::<usize>();
//~^ ERROR mismatched types
//~| NOTE expected `false`, found `true`
//~| NOTE expected constant `false`
}

View File

@ -0,0 +1,20 @@
error[E0308]: mismatched types
--> $DIR/obligation-cause.rs:20:5
|
LL | g::<usize>();
| ^^^^^^^^^^ expected `false`, found `true`
|
= note: expected constant `false`
found constant `true`
note: required by a bound in `g`
--> $DIR/obligation-cause.rs:13:44
|
LL | fn g<T>()
| - required by a bound in this
...
LL | Is<{ std::mem::size_of::<T>() == 0 }>: True,
| ^^^^ required by this bound in `g`
error: aborting due to previous error
For more information about this error, try `rustc --explain E0308`.