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

MIR borrowck: finalize `check_access_permissions()` #46041

Merged
merged 3 commits into from Nov 30, 2017

Conversation

Projects
None yet
5 participants
@zilbuz
Contributor

zilbuz commented Nov 16, 2017

Fix #44837 (hopefully for good)

r? @arielb1

@arielb1

This comment has been minimized.

Show comment
Hide comment
@arielb1

arielb1 Nov 16, 2017

Contributor

Commented. Need to leave for today.

Contributor

arielb1 commented Nov 16, 2017

Commented. Need to leave for today.

@bors

This comment has been minimized.

Show comment
Hide comment
@bors

bors Nov 16, 2017

Contributor

☔️ The latest upstream changes (presumably #45825) made this pull request unmergeable. Please resolve the merge conflicts.

Contributor

bors commented Nov 16, 2017

☔️ The latest upstream changes (presumably #45825) made this pull request unmergeable. Please resolve the merge conflicts.

@zilbuz

This comment has been minimized.

Show comment
Hide comment
@zilbuz

zilbuz Nov 17, 2017

Contributor

@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.

Contributor

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.

@zilbuz zilbuz changed the title from [WIP] MIR borrowck: finalize `check_access_permissions()` to MIR borrowck: finalize `check_access_permissions()` Nov 25, 2017

@zilbuz

This comment has been minimized.

Show comment
Hide comment
@zilbuz

zilbuz Nov 25, 2017

Contributor

@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

struct Foo { x: [usize; 2] }

static mut SFOO: Foo = Foo { x: [23, 32] };

impl Foo {
    fn x(&mut self) -> &mut usize { &mut self.x[0] }
}

fn main() {
    unsafe {
        let sfoo: *mut Foo = &mut SFOO;
        let x = (*sfoo).x();
        (*sfoo).x[1] += 1;
        *x += 1;
    }
}

The delay_span_bug() in check_access_permissions() is triggered for sfoo with Write(StorageDeadOrDrop): https://github.com/rust-lang/rust/pull/46041/files#diff-e91f32610bea593e68f8e93f87419a29R1048

How should I fix this? Is the Write(StorageDeadOrDrop) authorized in certain cases?

Contributor

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

struct Foo { x: [usize; 2] }

static mut SFOO: Foo = Foo { x: [23, 32] };

impl Foo {
    fn x(&mut self) -> &mut usize { &mut self.x[0] }
}

fn main() {
    unsafe {
        let sfoo: *mut Foo = &mut SFOO;
        let x = (*sfoo).x();
        (*sfoo).x[1] += 1;
        *x += 1;
    }
}

The delay_span_bug() in check_access_permissions() is triggered for sfoo with Write(StorageDeadOrDrop): https://github.com/rust-lang/rust/pull/46041/files#diff-e91f32610bea593e68f8e93f87419a29R1048

How should I fix this? Is the Write(StorageDeadOrDrop) authorized in certain cases?

@arielb1

This comment has been minimized.

Show comment
Hide comment
@arielb1

arielb1 Nov 25, 2017

Contributor

@zilbuz

That's weird because the delay_span_bug should only occur for non-mut statics, and I don't see any non-mut static in this code.

Contributor

arielb1 commented Nov 25, 2017

@zilbuz

That's weird because the delay_span_bug should only occur for non-mut statics, and I don't see any non-mut static in this code.

@arielb1

This comment has been minimized.

Show comment
Hide comment
@arielb1

arielb1 Nov 25, 2017

Contributor

Oops wrong delay_span_bug. However, I think I found the problem.

Contributor

arielb1 commented Nov 25, 2017

Oops wrong delay_span_bug. However, I think I found the problem.

@zilbuz

This comment has been minimized.

Show comment
Hide comment
@zilbuz

zilbuz Nov 26, 2017

Contributor

@arielb1 I added LocalMutationIsAllowed::Yes for the access_lvalue() calls in visit_terminator_entry(): https://github.com/rust-lang/rust/pull/46041/files#diff-e91f32610bea593e68f8e93f87419a29R397

Contributor

zilbuz commented Nov 26, 2017

@arielb1 I added LocalMutationIsAllowed::Yes for the access_lvalue() calls in visit_terminator_entry(): https://github.com/rust-lang/rust/pull/46041/files#diff-e91f32610bea593e68f8e93f87419a29R397

@bors

This comment has been minimized.

Show comment
Hide comment
@bors

bors Nov 26, 2017

Contributor

☔️ The latest upstream changes (presumably #46106) made this pull request unmergeable. Please resolve the merge conflicts.

Contributor

bors commented Nov 26, 2017

☔️ The latest upstream changes (presumably #46106) made this pull request unmergeable. Please resolve the merge conflicts.

@arielb1

This comment has been minimized.

Show comment
Hide comment
@arielb1

arielb1 Nov 27, 2017

Contributor

@bors r+

Contributor

arielb1 commented Nov 27, 2017

@bors r+

@bors

This comment has been minimized.

Show comment
Hide comment
@bors

bors Nov 27, 2017

Contributor

📌 Commit abd07b7 has been approved by arielb1

Contributor

bors commented Nov 27, 2017

📌 Commit abd07b7 has been approved by arielb1

@bors

This comment has been minimized.

Show comment
Hide comment
@bors

bors Nov 27, 2017

Contributor

☔️ The latest upstream changes (presumably #46022) made this pull request unmergeable. Please resolve the merge conflicts.

Contributor

bors commented Nov 27, 2017

☔️ The latest upstream changes (presumably #46022) made this pull request unmergeable. Please resolve the merge conflicts.

@bors

This comment has been minimized.

Show comment
Hide comment
@bors

bors Nov 28, 2017

Contributor

☔️ The latest upstream changes (presumably #46312) made this pull request unmergeable. Please resolve the merge conflicts.

Contributor

bors commented Nov 28, 2017

☔️ The latest upstream changes (presumably #46312) made this pull request unmergeable. Please resolve the merge conflicts.

@arielb1

This comment has been minimized.

Show comment
Hide comment
@arielb1

arielb1 Nov 29, 2017

Contributor

@bors r+

Contributor

arielb1 commented Nov 29, 2017

@bors r+

@bors

This comment has been minimized.

Show comment
Hide comment
@bors

bors Nov 29, 2017

Contributor

📌 Commit 1cd9d74 has been approved by arielb1

Contributor

bors commented Nov 29, 2017

📌 Commit 1cd9d74 has been approved by arielb1

@bors

This comment has been minimized.

Show comment
Hide comment
@bors

bors Nov 30, 2017

Contributor

⌛️ Testing commit 1cd9d74 with merge 909b94b...

Contributor

bors commented Nov 30, 2017

⌛️ Testing commit 1cd9d74 with merge 909b94b...

bors added a commit that referenced this pull request Nov 30, 2017

Auto merge of #46041 - zilbuz:issue-44837, r=arielb1
MIR borrowck: finalize `check_access_permissions()`

Fix #44837 (hopefully for good)

r? @arielb1
@bors

This comment has been minimized.

Show comment
Hide comment
@bors

bors Nov 30, 2017

Contributor

☀️ Test successful - status-appveyor, status-travis
Approved by: arielb1
Pushing 909b94b to master...

Contributor

bors commented Nov 30, 2017

☀️ Test successful - status-appveyor, status-travis
Approved by: arielb1
Pushing 909b94b to master...

@bors bors merged commit 1cd9d74 into rust-lang:master Nov 30, 2017

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details

@zilbuz zilbuz deleted the zilbuz:issue-44837 branch Jan 15, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment