-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
Segfault in safe code: Index trait sugar v[i] ignores the borrow checker #15525
Comments
Nominating. |
It may be of interest to compare against our behavior from version 0.10 on what I believe to be an analogous program (using In particular, I want to point out that some comments in the issue description do not match my intuition based on prior behavior on vectors: it should not be surprising that What is surprising is that this program compiles. The borrow checker in principle should be rejecting it. Presumably proper integration between the |
The
Was the |
|
If that's the case, then this should not compile because that would be a partial move out of a borrowed vector. (as @pnkfelix pointed) I was under the impression that I'll update the issue description. |
Assigning P-backcompat-lang, 1.0 milestone. |
Closes #15525 The important bit of this are the changes from line 445 in mem_categorization.rs. Most of the other changes are about adding an Implicit PointerKind, and this is only necessary for getting a decent error message :-s An alternative would have been to add an implciti/explicit flag to cat_deref, which could be mostly ignored and so would mean much fewer changes. However, the implicit state would only be valid if the PointerKind was BorrowedPtr, so it felt like it ought to be another kind of PointerKind. I still don't know which is the better design.
STR:
Output:
GDB:
Version:
cc @pcwalton
The text was updated successfully, but these errors were encountered: