about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2023-10-09 16:26:03 +0200
committerGitHub <noreply@github.com>2023-10-09 16:26:03 +0200
commit27a5146e7cd669cd9979865c04929de10fd7b7b3 (patch)
tree888b4284d05f3775c47a13b2c95d17d660fd1250
parentea5cac02e8921e4e3aeb1830b68b88adc3898b27 (diff)
parent2e000ebaa59851b0be911f016375b20c3b5288c0 (diff)
downloadrust-27a5146e7cd669cd9979865c04929de10fd7b7b3.tar.gz
rust-27a5146e7cd669cd9979865c04929de10fd7b7b3.zip
Rollup merge of #116561 - ouz-a:testfor_115517, r=compiler-errors
Add a test for fixed ICE

Addresses https://github.com/rust-lang/rust/issues/115517#issuecomment-1730164116

Closes #115517

r? ``@compiler-errors``
-rw-r--r--tests/ui/typeck/escaping_bound_vars.rs16
-rw-r--r--tests/ui/typeck/escaping_bound_vars.stderr10
2 files changed, 26 insertions, 0 deletions
diff --git a/tests/ui/typeck/escaping_bound_vars.rs b/tests/ui/typeck/escaping_bound_vars.rs
new file mode 100644
index 00000000000..1fb063d2c26
--- /dev/null
+++ b/tests/ui/typeck/escaping_bound_vars.rs
@@ -0,0 +1,16 @@
+// Test for issues/115517 which is fixed by pull/115486
+// This should not ice
+trait Test<const C: usize> {}
+
+trait Elide<T> {
+    fn call();
+}
+
+pub fn test()
+where
+    (): Test<{ 1 + (<() as Elide(&())>::call) }>,
+    //~^ ERROR cannot capture late-bound lifetime in constant
+{
+}
+
+fn main() {}
diff --git a/tests/ui/typeck/escaping_bound_vars.stderr b/tests/ui/typeck/escaping_bound_vars.stderr
new file mode 100644
index 00000000000..f7077e52a70
--- /dev/null
+++ b/tests/ui/typeck/escaping_bound_vars.stderr
@@ -0,0 +1,10 @@
+error: cannot capture late-bound lifetime in constant
+  --> $DIR/escaping_bound_vars.rs:11:35
+   |
+LL |     (): Test<{ 1 + (<() as Elide(&())>::call) }>,
+   |                                  -^
+   |                                  |
+   |                                  lifetime defined here
+
+error: aborting due to previous error
+