Uh oh!
There was an error while loading. Please reload this page.
MIR borrowck: finalize check_access_permissions() - #46041
Conversation
There was a problem hiding this comment.
This should be a delay_span_bug if this would cause an error - all 3 of these cases indicate an erroneous program.
There was a problem hiding this comment.
This function checks for mutation of locals anyway, so it should always pass LocalMutationIsAllowed::Yes to avoid double errors.
There was a problem hiding this comment.
it is 100% OK to move out of an immutable local - this should be a yes.
There was a problem hiding this comment.
dropandreplace is an assignment of a type with a destructor, so this should be an error only if the value is already initialized.
This is a read, ignore all of this.
arielb1
commented
Nov 16, 2017
Commented. Need to leave for today. |
bors
commented
Nov 16, 2017
☔ The latest upstream changes (presumably #45825) made this pull request unmergeable. Please resolve the merge conflicts. |
zilbuz
commented
Nov 17, 2017
@arielb1 Sorry I won't be available for the rest of the week and I didn't have the time to finalize my PR. I have some changes corresponding to your comments but not yet pushed. Some tests aren't passing. If this is blocking feel free to take the PR and finalize it yourself. Otherwise I'll finish it sunday or monday evening. |
There was a problem hiding this comment.
Nit: can you add a comment explaining what this flag is about?
d3135c6 to
d4cc8b0Comparecheck_access_permissions()check_access_permissions()zilbuz
commented
Nov 25, 2017
@nikomatsakis@arielb1 There is an ICE on the following test: https://github.com/rust-lang/rust/blob/master/src/test/run-pass/borrowck/borrowck-unsafe-static-mutable-borrows.rs structFoo{x:[usize;2]}staticmutSFOO:Foo = Foo{x:[23,32]};implFoo{fnx(&mutself) -> &mutusize{&mutself.x[0]}}fnmain(){unsafe{let sfoo:*mutFoo = &mutSFOO;let x = (*sfoo).x();(*sfoo).x[1] += 1;*x += 1;}}The How should I fix this? Is the |
|
There was a problem hiding this comment.
- I think you're missing a check for whether the access is actually permitted, similarly to the previous lines. i.e. an
ifletErr(lvalue_err) = self.is_mutable(lvalue, is_local_mutation_allowed){- There's no reason to use pretty-printing in
delay_span_bug- it can hide information and it just makes the code uglier. Just format the lvalue directly (format!("Accessing {:?} with the kind{:?}shouldn't be possible", lvalue, kind)).
There was a problem hiding this comment.
There's no reason to use pretty-printing in delay_span_bug - it can hide information and it just makes the code uglier. Just format the lvalue directly (format!("Accessing {:?} with the kind {:?} shouldn't be possible", lvalue, kind)).
arielb1
commented
Nov 25, 2017
Oops wrong |
65b5a73 to
4bd53aeComparezilbuz
commented
Nov 26, 2017
@arielb1 I added |
bors
commented
Nov 26, 2017
☔ The latest upstream changes (presumably #46106) made this pull request unmergeable. Please resolve the merge conflicts. |
arielb1
commented
Nov 27, 2017
@bors r+ |
bors
commented
Nov 27, 2017
📌 Commit abd07b7 has been approved by |
bors
commented
Nov 27, 2017
☔ The latest upstream changes (presumably #46022) made this pull request unmergeable. Please resolve the merge conflicts. |
bors
commented
Nov 28, 2017
☔ The latest upstream changes (presumably #46312) made this pull request unmergeable. Please resolve the merge conflicts. |
arielb1
commented
Nov 29, 2017
@bors r+ |
bors
commented
Nov 29, 2017
📌 Commit 1cd9d74 has been approved by |
bors
commented
Nov 30, 2017
bors
commented
Nov 30, 2017
☀️ Test successful - status-appveyor, status-travis |
Fix#44837 (hopefully for good)
r? @arielb1