]>
Commit | Line | Data |
---|---|---|
94b46f34 XL |
1 | // Test that we do not warn for named lifetimes in structs, |
2 | // even when they are only used once (since to not use a named | |
3 | // lifetime is illegal!) | |
4 | // | |
29967ef6 | 5 | // check-pass |
94b46f34 | 6 | |
923072b8 FG |
7 | // Use forbid to verify that `automatically_derived` is handled correctly. |
8 | #![forbid(single_use_lifetimes)] | |
94b46f34 XL |
9 | #![allow(dead_code)] |
10 | #![allow(unused_variables)] | |
223e47cc | 11 | |
94b46f34 | 12 | struct Foo<'f> { |
29967ef6 | 13 | data: &'f u32, |
94b46f34 | 14 | } |
9e0c209e | 15 | |
94b46f34 | 16 | enum Bar<'f> { |
29967ef6 | 17 | Data(&'f u32), |
223e47cc | 18 | } |
94b46f34 | 19 | |
29967ef6 | 20 | trait Baz<'f> {} |
94b46f34 | 21 | |
dc9dc135 | 22 | // `Derive`d impls shouldn't trigger a warning, either (Issue #53738). |
dc9dc135 XL |
23 | #[derive(Debug)] |
24 | struct Quux<'a> { | |
25 | priors: &'a u32, | |
26 | } | |
27 | ||
29967ef6 | 28 | fn main() {} |