about summary refs log tree commit diff
path: root/tests/ui/underscore-lifetime/in-struct.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/underscore-lifetime/in-struct.rs')
-rw-r--r--tests/ui/underscore-lifetime/in-struct.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/ui/underscore-lifetime/in-struct.rs b/tests/ui/underscore-lifetime/in-struct.rs
new file mode 100644
index 00000000000..bed89c7dc09
--- /dev/null
+++ b/tests/ui/underscore-lifetime/in-struct.rs
@@ -0,0 +1,13 @@
+// Check that the `'_` used in structs/enums gives an error.
+
+use std::fmt::Debug;
+
+struct Foo {
+    x: &'_ u32, //~ ERROR missing lifetime specifier
+}
+
+enum Bar {
+    Variant(&'_ u32), //~ ERROR missing lifetime specifier
+}
+
+fn main() { }