mirror of
				https://github.com/rust-lang/rust.git
				synced 2025-10-31 13:04:42 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			18 lines
		
	
	
		
			333 B
		
	
	
	
		
			Rust
		
	
	
	
	
	
			
		
		
	
	
			18 lines
		
	
	
		
			333 B
		
	
	
	
		
			Rust
		
	
	
	
	
	
| #![feature(generic_const_exprs)]
 | |
| #![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
 | |
|     //~| ERROR mismatched types
 | |
| }
 | |
| 
 | |
| fn main() {
 | |
|     test::<u32>();
 | |
| }
 | 
