Skip to content

Commit

Permalink
fix UI test
Browse files Browse the repository at this point in the history
  • Loading branch information
joboet committed May 25, 2024
1 parent 1052d29 commit 6df8d0d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 91 deletions.
22 changes: 11 additions & 11 deletions tests/ui/suggestions/missing-lifetime-specifier.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
// different number of duplicated diagnostics on different targets
//@ only-x86_64
//@ only-linux
// The specific errors produced depend the thread-local implementation.
// Run only on platforms with "fast" TLS.
//@ ignore-windows FIXME(#84933)
//@ ignore-wasm globals are used instead of thread locals
//@ ignore-emscripten globals are used instead of thread locals
//@ ignore-android does not use #[thread_local]
//@ ignore-nto does not use #[thread_local]
// Different number of duplicated diagnostics on different targets
//@ compile-flags: -Zdeduplicate-diagnostics=yes

#![allow(bare_trait_objects)]
Expand All @@ -21,23 +26,19 @@ trait Tar<'t, 'k, I> {}

thread_local! {
static a: RefCell<HashMap<i32, Vec<Vec<Foo>>>> = RefCell::new(HashMap::new());
//~^ ERROR missing lifetime specifiers
//~| ERROR missing lifetime specifiers
//~^ ERROR missing lifetime specifiers
}
thread_local! {
static b: RefCell<HashMap<i32, Vec<Vec<&Bar>>>> = RefCell::new(HashMap::new());
//~^ ERROR missing lifetime specifiers
//~| ERROR missing lifetime specifiers
//~^ ERROR missing lifetime specifiers
}
thread_local! {
static c: RefCell<HashMap<i32, Vec<Vec<Qux<i32>>>>> = RefCell::new(HashMap::new());
//~^ ERROR missing lifetime specifiers
//~| ERROR missing lifetime specifiers
}
thread_local! {
static d: RefCell<HashMap<i32, Vec<Vec<&Tar<i32>>>>> = RefCell::new(HashMap::new());
//~^ ERROR missing lifetime specifiers
//~| ERROR missing lifetime specifiers
}

thread_local! {
Expand All @@ -47,8 +48,7 @@ thread_local! {
thread_local! {
static f: RefCell<HashMap<i32, Vec<Vec<&Tar<'static, i32>>>>> = RefCell::new(HashMap::new());
//~^ ERROR trait takes 2 lifetime arguments but 1 lifetime argument was supplied
//~| ERROR missing lifetime
//~| ERROR missing lifetime
//~| ERROR missing lifetime specifier
}

fn main() {}
90 changes: 10 additions & 80 deletions tests/ui/suggestions/missing-lifetime-specifier.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error[E0106]: missing lifetime specifiers
--> $DIR/missing-lifetime-specifier.rs:23:44
--> $DIR/missing-lifetime-specifier.rs:28:44
|
LL | static a: RefCell<HashMap<i32, Vec<Vec<Foo>>>> = RefCell::new(HashMap::new());
| ^^^ expected 2 lifetime parameters
Expand All @@ -11,20 +11,7 @@ LL | static a: RefCell<HashMap<i32, Vec<Vec<Foo<'static, 'static>>>>> = RefC
| ++++++++++++++++++

error[E0106]: missing lifetime specifiers
--> $DIR/missing-lifetime-specifier.rs:23:44
|
LL | / thread_local! {
LL | | static a: RefCell<HashMap<i32, Vec<Vec<Foo>>>> = RefCell::new(HashMap::new());
| | ^^^ expected 2 lifetime parameters
LL | |
LL | |
LL | | }
| |_-
|
= help: this function's return type contains a borrowed value, but the signature does not say which one of `init`'s 3 lifetimes it is borrowed from

error[E0106]: missing lifetime specifiers
--> $DIR/missing-lifetime-specifier.rs:28:44
--> $DIR/missing-lifetime-specifier.rs:32:44
|
LL | static b: RefCell<HashMap<i32, Vec<Vec<&Bar>>>> = RefCell::new(HashMap::new());
| ^^^^ expected 2 lifetime parameters
Expand All @@ -38,22 +25,7 @@ LL | static b: RefCell<HashMap<i32, Vec<Vec<&'static Bar<'static, 'static>>>
| +++++++ ++++++++++++++++++

error[E0106]: missing lifetime specifiers
--> $DIR/missing-lifetime-specifier.rs:28:44
|
LL | / thread_local! {
LL | | static b: RefCell<HashMap<i32, Vec<Vec<&Bar>>>> = RefCell::new(HashMap::new());
| | ^^^^ expected 2 lifetime parameters
| | |
| | expected named lifetime parameter
LL | |
LL | |
LL | | }
| |_-
|
= help: this function's return type contains a borrowed value, but the signature does not say which one of `init`'s 4 lifetimes it is borrowed from

error[E0106]: missing lifetime specifiers
--> $DIR/missing-lifetime-specifier.rs:33:47
--> $DIR/missing-lifetime-specifier.rs:36:47
|
LL | static c: RefCell<HashMap<i32, Vec<Vec<Qux<i32>>>>> = RefCell::new(HashMap::new());
| ^ expected 2 lifetime parameters
Expand All @@ -65,20 +37,7 @@ LL | static c: RefCell<HashMap<i32, Vec<Vec<Qux<'static, 'static, i32>>>>> =
| +++++++++++++++++

error[E0106]: missing lifetime specifiers
--> $DIR/missing-lifetime-specifier.rs:33:47
|
LL | / thread_local! {
LL | | static c: RefCell<HashMap<i32, Vec<Vec<Qux<i32>>>>> = RefCell::new(HashMap::new());
| | ^ expected 2 lifetime parameters
LL | |
LL | |
LL | | }
| |_-
|
= help: this function's return type contains a borrowed value, but the signature does not say which one of `init`'s 3 lifetimes it is borrowed from

error[E0106]: missing lifetime specifiers
--> $DIR/missing-lifetime-specifier.rs:38:44
--> $DIR/missing-lifetime-specifier.rs:40:44
|
LL | static d: RefCell<HashMap<i32, Vec<Vec<&Tar<i32>>>>> = RefCell::new(HashMap::new());
| ^ ^ expected 2 lifetime parameters
Expand All @@ -91,23 +50,8 @@ help: consider using the `'static` lifetime, but this is uncommon unless you're
LL | static d: RefCell<HashMap<i32, Vec<Vec<&'static Tar<'static, 'static, i32>>>>> = RefCell::new(HashMap::new());
| +++++++ +++++++++++++++++

error[E0106]: missing lifetime specifiers
--> $DIR/missing-lifetime-specifier.rs:38:44
|
LL | / thread_local! {
LL | | static d: RefCell<HashMap<i32, Vec<Vec<&Tar<i32>>>>> = RefCell::new(HashMap::new());
| | ^ ^ expected 2 lifetime parameters
| | |
| | expected named lifetime parameter
LL | |
LL | |
LL | | }
| |_-
|
= help: this function's return type contains a borrowed value, but the signature does not say which one of `init`'s 4 lifetimes it is borrowed from

error[E0106]: missing lifetime specifier
--> $DIR/missing-lifetime-specifier.rs:48:44
--> $DIR/missing-lifetime-specifier.rs:49:44
|
LL | static f: RefCell<HashMap<i32, Vec<Vec<&Tar<'static, i32>>>>> = RefCell::new(HashMap::new());
| ^ expected named lifetime parameter
Expand All @@ -118,30 +62,16 @@ help: consider using the `'static` lifetime, but this is uncommon unless you're
LL | static f: RefCell<HashMap<i32, Vec<Vec<&'static Tar<'static, i32>>>>> = RefCell::new(HashMap::new());
| +++++++

error[E0106]: missing lifetime specifier
--> $DIR/missing-lifetime-specifier.rs:48:44
|
LL | / thread_local! {
LL | | static f: RefCell<HashMap<i32, Vec<Vec<&Tar<'static, i32>>>>> = RefCell::new(HashMap::new());
| | ^ expected named lifetime parameter
LL | |
LL | |
LL | |
LL | | }
| |_-
|
= help: this function's return type contains a borrowed value, but the signature does not say which one of `init`'s 3 lifetimes it is borrowed from

error[E0107]: union takes 2 lifetime arguments but 1 lifetime argument was supplied
--> $DIR/missing-lifetime-specifier.rs:44:44
--> $DIR/missing-lifetime-specifier.rs:45:44
|
LL | static e: RefCell<HashMap<i32, Vec<Vec<Qux<'static, i32>>>>> = RefCell::new(HashMap::new());
| ^^^ ------- supplied 1 lifetime argument
| |
| expected 2 lifetime arguments
|
note: union defined here, with 2 lifetime parameters: `'t`, `'k`
--> $DIR/missing-lifetime-specifier.rs:16:11
--> $DIR/missing-lifetime-specifier.rs:21:11
|
LL | pub union Qux<'t, 'k, I> {
| ^^^ -- --
Expand All @@ -151,15 +81,15 @@ LL | static e: RefCell<HashMap<i32, Vec<Vec<Qux<'static, 'static, i32>>>>> =
| +++++++++

error[E0107]: trait takes 2 lifetime arguments but 1 lifetime argument was supplied
--> $DIR/missing-lifetime-specifier.rs:48:45
--> $DIR/missing-lifetime-specifier.rs:49:45
|
LL | static f: RefCell<HashMap<i32, Vec<Vec<&Tar<'static, i32>>>>> = RefCell::new(HashMap::new());
| ^^^ ------- supplied 1 lifetime argument
| |
| expected 2 lifetime arguments
|
note: trait defined here, with 2 lifetime parameters: `'t`, `'k`
--> $DIR/missing-lifetime-specifier.rs:20:7
--> $DIR/missing-lifetime-specifier.rs:25:7
|
LL | trait Tar<'t, 'k, I> {}
| ^^^ -- --
Expand All @@ -168,7 +98,7 @@ help: add missing lifetime argument
LL | static f: RefCell<HashMap<i32, Vec<Vec<&Tar<'static, 'static, i32>>>>> = RefCell::new(HashMap::new());
| +++++++++

error: aborting due to 12 previous errors
error: aborting due to 7 previous errors

Some errors have detailed explanations: E0106, E0107.
For more information about an error, try `rustc --explain E0106`.

0 comments on commit 6df8d0d

Please sign in to comment.