-
Notifications
You must be signed in to change notification settings - Fork 13.3k
librustc: Improve method autoderef/deref/index behavior more, and enable IndexMut on mutable vectors. #17934
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@@ -453,12 +453,13 @@ impl<T> Index<uint,T> for Vec<T> { | |||
} | |||
|
|||
// FIXME(#12825) Indexing will always try IndexMut first and that causes issues. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should the fixme be removed?
(i took the liberty of revising your title and description so that hopefully bors will produce a saner result when it merges) |
FYI, the patch looks roughly right to me. Might be worth comparing the set of AST cases to mem-categorization code -- I think it should corresponding to ownership, basically. One thing that seems to be missing are some run-pass (and compile-fail) tests corresponding to these various cases. Best would probably be:
Some of these tests may exist from prior patches, of course. |
if i != 0 { | ||
match expr.node { | ||
ast::ExprIndex(ref base_expr, ref index_expr) => { | ||
drop(check::try_overloaded_index( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there a current reason for the explicit drop
here and below, or is that just carry-over from the previous version of the code? These calls to try
are returning Option<T>
, which is not marked as must_use
...
@pcwalton looks good, feel free to r=me after addressing the nits. |
406353c
to
cc859c7
Compare
`IndexMut` on mutable vectors. This fixes a bug whereby the mutability fixups for method behavior were not kicking in after autoderef failed to happen at any level. It also adds support for `Index` to the fixer-upper. Closes rust-lang#12825.
cc859c7
to
f7fb387
Compare
librustc: Improve method autoderef/deref/index behavior more, and enable IndexMut on mutable vectors. This fixes a bug whereby the mutability fixups for method behavior were not kicking in after autoderef failed to happen at any level. It also adds support for `Index` to the fixer-upper. Closes #12825. r? @pnkfelix
librustc: Improve method autoderef/deref/index behavior more, and enable IndexMut on mutable vectors.
This fixes a bug whereby the mutability fixups for method behavior were
not kicking in after autoderef failed to happen at any level. It also
adds support for
Index
to the fixer-upper.Closes #12825.
r? @pnkfelix