Closed
Description
pub trait Foo {
async fn foo(&mut self);
}
impl<T: Foo> Foo for &mut T {
async fn foo(&mut self) {}
}
gives
error[[E0308]](https://doc.rust-lang.org/nightly/error-index.html#E0308): method not compatible with trait
--> src/lib.rs:9:5
|
9 | async fn foo(&mut self) {}
| ^^^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch
|
note: while checking the return type of the `async fn`
--> src/lib.rs:9:29
|
9 | async fn foo(&mut self) {}
| ^ checked the `Output` of this `async fn`, expected opaque type
note: while checking the return type of the `async fn`
--> src/lib.rs:9:29
|
9 | async fn foo(&mut self) {}
| ^ checked the `Output` of this `async fn`, found opaque type
= note: expected fn pointer `fn(&mut &mut T) -> impl Future<Output = ()>`
found fn pointer `fn(&mut &mut T) -> impl Future<Output = ()>`
note: the anonymous lifetime as defined here...
--> src/lib.rs:8:22
|
8 | impl<T: Foo> Foo for &mut T {
| ^
= note: ...does not necessarily outlive the static lifetime
Build using the Nightly version: 1.67.0-nightly (2022-10-31 95a3a72)
@rustbot label F-async_fn_in_traits C-bug requires-nightly