mirror of
				https://github.com/rust-lang/rust.git
				synced 2025-10-31 04:57:19 +00:00 
			
		
		
		
	 2098fec080
			
		
	
	
		2098fec080
		
	
	
	
	
		
			
			Add a test that `f16` and `f128` are usable with the feature gate enabled, as well as a test that user types with the same name as primitives are not improperly gated.
		
			
				
	
	
		
			43 lines
		
	
	
		
			606 B
		
	
	
	
		
			Rust
		
	
	
	
	
	
			
		
		
	
	
			43 lines
		
	
	
		
			606 B
		
	
	
	
		
			Rust
		
	
	
	
	
	
| //@ run-pass
 | |
| #![allow(unused)]
 | |
| #![feature(f128)]
 | |
| #![feature(f16)]
 | |
| 
 | |
| // Same as the feature gate tests but ensure we can use the types
 | |
| mod check_f128 {
 | |
|     const A: f128 = 10.0;
 | |
| 
 | |
|     pub fn foo() {
 | |
|         let a: f128 = 100.0;
 | |
|         let b = 0.0f128;
 | |
|         bar(1.23);
 | |
|     }
 | |
| 
 | |
|     fn bar(a: f128) {}
 | |
| 
 | |
|     struct Bar {
 | |
|         a: f128,
 | |
|     }
 | |
| }
 | |
| 
 | |
| mod check_f16 {
 | |
|     const A: f16 = 10.0;
 | |
| 
 | |
|     pub fn foo() {
 | |
|         let a: f16 = 100.0;
 | |
|         let b = 0.0f16;
 | |
|         bar(1.23);
 | |
|     }
 | |
| 
 | |
|     fn bar(a: f16) {}
 | |
| 
 | |
|     struct Bar {
 | |
|         a: f16,
 | |
|     }
 | |
| }
 | |
| 
 | |
| fn main() {
 | |
|     check_f128::foo();
 | |
|     check_f16::foo();
 | |
| }
 |