]> git.lizzy.rs Git - rust.git/blob - src/test/ui/traits/object/vs-lifetime.rs
Merge commit '4c41a222ca5d1325fb4b6709395bd06e766cc042' into clippyup
[rust.git] / src / test / ui / traits / object / vs-lifetime.rs
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
4 struct S<'a, T>(&'a u8, T);
5
6 fn main() {
7     // `'static` is a lifetime argument, `'static +` is a type argument
8     let _: S<'static, u8>;
9     let _: S<'static, dyn 'static +>;
10     //~^ at least one trait is required for an object type
11     let _: S<'static, 'static>;
12     //~^ ERROR this struct takes 1 lifetime argument but 2 lifetime arguments were supplied
13     //~| ERROR this struct takes 1 generic argument but 0 generic arguments were supplied
14     let _: S<dyn 'static +, 'static>;
15     //~^ ERROR type provided when a lifetime was expected
16     //~| ERROR at least one trait is required for an object type
17 }