Skip to content

Commit 9b430df

Browse files
committed
Add test for issue rust-lang#51892
1 parent a657e17 commit 9b430df

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed
+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
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 numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
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+

0 commit comments

Comments
 (0)