//@ revisions: current next //@ ignore-compare-mode-next-solver (explicit revisions) //@[next] compile-flags: -Znext-solver #![feature(do_not_recommend)] pub trait Expression { type SqlType; } pub trait AsExpression { type Expression: Expression; } pub struct Text; pub struct Integer; pub struct Bound(T); pub struct SelectInt; impl Expression for SelectInt { type SqlType = Integer; } impl Expression for Bound { type SqlType = T; } #[diagnostic::do_not_recommend] impl AsExpression for T where T: Expression, { type Expression = T; } impl AsExpression for i32 { type Expression = Bound; } impl AsExpression for &'_ str { type Expression = Bound; } trait Foo: Expression + Sized { fn check(&self, _: T) -> ::SqlType>>::Expression where T: AsExpression, { todo!() } } impl Foo for T where T: Expression {} fn main() { SelectInt.check("bar"); //~^ ERROR the trait bound `&str: AsExpression` is not satisfied //[next]~| the trait bound `&str: AsExpression<::SqlType>` is not satisfied //[next]~| type mismatch }