summaryrefslogtreecommitdiffstats
path: root/tests/ui/consts/assoc-const-elided-lifetime.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/consts/assoc-const-elided-lifetime.rs')
-rw-r--r--tests/ui/consts/assoc-const-elided-lifetime.rs19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/ui/consts/assoc-const-elided-lifetime.rs b/tests/ui/consts/assoc-const-elided-lifetime.rs
new file mode 100644
index 000000000..10cd33a8f
--- /dev/null
+++ b/tests/ui/consts/assoc-const-elided-lifetime.rs
@@ -0,0 +1,19 @@
+#![deny(elided_lifetimes_in_associated_constant)]
+
+use std::marker::PhantomData;
+
+struct Foo<'a> {
+ x: PhantomData<&'a ()>,
+}
+
+impl<'a> Foo<'a> {
+ const FOO: Foo<'_> = Foo { x: PhantomData::<&()> };
+ //~^ ERROR `'_` cannot be used here
+ //~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+
+ const BAR: &() = &();
+ //~^ ERROR `&` without an explicit lifetime name cannot be used here
+ //~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+}
+
+fn main() {}