Skip to content

Commit f547c4b

Browse files
author
Yuki Okushi
authored
Rollup merge of #106642 - albertlarsan68:test-106062, r=JohnTitor
Add test for #106062 Add a regression test for #106062 Closes #106062
2 parents 397013d + c5ee72c commit f547c4b

File tree

2 files changed

+42
-0
lines changed

2 files changed

+42
-0
lines changed

src/test/ui/mir/issue-106062.rs

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// edition:2018
2+
3+
use std::{future::Future, marker::PhantomData};
4+
5+
fn spawn<T>(future: T) -> PhantomData<T::Output>
6+
where
7+
T: Future,
8+
{
9+
loop {}
10+
}
11+
12+
#[derive(Debug)]
13+
struct IncomingServer {}
14+
impl IncomingServer {
15+
async fn connection_handler(handler: impl Sized) -> Result<Ok, std::io::Error> {
16+
//~^ ERROR expected type, found variant `Ok` [E0573]
17+
loop {}
18+
}
19+
async fn spawn(&self, request_handler: impl Sized) {
20+
async move {
21+
spawn(Self::connection_handler(&request_handler));
22+
};
23+
}
24+
}
25+
26+
fn main() {}

src/test/ui/mir/issue-106062.stderr

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
error[E0573]: expected type, found variant `Ok`
2+
--> $DIR/issue-106062.rs:15:64
3+
|
4+
LL | async fn connection_handler(handler: impl Sized) -> Result<Ok, std::io::Error> {
5+
| ^^ not a type
6+
|
7+
help: try using the variant's enum
8+
|
9+
LL | async fn connection_handler(handler: impl Sized) -> Result<core::result::Result, std::io::Error> {
10+
| ~~~~~~~~~~~~~~~~~~~~
11+
LL | async fn connection_handler(handler: impl Sized) -> Result<std::result::Result, std::io::Error> {
12+
| ~~~~~~~~~~~~~~~~~~~
13+
14+
error: aborting due to previous error
15+
16+
For more information about this error, try `rustc --explain E0573`.

0 commit comments

Comments
 (0)