Update tests.

This commit is contained in:
Mara Bos 2021-12-20 19:24:40 +01:00
parent 3b9e214c40
commit a6e7f26f5a
5 changed files with 118 additions and 61 deletions

View File

@ -45,6 +45,7 @@ thread_local! {
//~| ERROR this union takes 2 lifetime arguments but 1 lifetime argument was supplied //~| ERROR this union takes 2 lifetime arguments but 1 lifetime argument was supplied
//~| ERROR this union takes 2 lifetime arguments but 1 lifetime argument was supplied //~| ERROR this union takes 2 lifetime arguments but 1 lifetime argument was supplied
//~| ERROR this union takes 2 lifetime arguments but 1 lifetime argument was supplied //~| ERROR this union takes 2 lifetime arguments but 1 lifetime argument was supplied
//~| ERROR this union takes 2 lifetime arguments but 1 lifetime argument was supplied
} }
thread_local! { thread_local! {
static f: RefCell<HashMap<i32, Vec<Vec<&Tar<'static, i32>>>>> = RefCell::new(HashMap::new()); static f: RefCell<HashMap<i32, Vec<Vec<&Tar<'static, i32>>>>> = RefCell::new(HashMap::new());
@ -52,6 +53,7 @@ thread_local! {
//~| ERROR this trait takes 2 lifetime arguments but 1 lifetime argument was supplied //~| ERROR this trait takes 2 lifetime arguments but 1 lifetime argument was supplied
//~| ERROR this trait takes 2 lifetime arguments but 1 lifetime argument was supplied //~| ERROR this trait takes 2 lifetime arguments but 1 lifetime argument was supplied
//~| ERROR this trait takes 2 lifetime arguments but 1 lifetime argument was supplied //~| ERROR this trait takes 2 lifetime arguments but 1 lifetime argument was supplied
//~| ERROR this trait takes 2 lifetime arguments but 1 lifetime argument was supplied
//~| ERROR missing lifetime //~| ERROR missing lifetime
//~| ERROR missing lifetime //~| ERROR missing lifetime
} }

View File

@ -13,14 +13,15 @@ LL | static a: RefCell<HashMap<i32, Vec<Vec<Foo<'static, 'static>>>>> = RefC
error[E0106]: missing lifetime specifiers error[E0106]: missing lifetime specifiers
--> $DIR/missing-lifetime-specifier.rs:18:44 --> $DIR/missing-lifetime-specifier.rs:18:44
| |
LL | static a: RefCell<HashMap<i32, Vec<Vec<Foo>>>> = RefCell::new(HashMap::new()); LL | / thread_local! {
| ^^^ expected 2 lifetime parameters 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 there is no value for it to be borrowed from = 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
help: consider using the `'static` lifetime
|
LL | static a: RefCell<HashMap<i32, Vec<Vec<Foo<'static, 'static>>>>> = RefCell::new(HashMap::new());
| ~~~~~~~~~~~~~~~~~~~~~
error[E0106]: missing lifetime specifier error[E0106]: missing lifetime specifier
--> $DIR/missing-lifetime-specifier.rs:23:44 --> $DIR/missing-lifetime-specifier.rs:23:44
@ -49,26 +50,32 @@ LL | static b: RefCell<HashMap<i32, Vec<Vec<&Bar<'static, 'static>>>>> = Ref
error[E0106]: missing lifetime specifier error[E0106]: missing lifetime specifier
--> $DIR/missing-lifetime-specifier.rs:23:44 --> $DIR/missing-lifetime-specifier.rs:23:44
| |
LL | static b: RefCell<HashMap<i32, Vec<Vec<&Bar>>>> = RefCell::new(HashMap::new()); LL | / thread_local! {
| ^ expected named lifetime parameter LL | | static b: RefCell<HashMap<i32, Vec<Vec<&Bar>>>> = RefCell::new(HashMap::new());
| | ^ expected named lifetime parameter
LL | |
LL | |
LL | |
LL | |
LL | | }
| |_-
| |
= help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from = 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
help: consider using the `'static` lifetime
|
LL | static b: RefCell<HashMap<i32, Vec<Vec<&'static Bar>>>> = RefCell::new(HashMap::new());
| ~~~~~~~~
error[E0106]: missing lifetime specifiers error[E0106]: missing lifetime specifiers
--> $DIR/missing-lifetime-specifier.rs:23:45 --> $DIR/missing-lifetime-specifier.rs:23:45
| |
LL | static b: RefCell<HashMap<i32, Vec<Vec<&Bar>>>> = RefCell::new(HashMap::new()); LL | / thread_local! {
| ^^^ expected 2 lifetime parameters LL | | static b: RefCell<HashMap<i32, Vec<Vec<&Bar>>>> = RefCell::new(HashMap::new());
| | ^^^ expected 2 lifetime parameters
LL | |
LL | |
LL | |
LL | |
LL | | }
| |_-
| |
= help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from = 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
help: consider using the `'static` lifetime
|
LL | static b: RefCell<HashMap<i32, Vec<Vec<&Bar<'static, 'static>>>>> = RefCell::new(HashMap::new());
| ~~~~~~~~~~~~~~~~~~~~~
error[E0106]: missing lifetime specifiers error[E0106]: missing lifetime specifiers
--> $DIR/missing-lifetime-specifier.rs:30:48 --> $DIR/missing-lifetime-specifier.rs:30:48
@ -85,14 +92,15 @@ LL | static c: RefCell<HashMap<i32, Vec<Vec<Qux<'static, 'static, i32>>>>> =
error[E0106]: missing lifetime specifiers error[E0106]: missing lifetime specifiers
--> $DIR/missing-lifetime-specifier.rs:30:48 --> $DIR/missing-lifetime-specifier.rs:30:48
| |
LL | static c: RefCell<HashMap<i32, Vec<Vec<Qux<i32>>>>> = RefCell::new(HashMap::new()); LL | / thread_local! {
| ^ expected 2 lifetime parameters 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 there is no value for it to be borrowed from = 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
help: consider using the `'static` lifetime
|
LL | static c: RefCell<HashMap<i32, Vec<Vec<Qux<'static, 'static, i32>>>>> = RefCell::new(HashMap::new());
| +++++++++++++++++
error[E0106]: missing lifetime specifier error[E0106]: missing lifetime specifier
--> $DIR/missing-lifetime-specifier.rs:35:44 --> $DIR/missing-lifetime-specifier.rs:35:44
@ -121,26 +129,32 @@ LL | static d: RefCell<HashMap<i32, Vec<Vec<&Tar<'static, 'static, i32>>>>>
error[E0106]: missing lifetime specifier error[E0106]: missing lifetime specifier
--> $DIR/missing-lifetime-specifier.rs:35:44 --> $DIR/missing-lifetime-specifier.rs:35:44
| |
LL | static d: RefCell<HashMap<i32, Vec<Vec<&Tar<i32>>>>> = RefCell::new(HashMap::new()); LL | / thread_local! {
| ^ expected named lifetime parameter LL | | static d: RefCell<HashMap<i32, Vec<Vec<&Tar<i32>>>>> = RefCell::new(HashMap::new());
| | ^ expected named lifetime parameter
LL | |
LL | |
LL | |
LL | |
LL | | }
| |_-
| |
= help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from = 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
help: consider using the `'static` lifetime
|
LL | static d: RefCell<HashMap<i32, Vec<Vec<&'static Tar<i32>>>>> = RefCell::new(HashMap::new());
| ~~~~~~~~
error[E0106]: missing lifetime specifiers error[E0106]: missing lifetime specifiers
--> $DIR/missing-lifetime-specifier.rs:35:49 --> $DIR/missing-lifetime-specifier.rs:35:49
| |
LL | static d: RefCell<HashMap<i32, Vec<Vec<&Tar<i32>>>>> = RefCell::new(HashMap::new()); LL | / thread_local! {
| ^ expected 2 lifetime parameters LL | | static d: RefCell<HashMap<i32, Vec<Vec<&Tar<i32>>>>> = RefCell::new(HashMap::new());
| | ^ expected 2 lifetime parameters
LL | |
LL | |
LL | |
LL | |
LL | | }
| |_-
| |
= help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from = 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
help: consider using the `'static` lifetime
|
LL | static d: RefCell<HashMap<i32, Vec<Vec<&Tar<'static, 'static, i32>>>>> = RefCell::new(HashMap::new());
| +++++++++++++++++
error[E0107]: this union takes 2 lifetime arguments but 1 lifetime argument was supplied error[E0107]: this union takes 2 lifetime arguments but 1 lifetime argument was supplied
--> $DIR/missing-lifetime-specifier.rs:43:44 --> $DIR/missing-lifetime-specifier.rs:43:44
@ -196,6 +210,24 @@ help: add missing lifetime argument
LL | static e: RefCell<HashMap<i32, Vec<Vec<Qux<'static, 'k, i32>>>>> = RefCell::new(HashMap::new()); LL | static e: RefCell<HashMap<i32, Vec<Vec<Qux<'static, 'k, i32>>>>> = RefCell::new(HashMap::new());
| ++++ | ++++
error[E0107]: this union takes 2 lifetime arguments but 1 lifetime argument was supplied
--> $DIR/missing-lifetime-specifier.rs:43: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:11:11
|
LL | pub union Qux<'t, 'k, I> {
| ^^^ -- --
help: add missing lifetime argument
|
LL | static e: RefCell<HashMap<i32, Vec<Vec<Qux<'static, 'k, i32>>>>> = RefCell::new(HashMap::new());
| ++++
error[E0107]: this union takes 2 lifetime arguments but 1 lifetime argument was supplied error[E0107]: this union takes 2 lifetime arguments but 1 lifetime argument was supplied
--> $DIR/missing-lifetime-specifier.rs:43:44 --> $DIR/missing-lifetime-specifier.rs:43:44
| |
@ -215,7 +247,7 @@ LL | static e: RefCell<HashMap<i32, Vec<Vec<Qux<'static, '_, i32>>>>> = RefC
| ++++ | ++++
error[E0107]: this trait takes 2 lifetime arguments but 1 lifetime argument was supplied error[E0107]: this trait takes 2 lifetime arguments but 1 lifetime argument was supplied
--> $DIR/missing-lifetime-specifier.rs:50:45 --> $DIR/missing-lifetime-specifier.rs:51:45
| |
LL | static f: RefCell<HashMap<i32, Vec<Vec<&Tar<'static, i32>>>>> = RefCell::new(HashMap::new()); LL | static f: RefCell<HashMap<i32, Vec<Vec<&Tar<'static, i32>>>>> = RefCell::new(HashMap::new());
| ^^^ ------- supplied 1 lifetime argument | ^^^ ------- supplied 1 lifetime argument
@ -233,7 +265,7 @@ LL | static f: RefCell<HashMap<i32, Vec<Vec<&Tar<'static, '_, i32>>>>> = Ref
| ++++ | ++++
error[E0106]: missing lifetime specifier error[E0106]: missing lifetime specifier
--> $DIR/missing-lifetime-specifier.rs:50:44 --> $DIR/missing-lifetime-specifier.rs:51:44
| |
LL | static f: RefCell<HashMap<i32, Vec<Vec<&Tar<'static, i32>>>>> = RefCell::new(HashMap::new()); LL | static f: RefCell<HashMap<i32, Vec<Vec<&Tar<'static, i32>>>>> = RefCell::new(HashMap::new());
| ^ expected named lifetime parameter | ^ expected named lifetime parameter
@ -245,7 +277,7 @@ LL | static f: RefCell<HashMap<i32, Vec<Vec<&'static Tar<'static, i32>>>>> =
| ~~~~~~~~ | ~~~~~~~~
error[E0107]: this trait takes 2 lifetime arguments but 1 lifetime argument was supplied error[E0107]: this trait takes 2 lifetime arguments but 1 lifetime argument was supplied
--> $DIR/missing-lifetime-specifier.rs:50:45 --> $DIR/missing-lifetime-specifier.rs:51:45
| |
LL | static f: RefCell<HashMap<i32, Vec<Vec<&Tar<'static, i32>>>>> = RefCell::new(HashMap::new()); LL | static f: RefCell<HashMap<i32, Vec<Vec<&Tar<'static, i32>>>>> = RefCell::new(HashMap::new());
| ^^^ ------- supplied 1 lifetime argument | ^^^ ------- supplied 1 lifetime argument
@ -263,19 +295,22 @@ LL | static f: RefCell<HashMap<i32, Vec<Vec<&Tar<'static, 'k, i32>>>>> = Ref
| ++++ | ++++
error[E0106]: missing lifetime specifier error[E0106]: missing lifetime specifier
--> $DIR/missing-lifetime-specifier.rs:50:44 --> $DIR/missing-lifetime-specifier.rs:51:44
| |
LL | static f: RefCell<HashMap<i32, Vec<Vec<&Tar<'static, i32>>>>> = RefCell::new(HashMap::new()); LL | / thread_local! {
| ^ expected named lifetime parameter 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 there is no value for it to be borrowed from = 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
help: consider using the `'static` lifetime
|
LL | static f: RefCell<HashMap<i32, Vec<Vec<&'static Tar<'static, i32>>>>> = RefCell::new(HashMap::new());
| ~~~~~~~~
error[E0107]: this trait takes 2 lifetime arguments but 1 lifetime argument was supplied error[E0107]: this trait takes 2 lifetime arguments but 1 lifetime argument was supplied
--> $DIR/missing-lifetime-specifier.rs:50:45 --> $DIR/missing-lifetime-specifier.rs:51:45
| |
LL | static f: RefCell<HashMap<i32, Vec<Vec<&Tar<'static, i32>>>>> = RefCell::new(HashMap::new()); LL | static f: RefCell<HashMap<i32, Vec<Vec<&Tar<'static, i32>>>>> = RefCell::new(HashMap::new());
| ^^^ ------- supplied 1 lifetime argument | ^^^ ------- supplied 1 lifetime argument
@ -293,7 +328,25 @@ LL | static f: RefCell<HashMap<i32, Vec<Vec<&Tar<'static, 'k, i32>>>>> = Ref
| ++++ | ++++
error[E0107]: this trait takes 2 lifetime arguments but 1 lifetime argument was supplied error[E0107]: this trait takes 2 lifetime arguments but 1 lifetime argument was supplied
--> $DIR/missing-lifetime-specifier.rs:50:45 --> $DIR/missing-lifetime-specifier.rs:51: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:15:7
|
LL | trait Tar<'t, 'k, I> {}
| ^^^ -- --
help: add missing lifetime argument
|
LL | static f: RefCell<HashMap<i32, Vec<Vec<&Tar<'static, 'k, i32>>>>> = RefCell::new(HashMap::new());
| ++++
error[E0107]: this trait takes 2 lifetime arguments but 1 lifetime argument was supplied
--> $DIR/missing-lifetime-specifier.rs:51:45
| |
LL | static f: RefCell<HashMap<i32, Vec<Vec<&Tar<'static, i32>>>>> = RefCell::new(HashMap::new()); LL | static f: RefCell<HashMap<i32, Vec<Vec<&Tar<'static, i32>>>>> = RefCell::new(HashMap::new());
| ^^^ ------- supplied 1 lifetime argument | ^^^ ------- supplied 1 lifetime argument
@ -310,7 +363,7 @@ help: add missing lifetime argument
LL | static f: RefCell<HashMap<i32, Vec<Vec<&Tar<'static, '_, i32>>>>> = RefCell::new(HashMap::new()); LL | static f: RefCell<HashMap<i32, Vec<Vec<&Tar<'static, '_, i32>>>>> = RefCell::new(HashMap::new());
| ++++ | ++++
error: aborting due to 22 previous errors error: aborting due to 24 previous errors
Some errors have detailed explanations: E0106, E0107. Some errors have detailed explanations: E0106, E0107.
For more information about an error, try `rustc --explain E0106`. For more information about an error, try `rustc --explain E0106`.

View File

@ -1,5 +1,5 @@
error[E0133]: call to unsafe function is unsafe and requires unsafe function or block error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
--> $DIR/issue-43733.rs:17:5 --> $DIR/issue-43733.rs:19:5
| |
LL | __KEY.get(Default::default) LL | __KEY.get(Default::default)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
@ -7,7 +7,7 @@ LL | __KEY.get(Default::default)
= note: consult the function's documentation for information on how to avoid undefined behavior = note: consult the function's documentation for information on how to avoid undefined behavior
error[E0133]: call to unsafe function is unsafe and requires unsafe function or block error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
--> $DIR/issue-43733.rs:20:42 --> $DIR/issue-43733.rs:22:42
| |
LL | static FOO: std::thread::LocalKey<Foo> = std::thread::LocalKey::new(__getit); LL | static FOO: std::thread::LocalKey<Foo> = std::thread::LocalKey::new(__getit);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function

View File

@ -4,6 +4,8 @@
#![feature(thread_local)] #![feature(thread_local)]
#![feature(cfg_target_thread_local, thread_local_internals)] #![feature(cfg_target_thread_local, thread_local_internals)]
use std::cell::RefCell;
type Foo = std::cell::RefCell<String>; type Foo = std::cell::RefCell<String>;
#[cfg(target_thread_local)] #[cfg(target_thread_local)]
@ -13,7 +15,7 @@ static __KEY: std::thread::__FastLocalKeyInner<Foo> = std::thread::__FastLocalKe
#[cfg(not(target_thread_local))] #[cfg(not(target_thread_local))]
static __KEY: std::thread::__OsLocalKeyInner<Foo> = std::thread::__OsLocalKeyInner::new(); static __KEY: std::thread::__OsLocalKeyInner<Foo> = std::thread::__OsLocalKeyInner::new();
fn __getit() -> std::option::Option<&'static Foo> { fn __getit(_: Option<&mut Option<RefCell<String>>>) -> std::option::Option<&'static Foo> {
__KEY.get(Default::default) //~ ERROR call to unsafe function is unsafe __KEY.get(Default::default) //~ ERROR call to unsafe function is unsafe
} }

View File

@ -1,5 +1,5 @@
error[E0133]: call to unsafe function is unsafe and requires unsafe function or block error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
--> $DIR/issue-43733.rs:17:5 --> $DIR/issue-43733.rs:19:5
| |
LL | __KEY.get(Default::default) LL | __KEY.get(Default::default)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
@ -7,7 +7,7 @@ LL | __KEY.get(Default::default)
= note: consult the function's documentation for information on how to avoid undefined behavior = note: consult the function's documentation for information on how to avoid undefined behavior
error[E0133]: call to unsafe function is unsafe and requires unsafe function or block error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
--> $DIR/issue-43733.rs:20:42 --> $DIR/issue-43733.rs:22:42
| |
LL | static FOO: std::thread::LocalKey<Foo> = std::thread::LocalKey::new(__getit); LL | static FOO: std::thread::LocalKey<Foo> = std::thread::LocalKey::new(__getit);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function