-
Notifications
You must be signed in to change notification settings - Fork 13.4k
fn foo(&mut self)
with a &mut [T]
called with x.foo()
copies the x
slice instead of passing by reference
#19147
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
Oops, left out the output:
|
This seems to be a recent regression, but I'm not quite sure where yet. Method resolution seems to be resolving as I expect, so it could be a trans error, but I'm not sure yet. |
I realized that this is in fact the fault of the method resolution. The problem is that we always 'reborrow' -- we should only do that when not auto-refing. |
Nominating, this bug has to get fixed. (Luckily it's easy, just don't want to forget.) |
P-backcompat-lang, 1.0. fix enqueued. |
**First commit.** Patch up debruijn indices. Fixes #19537. **Second commit.** Stop reborrowing so much. Fixes #19147. Fixes #19261. r? @nick29581
Here's an example:
This prints out the following output. You can see that using the
writer.my_write(...)
form passes in a differentself
address for each call, whereas explicitly using a&mut writer
passes in the same address.cc @nikomatsakis and @aturon. Niko on irc was suspecting this might be related to auto-ref-ref.
The text was updated successfully, but these errors were encountered: