about summary refs log tree commit diff
path: root/src/test/ui/suggestions/missing-lifetime-specifier.rs
blob: b09c1879d701599092a3fa1e5e1d96817a317f85 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#![allow(bare_trait_objects)]
use std::collections::HashMap;
use std::cell::RefCell;

pub union Foo<'t, 'k> {
    i: &'t i64,
    f: &'k f64,
}
trait Bar<'t, 'k> {}

pub union Qux<'t, 'k, I> {
    i: &'t I,
    f: &'k I,
}
trait Tar<'t, 'k, I> {}

thread_local! {
    static a: RefCell<HashMap<i32, Vec<Vec<Foo>>>> = RefCell::new(HashMap::new());
    //~^ ERROR missing lifetime specifier
    //~| ERROR missing lifetime specifier
}
thread_local! {
    static b: RefCell<HashMap<i32, Vec<Vec<&Bar>>>> = RefCell::new(HashMap::new());
    //~^ ERROR missing lifetime specifier
    //~| ERROR missing lifetime specifier
    //~| ERROR missing lifetime specifier
    //~| ERROR missing lifetime specifier
    //~| ERROR the lifetime bound for this object type cannot be deduced from context
    //~| ERROR the lifetime bound for this object type cannot be deduced from context
}
thread_local! {
    static c: RefCell<HashMap<i32, Vec<Vec<Qux<i32>>>>> = RefCell::new(HashMap::new());
    //~^ ERROR missing lifetime specifier
    //~| ERROR missing lifetime specifier
}
thread_local! {
    static d: RefCell<HashMap<i32, Vec<Vec<&Tar<i32>>>>> = RefCell::new(HashMap::new());
    //~^ ERROR missing lifetime specifier
    //~| ERROR missing lifetime specifier
    //~| ERROR missing lifetime specifier
    //~| ERROR missing lifetime specifier
    //~| ERROR the lifetime bound for this object type cannot be deduced from context
    //~| ERROR the lifetime bound for this object type cannot be deduced from context
}

thread_local! {
    static e: RefCell<HashMap<i32, Vec<Vec<Qux<'static, i32>>>>> = RefCell::new(HashMap::new());
    //~^ ERROR wrong number of lifetime arguments: expected 2, found 1
    //~| ERROR wrong number of lifetime arguments: expected 2, found 1
    //~| ERROR wrong number of lifetime arguments: expected 2, found 1
    //~| ERROR wrong number of lifetime arguments: expected 2, found 1
}
thread_local! {
    static f: RefCell<HashMap<i32, Vec<Vec<&Tar<'static, i32>>>>> = RefCell::new(HashMap::new());
    //~^ ERROR the lifetime bound for this object type cannot be deduced from context
    //~| ERROR the lifetime bound for this object type cannot be deduced from context
    //~| ERROR wrong number of lifetime arguments: expected 2, found 1
    //~| ERROR wrong number of lifetime arguments: expected 2, found 1
    //~| ERROR wrong number of lifetime arguments: expected 2, found 1
    //~| ERROR wrong number of lifetime arguments: expected 2, found 1
    //~| ERROR missing lifetime specifier
    //~| ERROR missing lifetime specifier
}

fn main() {}