]> git.proxmox.com Git - rustc.git/blame - src/test/ui/single-use-lifetime/one-use-in-struct.rs
New upstream version 1.67.1+dfsg1
[rustc.git] / src / test / ui / single-use-lifetime / one-use-in-struct.rs
CommitLineData
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 12struct Foo<'f> {
29967ef6 13 data: &'f u32,
94b46f34 14}
9e0c209e 15
94b46f34 16enum Bar<'f> {
29967ef6 17 Data(&'f u32),
223e47cc 18}
94b46f34 19
29967ef6 20trait Baz<'f> {}
94b46f34 21
dc9dc135 22// `Derive`d impls shouldn't trigger a warning, either (Issue #53738).
dc9dc135
XL
23#[derive(Debug)]
24struct Quux<'a> {
25 priors: &'a u32,
26}
27
29967ef6 28fn main() {}