Dubious region behaviour affected by &_
annotations
#36082
Labels
A-lifetimes
Area: Lifetimes / regions
P-medium
Medium priority
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
T-lang
Relevant to the language team, which will review and decide on the PR/issue.
Meta
STR
This code compiles and runs successfully
But adding a
&_
type annotation causes a double borrow panic:Notes
"Specification-wise", the type annotation changing the code behaviour is rather dubious. The root cause is this gem of a function.
The behaviour is actually documented in the code:
That "common case" does not apply in today's Rust, of course.
Of course, changing this now would be a [breaking-change], but we are landing a similar significant change by @KiChjang (#36029). I will post my take of the rules on a rust-memory-model issue, because @ubsan nicely asked me to (maybe that should be on the RFCs repo instead?).
cc @nrc @pnkfelix @ubsan
The text was updated successfully, but these errors were encountered: