Account for RPITIT in E0310 explicit lifetime constraint suggestion by estebank · Pull Request #121435 · rust-lang/rust (original) (raw)
I see a lot of people define traits with incorrect bounds accidentally.
Right, but this is a case of people falling into the "the applied fix works until i actually use it nontrivially" trap that we have with a lot of our suggestions. People follow them blindly, have their code compile, but then pay a bigger price later on when it turns out that the suggestion was misleading and they have to fix this bug over again.
I don't believe in general that we want to tell users to apply, e.g., + 'static
to their trait definition, because it's necessarily making the trait definition less general, and people will very likely hit this later when they're returning an RPIT that does carry data from something in the self type.
I think it's even more risky to do this without explaining to users that adding + 'static
here may necessarily break their other implementations.