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

Remove unnecessary uses of #[no_move] #8286

Merged
merged 1 commit into from Nov 8, 2015
Merged

Conversation

@eefriedman
Copy link
Contributor

eefriedman commented Oct 31, 2015

The patch makes RootCollection a bit safer by making the StackRootTLS hold
it in place.

RootedVec was doing an extremely delicate dance and just hoping nobody
messed it up; switch to a Box to be safe.

CodeGenRust seemed to be using no_move for no particularly good reason.

Review on Reviewable

@highfive
Copy link

highfive commented Oct 31, 2015

warning Warning warning

  • These commits modify unsafe code. Please review it carefully!
@jdm
Copy link
Member

jdm commented Oct 31, 2015

no_move is a lint from rust-tenacious, according to the original commit: 63714eb

@eefriedman
Copy link
Contributor Author

eefriedman commented Oct 31, 2015

Oh... huh. I completely missed that; I expected all the lints to be in components/plugins/lints.

In that case, it might make sense to leave RootedVec as-is for the moment. The other changes still make sense, I think?

@eefriedman eefriedman changed the title `#[no_move]` no longer exists; get rid of the remnants. Remove unnecessary uses of #[no_move] Nov 1, 2015
@Manishearth
Copy link
Member

Manishearth commented Nov 1, 2015

no_move is no longer necessary for Root (which was its original use, but it's been removed from there now), but IIRC it's very necessary for RootedVec. Not sure about RootedCollection.

I'm wary of changing RootedVec without a discussion with nox and Ms2ger, it's a very delicate API.

Removing the no_move from bindings makes sense though, not sure how that got there.

cc @nox

@nox
Copy link
Member

nox commented Nov 1, 2015

RootedVec definitely still needs no_move, cf. #8159 (comment) where I tried to move one and got a panic at runtime.

@nox
Copy link
Member

nox commented Nov 1, 2015

@Manishearth It's weird that tenacious didn't catch that specific piece of code, btw.

@Manishearth
Copy link
Member

Manishearth commented Nov 1, 2015

@nox tenacious only handles some cases, the issue is that Rust optimizes most moves into noops, but not always (actual in-memory move and compile-time "moved variable" are different), so to keep the lint from being extremely noisy the cases where it's usually optimized aren't really handled.

@nox
Copy link
Member

nox commented Nov 1, 2015

@Manishearth Yeah I understand that, but is RVO ever done to return from plain old code blocks, as opposed to function blocks?

@Manishearth
Copy link
Member

Manishearth commented Nov 1, 2015

It should be.

It's easy enough to check for though, just add a check_block to no_move that ensures the retval isn't a nomove type.

@eefriedman
Copy link
Contributor Author

eefriedman commented Nov 1, 2015

I'm pretty sure the version of RootedVec without no_move in this PR is safe... it's just a bit slower because of the extra heap allocation.

@Manishearth
Copy link
Member

Manishearth commented Nov 2, 2015

r? @nox

@nox
Copy link
Member

nox commented Nov 3, 2015

I would rather keep RootedVec no_move and not behind a Box.

@eefriedman eefriedman force-pushed the eefriedman:no-move branch from bec1161 to 7ab93da Nov 3, 2015
@eefriedman
Copy link
Contributor Author

eefriedman commented Nov 3, 2015

@nox Updated.

@nox
Copy link
Member

nox commented Nov 7, 2015

You forgot to remove "Misc cleanups around RootedVec." from the commit message. Otherwise, LGTM.

For reference, codegen used to mark dictionary structures as not movable because they can contain roots, which used to not be movable either.

-S-awaiting-review +S-needs-code-changes


Reviewed 5 of 5 files at r1.
Review status: all files reviewed at latest revision, all discussions resolved.


Comments from the review on Reviewable.io

The patch makes RootCollection a bit safer by making the StackRootTLS hold
it in place.

The use of no_move in CodeGenRust was leftover from when roots couldn't
be moved.
@eefriedman eefriedman force-pushed the eefriedman:no-move branch from 7ab93da to 1a50fce Nov 8, 2015
@eefriedman
Copy link
Contributor Author

eefriedman commented Nov 8, 2015

@bors-servo r=nox

@bors-servo
Copy link
Contributor

bors-servo commented Nov 8, 2015

📌 Commit 1a50fce has been approved by nox

@bors-servo
Copy link
Contributor

bors-servo commented Nov 8, 2015

Testing commit 1a50fce with merge 45a1cb0...

bors-servo added a commit that referenced this pull request Nov 8, 2015
Remove unnecessary uses of #[no_move]

The patch makes RootCollection a bit safer by making the StackRootTLS hold
it in place.

RootedVec was doing an extremely delicate dance and just hoping nobody
messed it up; switch to a Box to be safe.

CodeGenRust seemed to be using no_move for no particularly good reason.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/8286)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Nov 8, 2015

💔 Test failed - android

@eefriedman
Copy link
Contributor Author

eefriedman commented Nov 8, 2015

@bors-servo retry (weird one-time Android build failure)

bors-servo added a commit that referenced this pull request Nov 8, 2015
Remove unnecessary uses of #[no_move]

The patch makes RootCollection a bit safer by making the StackRootTLS hold
it in place.

RootedVec was doing an extremely delicate dance and just hoping nobody
messed it up; switch to a Box to be safe.

CodeGenRust seemed to be using no_move for no particularly good reason.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/8286)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Nov 8, 2015

Testing commit 1a50fce with merge 92f9e58...

@bors-servo
Copy link
Contributor

bors-servo commented Nov 8, 2015

@bors-servo bors-servo merged commit 1a50fce into servo:master Nov 8, 2015
3 checks passed
3 checks passed
code-review/reviewable Review complete: all files reviewed, all discussions resolved
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

6 participants
You can’t perform that action at this time.