Skip to content
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

Lift: take self by value #78027

Merged
merged 2 commits into from
Oct 22, 2020
Merged

Lift: take self by value #78027

merged 2 commits into from
Oct 22, 2020

Conversation

lcnr
Copy link
Contributor

@lcnr lcnr commented Oct 16, 2020

seems small enough to not warrant an MCP 🤷

@rust-highfive
Copy link
Collaborator

r? @varkor

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 16, 2020
@lcnr
Copy link
Contributor Author

lcnr commented Oct 16, 2020

@bors try @rust-timer queue

@rust-timer
Copy link
Collaborator

Awaiting bors try build completion

@bors
Copy link
Contributor

bors commented Oct 16, 2020

⌛ Trying commit 76d5e7bb4d4c5b3978eaf3af2e625eaefa2dc135 with merge f146742c9e7558505ad9c399cba5e2ee05efa479...

@bors
Copy link
Contributor

bors commented Oct 16, 2020

☀️ Try build successful - checks-actions, checks-azure
Build commit: f146742c9e7558505ad9c399cba5e2ee05efa479 (f146742c9e7558505ad9c399cba5e2ee05efa479)

@rust-timer
Copy link
Collaborator

Queued f146742c9e7558505ad9c399cba5e2ee05efa479 with parent 5a51185, future comparison URL.

@rust-timer
Copy link
Collaborator

Finished benchmarking try commit (f146742c9e7558505ad9c399cba5e2ee05efa479): comparison url.

Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. Please note that if the perf results are neutral, you should likely undo the rollup=never given below by specifying rollup- to bors.

Importantly, though, if the results of this run are non-neutral do not roll this PR up -- it will mask other regressions or improvements in the roll up.

@bors rollup=never

@bjorn3
Copy link
Member

bjorn3 commented Oct 17, 2020

This is a very slight improvement in performance. (0.0%-0.1%)

@lcnr
Copy link
Contributor Author

lcnr commented Oct 17, 2020

yeah, I guess that's about as expected. Mostly think that taking self by value here is cleaner

@camelid camelid added the C-cleanup Category: PRs that clean code up or issues documenting cleanup. label Oct 17, 2020
@@ -686,7 +686,7 @@ impl<'cx, 'tcx> dataflow::ResultsVisitor<'cx, 'tcx> for MirBorrowckCtxt<'cx, 'tc
// "Lift" into the tcx -- once regions are erased, this type should be in the
// global arenas; this "lift" operation basically just asserts that is true, but
// that is useful later.
tcx.lift(&drop_place_ty).unwrap();
tcx.lift(drop_place_ty).unwrap();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Isn't this function call fairly useless now that we only have one global context?

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, I don't know what this did but it should be unnecessary. cc @nikomatsakis

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree it can be removed. As the comment states, its only purpose was a kind of assertion, and I think it no longer serves even that purpose.

Comment on lines 344 to 345
let (a, b, c) = self;
tcx.lift(a).and_then(|a| tcx.lift(b).and_then(|b| tcx.lift(c).map(|c| (a, b, c))))
Copy link
Member

Choose a reason for hiding this comment

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

If you're going to rewrite these, you can use ? nowadays.
E.g. Some((tcx.lift(a)?, tcx.lift(b)?, tcx.lift(c)?))

@eddyb
Copy link
Member

eddyb commented Oct 18, 2020

I have nothing against this change, FWIW.

@varkor
Copy link
Member

varkor commented Oct 21, 2020

Implementation looks fine to me. r=me after addressing the two comments.

@lcnr
Copy link
Contributor Author

lcnr commented Oct 21, 2020

@bors r=varkor

@bors
Copy link
Contributor

bors commented Oct 21, 2020

📌 Commit 17825c9 has been approved by varkor

@bors bors 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 Oct 21, 2020
@bors
Copy link
Contributor

bors commented Oct 21, 2020

⌛ Testing commit 17825c9 with merge c4fe25d...

@bors
Copy link
Contributor

bors commented Oct 22, 2020

☀️ Test successful - checks-actions, checks-azure
Approved by: varkor
Pushing c4fe25d to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Oct 22, 2020
@bors bors merged commit c4fe25d into rust-lang:master Oct 22, 2020
@rustbot rustbot added this to the 1.49.0 milestone Oct 22, 2020
@lcnr lcnr deleted the lift-by-value branch October 22, 2020 07:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-cleanup Category: PRs that clean code up or issues documenting cleanup. merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: 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.

10 participants