mirror of
				https://github.com/rust-lang/rust.git
				synced 2025-10-30 20:44:34 +00:00 
			
		
		
		
	 ddbf54b67d
			
		
	
	
		ddbf54b67d
		
	
	
	
	
		
			
			This has now been approved as a language feature and no longer needs a `rustc_` prefix. Also change the `contracts` feature to be marked as incomplete and `contracts_internals` as internal.
		
			
				
	
	
		
			16 lines
		
	
	
		
			368 B
		
	
	
	
		
			Rust
		
	
	
	
	
	
			
		
		
	
	
			16 lines
		
	
	
		
			368 B
		
	
	
	
		
			Rust
		
	
	
	
	
	
| //@ run-pass
 | |
| //@ compile-flags: -Zcontract-checks=yes
 | |
| #![feature(contracts)]
 | |
| //~^ WARN the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes [incomplete_features]
 | |
| 
 | |
| #[core::contracts::ensures(|ret| *ret > 0)]
 | |
| fn outer() -> i32 {
 | |
|     let inner_closure = || -> i32 { 0 };
 | |
|     inner_closure();
 | |
|     10
 | |
| }
 | |
| 
 | |
| fn main() {
 | |
|     outer();
 | |
| }
 |