summaryrefslogtreecommitdiffstats
path: root/src/test/ui/suggestions/missing-lifetime-specifier.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:02:58 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:02:58 +0000
commit698f8c2f01ea549d77d7dc3338a12e04c11057b9 (patch)
tree173a775858bd501c378080a10dca74132f05bc50 /src/test/ui/suggestions/missing-lifetime-specifier.rs
parentInitial commit. (diff)
downloadrustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.tar.xz
rustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.zip
Adding upstream version 1.64.0+dfsg1.upstream/1.64.0+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/test/ui/suggestions/missing-lifetime-specifier.rs')
-rw-r--r--src/test/ui/suggestions/missing-lifetime-specifier.rs57
1 files changed, 57 insertions, 0 deletions
diff --git a/src/test/ui/suggestions/missing-lifetime-specifier.rs b/src/test/ui/suggestions/missing-lifetime-specifier.rs
new file mode 100644
index 000000000..24f5f782f
--- /dev/null
+++ b/src/test/ui/suggestions/missing-lifetime-specifier.rs
@@ -0,0 +1,57 @@
+#![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 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
+}
+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! {
+ static e: RefCell<HashMap<i32, Vec<Vec<Qux<'static, i32>>>>> = RefCell::new(HashMap::new());
+ //~^ ERROR this union takes 2 lifetime arguments but 1 lifetime argument
+ //~| 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! {
+ static f: RefCell<HashMap<i32, Vec<Vec<&Tar<'static, i32>>>>> = RefCell::new(HashMap::new());
+ //~^ 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
+}
+
+fn main() {}