False positive "lifetime may not live long enough" with Cow, ToOwned and Sized #108345
Labels
A-lifetimes
Area: Lifetimes / regions
C-bug
Category: This is a bug.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
T-types
Relevant to the types team, which will review and decide on the PR/issue.
I tried this code:
I expected to see this happen: it compiles.
Instead, this happened:
lifetime may not live long enough
If I remove the
where Self: Sized
in both trait declaration and implementation, it compiles. However, in real world application, there are other methods in this trait so I have to addwhere Self: Sized
to make the trait dyn-safe.If I remove the
where Self: Sized
only in implementation, it compiles. However, If the return type is changed toOption<Cow<'static, str>>
, the code would warn aboutimpl method assumes more implied bounds than the corresponding trait method
. I think this might be a bug.Meta
rustc --version --verbose
:Backtrace
The text was updated successfully, but these errors were encountered: