//revisions: old next //[next] compile-flags: -Znext-solver // A regression test for #105787 //[old] known-bug: #105787 //[old] check-pass #![feature(type_alias_impl_trait)] mod defining_scope { use super::*; pub type Alias = impl Sized; pub fn cast(x: Container, T>) -> Container { x } } struct Container, U> { x: >::Assoc, } trait Trait { type Assoc; } impl Trait for T { type Assoc = Box; } impl Trait for defining_scope::Alias { //[next]~^ ERROR conflicting implementations of trait type Assoc = usize; } fn main() { let x: Box = defining_scope::cast::<()>(Container { x: 0 }).x; println!("{}", *x); }