Borrow checker determines borrows by examining lifetime parameters on unexpanded associated types instead of inspecting their lifetime bounds #50029
Labels
A-borrow-checker
Area: The borrow checker
C-enhancement
Category: An issue proposing an enhancement or a PR with one.
T-lang
Relevant to the language team, which will review and decide on the PR/issue.
Consider the following (playpen):
main
compiles fine, as expected, since the associated type expands toi32
, which does not use the lifetime'a
that the mutable reference input argument is bound by.baz
however fails to compile (error message below), despite the additional constraint onOut
to be'static
, implying that the return value offoo
does not borrow the argument.This problem appears to be unique to unexpanded associated types, as they are the only case where the lifetime parameters do not directly determine the lifetime bounds on the type.
The text was updated successfully, but these errors were encountered: