2023-10-23 09:49:44 -05:00
|
|
|
// check-pass
|
2023-12-14 06:11:28 -06:00
|
|
|
// compile-flags: -Znext-solver
|
2023-02-26 23:23:26 -06:00
|
|
|
|
|
|
|
trait Test {
|
|
|
|
type Assoc;
|
|
|
|
}
|
|
|
|
|
2023-06-27 16:13:50 -05:00
|
|
|
fn transform<T: Test>(x: Inv<T>) -> Inv<T::Assoc> {
|
2023-02-26 23:23:26 -06:00
|
|
|
todo!()
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Test for i32 {
|
|
|
|
type Assoc = i32;
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Test for String {
|
|
|
|
type Assoc = String;
|
|
|
|
}
|
|
|
|
|
2023-06-27 16:13:50 -05:00
|
|
|
struct Inv<T>(Option<*mut T>);
|
|
|
|
|
2023-02-26 23:23:26 -06:00
|
|
|
fn main() {
|
2023-06-27 16:13:50 -05:00
|
|
|
let mut x: Inv<_> = Inv(None);
|
|
|
|
// This ends up equating `Inv<?x>` with `Inv<<?x as Test>::Assoc>`
|
|
|
|
// which fails the occurs check when generalizing `?x`.
|
2023-10-23 09:49:44 -05:00
|
|
|
//
|
|
|
|
// We end up emitting a delayed obligation, causing this to still
|
|
|
|
// succeed.
|
2023-02-26 23:23:26 -06:00
|
|
|
x = transform(x);
|
2023-06-27 16:13:50 -05:00
|
|
|
x = Inv::<i32>(None);
|
2023-02-26 23:23:26 -06:00
|
|
|
}
|