File tree Expand file tree Collapse file tree 2 files changed +44
-0
lines changed
src/test/ui/const-generics/generic_const_exprs Expand file tree Collapse file tree 2 files changed +44
-0
lines changed Original file line number Diff line number Diff line change 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 number Diff line number Diff line change 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`.
You can’t perform that action at this time.
0 commit comments