Skip to content

For box expressions, use NZ drop instead of a free block - #43772

Merged
bors merged 1 commit into
rust-lang:masterfrom
arielb1:nonfree-block
Aug 12, 2017
Merged

For box expressions, use NZ drop instead of a free block#43772
bors merged 1 commit into
rust-lang:masterfrom
arielb1:nonfree-block

Conversation

@arielb1

Copy link
Copy Markdown
Contributor

This falls naturally out of making drop elaboration work with box
expressions, which is probably required for sane MIR borrow-checking.
This is a pure refactoring with no intentional functional effects.

r? @nagisa

@aidanhsaidanhs added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 10, 2017
This falls naturally out of making drop elaboration work with `box`
expressions, which is probably required for sane MIR borrow-checking.
This is a pure refactoring with no intentional functional effects.
}

fn build_diverge_scope<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>,
fn build_diverge_scope<'a, 'gcx, 'tcx>(_tcx: TyCtxt<'a, 'gcx, 'tcx>,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I would go ahead and remove this parameter.

@nagisa

Copy link
Copy Markdown
Member

@bors r+

Feel free to bors r=nagisa if you fix the nit yourself.

@bors

bors commented Aug 10, 2017

Copy link
Copy Markdown
Collaborator

📌 Commit 17d2bcd has been approved by nagisa

@Mark-SimulacrumMark-Simulacrum added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 10, 2017
@bors

bors commented Aug 12, 2017

Copy link
Copy Markdown
Collaborator

⌛ Testing commit 17d2bcd with merge b8266a9...

bors added a commit that referenced this pull request Aug 12, 2017
For box expressions, use NZ drop instead of a free block
This falls naturally out of making drop elaboration work with `box`
expressions, which is probably required for sane MIR borrow-checking.
This is a pure refactoring with no intentional functional effects.
r? @nagisa
@bors

bors commented Aug 12, 2017

Copy link
Copy Markdown
Collaborator

☀️ Test successful - status-appveyor, status-travis
Approved by: nagisa
Pushing b8266a9 to master...

@bors
bors merged commit 17d2bcd into rust-lang:masterAug 12, 2017
@borsbors mentioned this pull request Aug 12, 2017
7 tasks
@oli-obk

oli-obk commented Aug 14, 2017

Copy link
Copy Markdown
Contributor

I think this caused let x = box 4i32; to no longer produce a StorageLive for the temporary used to assign x.

fn main() -> () {
let mut _0: (); // return pointer
scope 1 {
let _1: std::boxed::Box<i32>; // "x" in scope 1 at src/main.rs:4:9: 4:10
}
let mut _2: std::boxed::Box<i32>;
bb0: {
StorageLive(_1); // scope 0 at src/main.rs:4:9: 4:10
_2 = Box(i32); // scope 0 at src/main.rs:4:13: 4:21
(*_2) = const 4i32; // scope 0 at src/main.rs:4:17: 4:21
_1 = _2; // scope 0 at src/main.rs:4:13: 4:21
StorageDead(_2); // scope 0 at src/main.rs:4:21: 4:21
_0 = (); // scope 0 at src/main.rs:3:11: 5:2
drop(_1) -> bb1; // scope 0 at src/main.rs:5:2: 5:2
}
bb1: {
StorageDead(_1); // scope 0 at src/main.rs:5:2: 5:2
return; // scope 0 at src/main.rs:5:2: 5:2
}
}

Is this intended?

@arielb1

Copy link
Copy Markdown
ContributorAuthor

Is this intended?

No.

@arielb1

Copy link
Copy Markdown
ContributorAuthor

I think the difference is that we started emitting StorageDead, rather than stopping emitting StorageLive.

bors added a commit that referenced this pull request Aug 15, 2017
emit StorageLive for box temporaries
We started emitting StorageDead, so we better emit the corrseponding
StorageLive to avoid problems.
cc #43772rust-lang/miri#303
@ghostghost mentioned this pull request Aug 17, 2017
frewsxcv added a commit to frewsxcv/rust that referenced this pull request Aug 17, 2017
refactor(mir): remove unused argument
Small cleanup that shouldn't have any impact, as it's a small thing introduced in rust-lang#43772
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-borsStatus: Waiting on bors to run and complete tests. Bors will change the label on completion.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants

@arielb1@nagisa@bors@oli-obk@aidanhs@Mark-Simulacrum