You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Generic param requires bounds on call to function that is already required for calls to the caller #102611
Seems like this behavior has existed for a while, so apologies in advance if this is already a settled matter. If so, I still think the failure coulld use a better error message.
error[E0309]: the parameter type `A` may not live long enough
--> src/lib.rs:7:9
|
7 | Self::foo();
| ^^^^^^^^^ ...so that the type `A` will meet its required lifetime bounds
|
help: consider adding an explicit lifetime bound...
|
3 | impl<'a, A: 'a> Foo<'a, A> {
| ++++
In call_foo, the compiler (correctly) requires that A: 'a, but fails to realize that this bound is already satisfied (because this is also required for callers of call_foo).
To me, this seems like a bug. However, this behavior seems to have been present in stable for long enough that it seems highly unlikely it hasn't already been discussed at length - I couldn't find any issues referencing it though. (closest seems to be #84021).
Happy to help where I can (would need some direction).
yeah, implied bounds from the impl header are ignored while typechecking a function body but apparently still required somewhere 😁 i am currently working on this and should hopefully be able to fix this in the somewhat near future
Activity
lcnr commentedon Oct 3, 2022
yeah, implied bounds from the impl header are ignored while typechecking a function body but apparently still required somewhere 😁 i am currently working on this and should hopefully be able to fix this in the somewhat near future
@rustbot claim
aliemjay commentedon Oct 3, 2022
They're required for the WF-check of
Selfin borrowck. This is a duplicate of #98852.Rageking8 commentedon Oct 4, 2022
@rustbot label +T-compiler +C-bug
Auto merge of rust-lang#104098 - aliemjay:fn-wf, r=<try>
Auto merge of rust-lang#104098 - aliemjay:fn-wf, r=<try>
Auto merge of rust-lang#104098 - aliemjay:fn-wf, r=<try>
Auto merge of rust-lang#120019 - lcnr:fn-wf, r=BoxyUwU