Skip to content

Commit a5725a9

Browse files
committedAug 12, 2022
Add test for #100414
1 parent 792a845 commit a5725a9

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed
 
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#![allow(incomplete_features)]
2+
#![feature(generic_const_exprs)]
3+
4+
trait True {}
5+
6+
struct Is<const V: bool>;
7+
8+
impl True for Is<true> {}
9+
10+
fn g<T>()
11+
//~^ NOTE required by a bound in this
12+
where
13+
Is<{ std::mem::size_of::<T>() == 0 }>: True,
14+
//~^ NOTE required by a bound in `g`
15+
//~| NOTE required by this bound in `g`
16+
{
17+
}
18+
19+
fn main() {
20+
g::<usize>();
21+
//~^ ERROR mismatched types
22+
//~| NOTE expected `false`, found `true`
23+
//~| NOTE expected constant `false`
24+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
error[E0308]: mismatched types
2+
--> $DIR/obligation-cause.rs:20:5
3+
|
4+
LL | g::<usize>();
5+
| ^^^^^^^^^^ expected `false`, found `true`
6+
|
7+
= note: expected constant `false`
8+
found constant `true`
9+
note: required by a bound in `g`
10+
--> $DIR/obligation-cause.rs:13:44
11+
|
12+
LL | fn g<T>()
13+
| - required by a bound in this
14+
...
15+
LL | Is<{ std::mem::size_of::<T>() == 0 }>: True,
16+
| ^^^^ required by this bound in `g`
17+
18+
error: aborting due to previous error
19+
20+
For more information about this error, try `rustc --explain E0308`.

0 commit comments

Comments
 (0)