//@ revisions: current next //@ ignore-compare-mode-next-solver (explicit revisions) //@[next] compile-flags: -Znext-solver //@[next] check-pass // Regression test for trait-system-refactor-initiative#106. We previously // tried to define other opaques while checking that opaques are well-formed. // // This resulted in undesirable ambiguity #![feature(type_alias_impl_trait)] mod ex0 { fn foo() -> (impl Sized, impl Sized) { ((), ()) } } mod ex1 { type Tait1 = impl Sized; #[define_opaque(Tait1)] fn foo(x: Tait1) -> impl Sized { //[current]~^ ERROR item does not constrain `ex1::Tait1::{opaque#0}` let () = x; } } mod ex2 { type Tait1 = impl Sized; type Tait2 = impl Sized; #[define_opaque(Tait1, Tait2)] fn foo(x: Tait1) -> Tait2 { //[current]~^ ERROR item does not constrain `ex2::Tait1::{opaque#0}` let () = x; } } mod ex3 { type Tait1 = impl Sized; trait Something {} impl Something for T {} type Tait2 = impl Something; #[define_opaque(Tait1, Tait2)] fn foo(x: Tait1) -> Tait2 { //[current]~^ ERROR item does not constrain `ex3::Tait1::{opaque#0}` let () = x; } } mod ex4 { type Tait1 = impl Sized; trait Trait { type Assoc; } impl Trait for T { type Assoc = T; } // ambiguity when checking that `Tait2` is wf // // ambiguity proving `(): Trait`. type Tait2 = impl Trait<(), Assoc = impl Trait>; #[define_opaque(Tait1, Tait2)] fn foo(x: Tait1) -> Tait2 { //[current]~^ ERROR item does not constrain `ex4::Tait1::{opaque#0}` let () = x; } } fn main() {}