]> git.lizzy.rs Git - rust.git/blob - src/test/ui/suggestions/missing-lifetime-specifier.rs
pin docs: add some forward references
[rust.git] / src / test / ui / suggestions / missing-lifetime-specifier.rs
1 #![allow(bare_trait_objects)]
2 use std::collections::HashMap;
3 use std::cell::RefCell;
4
5 pub union Foo<'t, 'k> {
6     i: &'t i64,
7     f: &'k f64,
8 }
9 trait Bar<'t, 'k> {}
10
11 pub union Qux<'t, 'k, I> {
12     i: &'t I,
13     f: &'k I,
14 }
15 trait Tar<'t, 'k, I> {}
16
17 thread_local! {
18     static a: RefCell<HashMap<i32, Vec<Vec<Foo>>>> = RefCell::new(HashMap::new());
19     //~^ ERROR missing lifetime specifier
20     //~| ERROR missing lifetime specifier
21 }
22 thread_local! {
23     static b: RefCell<HashMap<i32, Vec<Vec<&Bar>>>> = RefCell::new(HashMap::new());
24     //~^ ERROR missing lifetime specifier
25     //~| ERROR missing lifetime specifier
26     //~| ERROR missing lifetime specifier
27     //~| ERROR missing lifetime specifier
28     //~| ERROR the lifetime bound for this object type cannot be deduced from context
29     //~| ERROR the lifetime bound for this object type cannot be deduced from context
30 }
31 thread_local! {
32     static c: RefCell<HashMap<i32, Vec<Vec<Qux<i32>>>>> = RefCell::new(HashMap::new());
33     //~^ ERROR missing lifetime specifier
34     //~| ERROR missing lifetime specifier
35 }
36 thread_local! {
37     static d: RefCell<HashMap<i32, Vec<Vec<&Tar<i32>>>>> = RefCell::new(HashMap::new());
38     //~^ ERROR missing lifetime specifier
39     //~| ERROR missing lifetime specifier
40     //~| ERROR missing lifetime specifier
41     //~| ERROR missing lifetime specifier
42     //~| ERROR the lifetime bound for this object type cannot be deduced from context
43     //~| ERROR the lifetime bound for this object type cannot be deduced from context
44 }
45
46 thread_local! {
47     static e: RefCell<HashMap<i32, Vec<Vec<Qux<'static, i32>>>>> = RefCell::new(HashMap::new());
48     //~^ ERROR wrong number of lifetime arguments: expected 2, found 1
49     //~| ERROR wrong number of lifetime arguments: expected 2, found 1
50     //~| ERROR wrong number of lifetime arguments: expected 2, found 1
51     //~| ERROR wrong number of lifetime arguments: expected 2, found 1
52 }
53 thread_local! {
54     static f: RefCell<HashMap<i32, Vec<Vec<&Tar<'static, i32>>>>> = RefCell::new(HashMap::new());
55     //~^ ERROR the lifetime bound for this object type cannot be deduced from context
56     //~| ERROR the lifetime bound for this object type cannot be deduced from context
57     //~| ERROR wrong number of lifetime arguments: expected 2, found 1
58     //~| ERROR wrong number of lifetime arguments: expected 2, found 1
59     //~| ERROR wrong number of lifetime arguments: expected 2, found 1
60     //~| ERROR wrong number of lifetime arguments: expected 2, found 1
61     //~| ERROR missing lifetime specifier
62     //~| ERROR missing lifetime specifier
63 }
64
65 fn main() {}