1 #![deny(late_bound_lifetime_arguments)]
7 fn late<'a, 'b>(self, _: &'a u8, _: &'b u8) {}
8 fn late_implicit(self, _: &u8, _: &u8) {}
9 fn late_early<'a, 'b>(self, _: &'a u8) -> &'b u8 { loop {} }
10 fn late_implicit_early<'b>(self, _: &u8) -> &'b u8 { loop {} }
12 // 'late lifetimes here belong to nested types not to the tested functions.
13 fn early_tricky_explicit<'a>(_: for<'late> fn(&'late u8),
14 _: Box<dyn for<'late> Fn(&'late u8)>)
16 fn early_tricky_implicit<'a>(_: fn(&u8),
23 S.late::<'static>(&0, &0);
24 //~^ ERROR cannot specify lifetime arguments explicitly
25 //~| WARN this was previously accepted
26 S.late::<'static, 'static>(&0, &0);
27 //~^ ERROR cannot specify lifetime arguments explicitly
28 //~| WARN this was previously accepted
29 S.late::<'static, 'static, 'static>(&0, &0);
30 //~^ ERROR cannot specify lifetime arguments explicitly
31 //~| WARN this was previously accepted
32 S.late_early(&0); // OK
33 S.late_early::<'static>(&0);
34 //~^ ERROR cannot specify lifetime arguments explicitly
35 //~| WARN this was previously accepted
36 S.late_early::<'static, 'static>(&0);
37 //~^ ERROR cannot specify lifetime arguments explicitly
38 //~| WARN this was previously accepted
39 S.late_early::<'static, 'static, 'static>(&0);
40 //~^ ERROR cannot specify lifetime arguments explicitly
41 //~| WARN this was previously accepted
43 S.late_implicit(&0, &0); // OK
44 S.late_implicit::<'static>(&0, &0);
45 //~^ ERROR cannot specify lifetime arguments explicitly
46 //~| WARN this was previously accepted
47 S.late_implicit::<'static, 'static>(&0, &0);
48 //~^ ERROR cannot specify lifetime arguments explicitly
49 //~| WARN this was previously accepted
50 S.late_implicit::<'static, 'static, 'static>(&0, &0);
51 //~^ ERROR cannot specify lifetime arguments explicitly
52 //~| WARN this was previously accepted
53 S.late_implicit_early(&0); // OK
54 S.late_implicit_early::<'static>(&0);
55 //~^ ERROR cannot specify lifetime arguments explicitly
56 //~| WARN this was previously accepted
57 S.late_implicit_early::<'static, 'static>(&0);
58 //~^ ERROR cannot specify lifetime arguments explicitly
59 //~| WARN this was previously accepted
60 S.late_implicit_early::<'static, 'static, 'static>(&0);
61 //~^ ERROR cannot specify lifetime arguments explicitly
62 //~| WARN this was previously accepted
64 S::early_tricky_explicit::<'static>(loop {}, loop {}); // OK
65 S::early_tricky_implicit::<'static>(loop {}, loop {}); // OK
69 S::late_early::<'static>(S, &0);
70 //~^ ERROR cannot specify lifetime arguments explicitly
71 //~| WARN this was previously accepted
73 S::late_implicit_early::<'static>(S, &0);
74 //~^ ERROR cannot specify lifetime arguments explicitly
75 //~| WARN this was previously accepted
78 fn lint_not_inference_error() {
79 fn f<'early, 'late, T: 'early>() {}
81 // Make sure `u8` is substituted and not replaced with an inference variable
83 //~^ ERROR cannot specify lifetime arguments explicitly
84 //~| WARN this was previously accepted