]> git.proxmox.com Git - rustc.git/blob - src/test/ui/single-use-lifetime/one-use-in-struct.rs
Update upstream source from tag 'upstream/1.63.0+dfsg1'
[rustc.git] / src / test / ui / single-use-lifetime / one-use-in-struct.rs
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 //
5 // check-pass
6
7 // Use forbid to verify that `automatically_derived` is handled correctly.
8 #![forbid(single_use_lifetimes)]
9 #![allow(dead_code)]
10 #![allow(unused_variables)]
11
12 struct Foo<'f> {
13 data: &'f u32,
14 }
15
16 enum Bar<'f> {
17 Data(&'f u32),
18 }
19
20 trait Baz<'f> {}
21
22 // `Derive`d impls shouldn't trigger a warning, either (Issue #53738).
23 #[derive(Debug)]
24 struct Quux<'a> {
25 priors: &'a u32,
26 }
27
28 fn main() {}