]> git.lizzy.rs Git - rust.git/blob - src/test/ui/hrtb/issue-57639.rs
Auto merge of #98120 - TaKO8Ki:box-diagnostic-metadata-field, r=estebank
[rust.git] / src / test / ui / hrtb / issue-57639.rs
1 // Regression test for #57639:
2 //
3 // In the move to universes, this test stopped working. The problem
4 // was that when the trait solver was asked to prove `for<'a> T::Item:
5 // Foo<'a>` as part of WF checking, it wound up "eagerly committing"
6 // to the where clause, which says that `T::Item: Foo<'a>`, but it
7 // should instead have been using the bound found in the trait
8 // declaration. Pre-universe, this used to work out ok because we got
9 // "eager errors" due to the leak check.
10 //
11 // See [this comment on GitHub][c] for more details.
12 //
13 // check-pass
14 //
15 // [c]: https://github.com/rust-lang/rust/issues/57639#issuecomment-455685861
16
17 trait Foo<'a> {}
18
19 trait Bar {
20     type Item: for<'a> Foo<'a>;
21 }
22
23 fn foo<'a, T>(_: T)
24 where
25     T: Bar,
26     T::Item: Foo<'a>,
27 {}
28
29 fn main() { }