about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/ui/closures/eager-mono-with-normalizable-upvars.rs19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/ui/closures/eager-mono-with-normalizable-upvars.rs b/tests/ui/closures/eager-mono-with-normalizable-upvars.rs
new file mode 100644
index 00000000000..4d934f7a7a9
--- /dev/null
+++ b/tests/ui/closures/eager-mono-with-normalizable-upvars.rs
@@ -0,0 +1,19 @@
+//@ compile-flags: -Clink-dead-code -Csymbol-mangling-version=v0
+//@ build-pass
+
+// Ensure that when eagerly collecting `test::{closure#0}`, we don't try
+// collecting an unnormalized version of the closure (specifically its
+// upvars), since the closure captures the RPIT `opaque::{opaque#0}`.
+
+fn opaque() -> impl Sized {}
+
+fn test() -> impl FnOnce() {
+    let opaque = opaque();
+    move || {
+        let opaque = opaque;
+    }
+}
+
+fn main() {
+    test()();
+}