Closed
Description
I had a compiler crash while compiling a piece of code #79783, after fix the bug, I found that the same piece of code failed to compile after using async-trait. Example:
struct A {}
impl A {
async fn xx_test (&self) {
match actix_web::HttpServer::new (|| {
actix_web::App::new ()
}).bind ("127.0.0.1:8080") {
Ok (mut _server) => { _server.run ().await; () },
Err (_e) => println! ("http listen failed: {}", _e.to_string ()),
}
}
}
#[async_trait]
pub trait B: Send + Sync {
async fn test_func (&self);
}
struct C {}
#[async_trait]
impl B for C {
async fn test_func (&self) {
// compile error
match actix_web::HttpServer::new (|| {
actix_web::App::new ()
}).bind ("127.0.0.1:8080") {
Ok (mut _server) => { _server.run ().await; () },
Err (_e) => println! ("http listen failed: {}", _e.to_string ()),
}
}
}
Why is that? How to fix it?
Metadata
Metadata
Assignees
Labels
No labels