Add test for issue 106062

This commit is contained in:
Albert Larsan 2023-01-09 16:33:09 +00:00
parent 89e0576bd3
commit c5ee72cb3b
No known key found for this signature in database
GPG Key ID: 92709B88BB8F13EA
2 changed files with 42 additions and 0 deletions

View File

@ -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() {}

View File

@ -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`.