// Regression test for #137287 mod defining_scope { use super::*; pub type Alias = impl Sized; //~^ ERROR unconstrained opaque type //~| ERROR `impl Trait` in type aliases is unstable pub fn cast(x: Container, T>) -> Container { x //~^ ERROR mismatched types } } struct Container, U> { x: >::Assoc, } trait Trait { type Assoc; } impl Trait for T { type Assoc = Box; } impl Trait for defining_scope::Alias { //~^ ERROR conflicting implementations of trait `Trait<_>` type Assoc = usize; } fn main() { let x: Box = defining_scope::cast::<()>(Container { x: 0 }).x; }