mirror of
				https://github.com/rust-lang/rust.git
				synced 2025-10-30 20:44:34 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			19 lines
		
	
	
		
			313 B
		
	
	
	
		
			Rust
		
	
	
	
	
	
			
		
		
	
	
			19 lines
		
	
	
		
			313 B
		
	
	
	
		
			Rust
		
	
	
	
	
	
| // check-pass
 | |
| pub struct S<T, F: FnOnce() -> T = fn() -> T> {
 | |
|     f: F,
 | |
|     x: Option<T>,
 | |
| }
 | |
| 
 | |
| impl<T, F: FnOnce() -> T> S<T, F> {
 | |
|     pub const fn new(f: F) -> Self {
 | |
|         Self { f, x: None }
 | |
|     }
 | |
| }
 | |
| 
 | |
| #[derive(Default)]
 | |
| pub struct Foo;
 | |
| 
 | |
| static LOCKED_CALLSITES: S<Foo> = S::new(Default::default);
 | |
| 
 | |
| fn main() {}
 | 
