about summary refs log tree commit diff
path: root/tests/ui/consts/escaping-bound-var.rs
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2023-09-02 21:29:27 +0000
committerMichael Goulet <michael@errs.io>2023-09-05 20:20:55 +0000
commit52aff538123137fb395a52c4ddb6fba2ef6fed07 (patch)
tree353a1e65c756aac838455fff182b4b95e8c89374 /tests/ui/consts/escaping-bound-var.rs
parentab45885dec2a6552cb060a5b7183653baaecd580 (diff)
downloadrust-52aff538123137fb395a52c4ddb6fba2ef6fed07.tar.gz
rust-52aff538123137fb395a52c4ddb6fba2ef6fed07.zip
Correctly deny late-bound lifetimes from parent in anon consts and TAITs
Diffstat (limited to 'tests/ui/consts/escaping-bound-var.rs')
-rw-r--r--tests/ui/consts/escaping-bound-var.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/ui/consts/escaping-bound-var.rs b/tests/ui/consts/escaping-bound-var.rs
new file mode 100644
index 00000000000..7c1fbd24f55
--- /dev/null
+++ b/tests/ui/consts/escaping-bound-var.rs
@@ -0,0 +1,13 @@
+#![feature(generic_const_exprs)]
+//~^ WARN the feature `generic_const_exprs` is incomplete
+
+fn test<'a>(
+    _: &'a (),
+) -> [(); {
+    let x: &'a ();
+    //~^ ERROR cannot capture late-bound lifetime in constant
+    1
+}] {
+}
+
+fn main() {}