]> git.lizzy.rs Git - rust.git/blob - tests/ui/traits/inductive-overflow/lifetime.rs
Rollup merge of #105795 - nicholasbishop:bishop-stabilize-efiapi, r=joshtriplett
[rust.git] / tests / ui / traits / inductive-overflow / lifetime.rs
1 // Test that we don't hit the recursion limit for short cycles involving lifetimes.
2
3 // Shouldn't hit this, we should realize that we're in a cycle sooner.
4 #![recursion_limit="20"]
5
6 trait NotAuto {}
7 trait Y {
8     type P;
9 }
10
11 impl<'a> Y for C<'a> {
12     type P = Box<X<C<'a>>>;
13 }
14
15 struct C<'a>(&'a ());
16 struct X<T: Y>(T::P);
17
18 impl<T: NotAuto> NotAuto for Box<T> {} //~ NOTE: required
19 //~^ NOTE unsatisfied trait bound introduced here
20 impl<T: Y> NotAuto for X<T> where T::P: NotAuto {}
21 impl<'a> NotAuto for C<'a> {}
22
23 fn is_send<S: NotAuto>() {}
24 //~^ NOTE: required
25 //~| NOTE: required
26
27 fn main() {
28     // Should only be a few notes.
29     is_send::<X<C<'static>>>();
30     //~^ ERROR overflow evaluating
31     //~| 3 redundant requirements hidden
32     //~| required for
33 }