File tree Expand file tree Collapse file tree 2 files changed +29
-0
lines changed
src/test/ui/specialization Expand file tree Collapse file tree 2 files changed +29
-0
lines changed Original file line number Diff line number Diff line change 1+ #![ allow( incomplete_features) ]
2+ #![ feature( const_generics) ]
3+ #![ feature( const_evaluatable_checked) ]
4+ #![ feature( specialization) ]
5+
6+ pub trait Trait {
7+ type Type ;
8+ }
9+
10+ impl < T : ?Sized > Trait for T {
11+ default type Type = [ u8 ; 1 ] ;
12+ }
13+
14+ impl < T : Trait > Trait for * const T {
15+ type Type = [ u8 ; std:: mem:: size_of :: < <T as Trait >:: Type > ( ) ] ;
16+ //~^ ERROR: unconstrained generic constant
17+ }
18+
19+ fn main ( ) { }
Original file line number Diff line number Diff line change 1+ error: unconstrained generic constant
2+ --> $DIR/issue-51892.rs:15:5
3+ |
4+ LL | type Type = [u8; std::mem::size_of::<<T as Trait>::Type>()];
5+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6+ |
7+ = help: try adding a `where` bound using this expression: `where [(); std::mem::size_of::<<T as Trait>::Type>()]:`
8+
9+ error: aborting due to previous error
10+
You can’t perform that action at this time.
0 commit comments