-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
C-bugCategory: This is a bug.Category: This is a bug.F-async_fn_in_traitStatic async fn in traitsStatic async fn in traitsrequires-nightlyThis issue requires a nightly compiler in some way.This issue requires a nightly compiler in some way.
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
newAM
Metadata
Metadata
Assignees
Labels
C-bugCategory: This is a bug.Category: This is a bug.F-async_fn_in_traitStatic async fn in traitsStatic async fn in traitsrequires-nightlyThis issue requires a nightly compiler in some way.This issue requires a nightly compiler in some way.
Activity
Dirbaio commentedon Nov 1, 2022
searched nightlies: from nightly-2022-10-22 to nightly-2022-11-01
regressed nightly: nightly-2022-10-29
searched commit range: 0da281b...9565dfe
regressed commit: 898f463'
likely #103608
Dirbaio commentedon Nov 1, 2022
Another repro which I believe is the same bug:
impl Trait
in trait originating fromimpl
#103852Rollup merge of rust-lang#103852 - compiler-errors:rpitit-early-from-…
Rollup merge of rust-lang#103852 - compiler-errors:rpitit-early-from-…
Rollup merge of rust-lang#103852 - compiler-errors:rpitit-early-from-…
Rollup merge of rust-lang#103852 - compiler-errors:rpitit-early-from-…