mirror of
				https://github.com/rust-lang/rust.git
				synced 2025-10-25 14:41:47 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			28 lines
		
	
	
		
			506 B
		
	
	
	
		
			Rust
		
	
	
	
	
	
			
		
		
	
	
			28 lines
		
	
	
		
			506 B
		
	
	
	
		
			Rust
		
	
	
	
	
	
| //! Check that we consider `Bar<impl Sized>` to successfully unify
 | |
| //! with both `Bar<u32>` and `Bar<i32>` (in isolation), so we bail
 | |
| //! out with ambiguity.
 | |
| 
 | |
| //@ revisions: current next
 | |
| //@[next] compile-flags: -Znext-solver
 | |
| 
 | |
| struct Bar<T>(T);
 | |
| 
 | |
| impl Bar<u32> {
 | |
|     fn bar(self) {}
 | |
| }
 | |
| 
 | |
| impl Bar<i32> {
 | |
|     fn bar(self) {}
 | |
| }
 | |
| 
 | |
| fn foo(x: bool) -> Bar<impl Sized> {
 | |
|     if x {
 | |
|         let x = foo(false);
 | |
|         x.bar();
 | |
|         //~^ ERROR: multiple applicable items in scope
 | |
|     }
 | |
|     todo!()
 | |
| }
 | |
| 
 | |
| fn main() {}
 | 
