-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a657e17
commit 9b430df
Showing
2 changed files
with
29 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#![allow(incomplete_features)] | ||
#![feature(const_generics)] | ||
#![feature(const_evaluatable_checked)] | ||
#![feature(specialization)] | ||
|
||
pub trait Trait { | ||
type Type; | ||
} | ||
|
||
impl<T: ?Sized> Trait for T { | ||
default type Type = [u8; 1]; | ||
} | ||
|
||
impl<T: Trait> Trait for *const T { | ||
type Type = [u8; std::mem::size_of::<<T as Trait>::Type>()]; | ||
//~^ ERROR: unconstrained generic constant | ||
} | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
error: unconstrained generic constant | ||
--> $DIR/issue-51892.rs:15:5 | ||
| | ||
LL | type Type = [u8; std::mem::size_of::<<T as Trait>::Type>()]; | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= help: try adding a `where` bound using this expression: `where [(); std::mem::size_of::<<T as Trait>::Type>()]:` | ||
|
||
error: aborting due to previous error | ||
|