Lifetime issues: assigning to a mutable reference with part of its current value #72477
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.
Edit: simplified reproducer as well as workaround available at #72477 (comment)
Hello,
While trying to implement an AsyncRead wrapper, I have hit something that I think is the borrow-checker being too restrictive with
&mut
insidePin
.I originally thought it was an issue in
pin-project
, but @taiki-e pointed out that the issue also happens with rawPin
, in taiki-e/pin-project#226 (comment) (thank you!)Copying the example here (with an explicit lifetime):
(playground)
This is potentially related to #54934 ; but seeing as it manifests in a completely different way (ie. it doesn't manifest with just
&
references in the original example with pin-project linked above, though the example code here is incorrect indeed), I thought it'd be better to open another issue, as at worst it'd be fixed at the same time as #54934 and would just add another test.As usual, thank you for all you do on this great language!
The text was updated successfully, but these errors were encountered: