mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-01 12:37:37 +00:00
17 lines
323 B
Rust
17 lines
323 B
Rust
![]() |
#![feature(const_generics, const_evaluatable_checked)]
|
||
|
#![allow(incomplete_features)]
|
||
|
|
||
|
use std::mem::size_of;
|
||
|
use std::marker::PhantomData;
|
||
|
|
||
|
struct Foo<T>(PhantomData<T>);
|
||
|
|
||
|
fn test<T>() -> [u8; size_of::<T>()] {
|
||
|
[0; size_of::<Foo<T>>()]
|
||
|
//~^ ERROR unconstrained generic constant
|
||
|
}
|
||
|
|
||
|
fn main() {
|
||
|
test::<u32>();
|
||
|
}
|