]> git.proxmox.com Git - rustc.git/blame - src/test/ui/traits/object/vs-lifetime.rs
New upstream version 1.54.0+dfsg1
[rustc.git] / src / test / ui / traits / object / vs-lifetime.rs
CommitLineData
7cac9316
XL
1// A few contrived examples where lifetime should (or should not) be parsed as an object type.
2// Lifetimes parsed as types are still rejected later by semantic checks.
3
7cac9316
XL
4struct S<'a, T>(&'a u8, T);
5
6fn main() {
7 // `'static` is a lifetime argument, `'static +` is a type argument
8 let _: S<'static, u8>;
dc9dc135
XL
9 let _: S<'static, dyn 'static +>;
10 //~^ at least one trait is required for an object type
7cac9316 11 let _: S<'static, 'static>;
5869c6ff 12 //~^ ERROR this struct takes 1 lifetime argument but 2 lifetime arguments were supplied
17df50a5 13 //~| ERROR this struct takes 1 generic argument but 0 generic arguments were supplied
dc9dc135 14 let _: S<dyn 'static +, 'static>;
74b04a01 15 //~^ ERROR type provided when a lifetime was expected
dc9dc135 16 //~| ERROR at least one trait is required for an object type
7cac9316 17}