Closed
Description
Code
#![feature(return_position_impl_trait_in_trait)]
pub trait Tr<T> {
fn foo() -> impl for<'a> Tr<&'a Self>;
}
impl<T> Tr<T> for () {
fn foo() -> impl for<'a> Tr<&'a Self> {}
}
Current output
warning: impl trait in impl method signature does not match trait method signature
--> src/lib.rs:8:22
|
4 | fn foo() -> impl for<'a> Tr<&'a Self>;
| ------------------------- return type from trait method defined here
...
8 | fn foo() -> impl for<'a> Tr<&'a Self> {}
| ^^^^^^^^^^^^^^^^^^^^ this bound is stronger than that defined on the trait
|
= note: add `#[allow(refining_impl_trait)]` if it is intended for this to be part of the public API of this crate
= note: `#[warn(refining_impl_trait)]` on by default
help: replace the return type so that it matches the trait
|
8 | fn foo() -> impl for<'a> Tr<&'a Self> {}
| ~~~~~~~~~~~~~~~~~~~~~~~~~
Desired output
No warnings
Rationale and extra context
Can be reproduced in:
rustc 1.74.0-nightly (13e6f24b9 2023-09-23)
rustc 1.74.0-nightly (37390d656 2023-09-24)
Other cases
No response
Anything else?
No response