about summary refs log tree commit diff
path: root/src/test/ui
diff options
context:
space:
mode:
authorAlbert Larsan <74931857+albertlarsan68@users.noreply.github.com>2023-01-09 16:33:09 +0000
committerAlbert Larsan <74931857+albertlarsan68@users.noreply.github.com>2023-01-09 16:35:14 +0000
commitc5ee72cb3b0138114e0436aca989e2d8939d107e (patch)
treed34fc81ffc452a19c70a705b18d91d135dcfd07e /src/test/ui
parent89e0576bd3aec2f1acf935b353900bd75742860b (diff)
downloadrust-c5ee72cb3b0138114e0436aca989e2d8939d107e.tar.gz
rust-c5ee72cb3b0138114e0436aca989e2d8939d107e.zip
Add test for issue 106062
Diffstat (limited to 'src/test/ui')
-rw-r--r--src/test/ui/mir/issue-106062.rs26
-rw-r--r--src/test/ui/mir/issue-106062.stderr16
2 files changed, 42 insertions, 0 deletions
diff --git a/src/test/ui/mir/issue-106062.rs b/src/test/ui/mir/issue-106062.rs
new file mode 100644
index 00000000000..621ba566ee3
--- /dev/null
+++ b/src/test/ui/mir/issue-106062.rs
@@ -0,0 +1,26 @@
+// edition:2018
+
+use std::{future::Future, marker::PhantomData};
+
+fn spawn<T>(future: T) -> PhantomData<T::Output>
+where
+    T: Future,
+{
+    loop {}
+}
+
+#[derive(Debug)]
+struct IncomingServer {}
+impl IncomingServer {
+    async fn connection_handler(handler: impl Sized) -> Result<Ok, std::io::Error> {
+        //~^ ERROR expected type, found variant `Ok` [E0573]
+        loop {}
+    }
+    async fn spawn(&self, request_handler: impl Sized) {
+        async move {
+            spawn(Self::connection_handler(&request_handler));
+        };
+    }
+}
+
+fn main() {}
diff --git a/src/test/ui/mir/issue-106062.stderr b/src/test/ui/mir/issue-106062.stderr
new file mode 100644
index 00000000000..2f6524d03e0
--- /dev/null
+++ b/src/test/ui/mir/issue-106062.stderr
@@ -0,0 +1,16 @@
+error[E0573]: expected type, found variant `Ok`
+  --> $DIR/issue-106062.rs:15:64
+   |
+LL |     async fn connection_handler(handler: impl Sized) -> Result<Ok, std::io::Error> {
+   |                                                                ^^ not a type
+   |
+help: try using the variant's enum
+   |
+LL |     async fn connection_handler(handler: impl Sized) -> Result<core::result::Result, std::io::Error> {
+   |                                                                ~~~~~~~~~~~~~~~~~~~~
+LL |     async fn connection_handler(handler: impl Sized) -> Result<std::result::Result, std::io::Error> {
+   |                                                                ~~~~~~~~~~~~~~~~~~~
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0573`.