about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2025-02-23 04:46:51 +0000
committerMichael Goulet <michael@errs.io>2025-02-23 04:46:51 +0000
commit431b9aa38ff466fbed1b933cd17efa10f6cd03b4 (patch)
treed58c500aa3b16acdbfc370d5e55682bb4a540464 /tests
parent46420c96070b4c4bd8242f16d5806b8f26a57016 (diff)
downloadrust-431b9aa38ff466fbed1b933cd17efa10f6cd03b4.tar.gz
rust-431b9aa38ff466fbed1b933cd17efa10f6cd03b4.zip
Fix missing self subst when rendering Fn* trait with no output type
Diffstat (limited to 'tests')
-rw-r--r--tests/crashes/133597.rs11
-rw-r--r--tests/ui/unboxed-closures/existential-printing.rs8
-rw-r--r--tests/ui/unboxed-closures/existential-printing.stderr17
3 files changed, 25 insertions, 11 deletions
diff --git a/tests/crashes/133597.rs b/tests/crashes/133597.rs
deleted file mode 100644
index f716d5e7bc7..00000000000
--- a/tests/crashes/133597.rs
+++ /dev/null
@@ -1,11 +0,0 @@
-//@ known-bug: #133597
-
-pub trait Foo2 {
-    fn boxed<'a: 'a>() -> impl Sized + FnOnce<()>;
-}
-
-impl Foo2 for () {}
-
-
-fn f() -> impl FnOnce<()> { || () }
-fn main() { () = f(); }
diff --git a/tests/ui/unboxed-closures/existential-printing.rs b/tests/ui/unboxed-closures/existential-printing.rs
new file mode 100644
index 00000000000..f4337320209
--- /dev/null
+++ b/tests/ui/unboxed-closures/existential-printing.rs
@@ -0,0 +1,8 @@
+// Make sure we don't ICE printing `impl AsyncFnOnce<()>`.
+
+#![feature(unboxed_closures, fn_traits)]
+
+fn f() -> impl FnOnce<()> { || () }
+
+fn main() { () = f(); }
+//~^ ERROR mismatched types
diff --git a/tests/ui/unboxed-closures/existential-printing.stderr b/tests/ui/unboxed-closures/existential-printing.stderr
new file mode 100644
index 00000000000..95de98878af
--- /dev/null
+++ b/tests/ui/unboxed-closures/existential-printing.stderr
@@ -0,0 +1,17 @@
+error[E0308]: mismatched types
+  --> $DIR/existential-printing.rs:7:13
+   |
+LL | fn f() -> impl FnOnce<()> { || () }
+   |           --------------- the expected opaque type
+LL |
+LL | fn main() { () = f(); }
+   |             ^^   --- this expression has type `impl FnOnce<()>`
+   |             |
+   |             expected opaque type, found `()`
+   |
+   = note: expected opaque type `impl FnOnce<()>`
+                found unit type `()`
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0308`.