Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test for #106062 #106642

Merged
merged 1 commit into from
Jan 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions src/test/ui/mir/issue-106062.rs
Original file line number Diff line number Diff line change
@@ -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() {}
16 changes: 16 additions & 0 deletions src/test/ui/mir/issue-106062.stderr
Original file line number Diff line number Diff line change
@@ -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`.