Skip to content

Remove the double auto-ref on arrays/strings as receivers #19761

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

Merged
merged 1 commit into from
Dec 17, 2014

Conversation

nrc
Copy link
Member

@nrc nrc commented Dec 12, 2014

Part of #18469

[breaking-change]

A receiver will only ever get a single auto-reference. Previously arrays and strings would get two, e.g., [T] would be auto-ref'ed to &&[T]. This is usually apparent when a trait is implemented for &[T] and has a method takes self by reference. The usual solution is to implement the trait for [T] (the DST form).

r? @nikomatsakis (or anyone else, really)

ty::ty_str | ty::ty_vec(_, None) => self.pick_autorefrefd_method(step),
_ => None
Some(result) => Some(result),
None => None
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This entire match is a noop, i.e. the pick_step method should just return self.pick_autorefd_method(step) (maybe in the None branch in the match above it?).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks, fixed

Part of rust-lang#18469

[breaking-change]

A receiver will only ever get a single auto-reference. Previously arrays and strings would get two, e.g., [T] would be auto-ref'ed to &&[T]. This is usually apparent when a trait is implemented for `&[T]` and has a method takes self by reference. The usual solution is to implement the trait for `[T]` (the DST form).
bors added a commit that referenced this pull request Dec 17, 2014
Part of #18469

[breaking-change]

A receiver will only ever get a single auto-reference. Previously arrays and strings would get two, e.g., [T] would be auto-ref'ed to &&[T]. This is usually apparent when a trait is implemented for `&[T]` and has a method takes self by reference. The usual solution is to implement the trait for `[T]` (the DST form).

r? @nikomatsakis (or anyone else, really)
@bors bors merged commit 769aa0a into rust-lang:master Dec 17, 2014
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants