mirror of
				https://github.com/rust-lang/rust.git
				synced 2025-10-30 20:44:34 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			17 lines
		
	
	
		
			322 B
		
	
	
	
		
			Rust
		
	
	
	
	
	
			
		
		
	
	
			17 lines
		
	
	
		
			322 B
		
	
	
	
		
			Rust
		
	
	
	
	
	
| //@ check-pass
 | |
| 
 | |
| #[derive(Clone, Default)]
 | |
| struct MaybeCopy<T>(T);
 | |
| 
 | |
| impl Copy for MaybeCopy<u8> {}
 | |
| 
 | |
| fn is_copy<T: Copy>(x: T) {
 | |
|     println!("{}", std::any::type_name::<T>());
 | |
| }
 | |
| 
 | |
| fn main() {
 | |
|     is_copy(MaybeCopy::default());
 | |
|     [MaybeCopy::default(); 13];
 | |
|     // didn't work, because `Copy` was only checked in the mir
 | |
| }
 | 
