about summary refs log tree commit diff
diff options
context:
space:
mode:
authorCamille GILLOT <gillot.camille@gmail.com>2025-07-04 16:08:36 +0000
committerCamille GILLOT <gillot.camille@gmail.com>2025-07-20 13:21:22 +0000
commit313dff14b93beab9d526e41563eb99135e96060c (patch)
tree2af62a1f1d1e819c102350b41f5a92bd25ccb29e
parent8f08b3a32478b8d0507732800ecb548a76e0fd0c (diff)
downloadrust-313dff14b93beab9d526e41563eb99135e96060c.tar.gz
rust-313dff14b93beab9d526e41563eb99135e96060c.zip
Add test.
-rw-r--r--tests/ui/lifetimes/elided-lifetime-in-const-param-type.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/ui/lifetimes/elided-lifetime-in-const-param-type.rs b/tests/ui/lifetimes/elided-lifetime-in-const-param-type.rs
new file mode 100644
index 00000000000..cdfd1327eae
--- /dev/null
+++ b/tests/ui/lifetimes/elided-lifetime-in-const-param-type.rs
@@ -0,0 +1,12 @@
+//! Regression test for <https://github.com/rust-lang/rust/issues/143413>
+//! The anonymous lifetime in `c(&())` is desugared by the resolver as an extra lifetime parameter
+//! at the end of the `for` binder. Verify that lowering creates the definition for that extra
+//! lifetime parameter before lowering `c(&())`.
+
+trait D {}
+
+type A = dyn for<const B: c(&())> D;
+//~^ ERROR cannot find type `c` in this scope
+//~| ERROR only lifetime parameters can be used in this context
+
+fn main() {}