mirror of
				https://github.com/rust-lang/rust.git
				synced 2025-11-04 06:56:14 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			30 lines
		
	
	
		
			415 B
		
	
	
	
		
			Rust
		
	
	
	
	
	
			
		
		
	
	
			30 lines
		
	
	
		
			415 B
		
	
	
	
		
			Rust
		
	
	
	
	
	
#![feature(const_trait_impl, effects)]
 | 
						|
 | 
						|
#[const_trait]
 | 
						|
trait ConstDefaultFn: Sized {
 | 
						|
    fn b(self);
 | 
						|
 | 
						|
    fn a(self) {
 | 
						|
        self.b();
 | 
						|
    }
 | 
						|
}
 | 
						|
 | 
						|
struct NonConstImpl;
 | 
						|
struct ConstImpl;
 | 
						|
 | 
						|
impl ConstDefaultFn for NonConstImpl {
 | 
						|
    fn b(self) {}
 | 
						|
}
 | 
						|
 | 
						|
impl const ConstDefaultFn for ConstImpl {
 | 
						|
    fn b(self) {}
 | 
						|
}
 | 
						|
 | 
						|
const fn test() {
 | 
						|
    NonConstImpl.a();
 | 
						|
    //~^ ERROR the trait bound
 | 
						|
    ConstImpl.a();
 | 
						|
}
 | 
						|
 | 
						|
fn main() {}
 |