-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Object lifetime defaults (RFC 599) #22230
Merged
bors
merged 8 commits into
rust-lang:master
from
nikomatsakis:object-lifetime-defaults-2
Feb 16, 2015
Merged
Object lifetime defaults (RFC 599) #22230
bors
merged 8 commits into
rust-lang:master
from
nikomatsakis:object-lifetime-defaults-2
Feb 16, 2015
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
r? @pnkfelix (rust_highfive has picked a reviewer for you, use r? to override) |
nikomatsakis
force-pushed
the
object-lifetime-defaults-2
branch
from
February 13, 2015 14:47
d4d7820
to
89ef49e
Compare
Rebased. |
@nikomatsakis okay, r=me . I had a couple absurdly minor nits, but really, you could probably just land this. |
…ol closures are gone and type parameters can now have multiple region bounds (and hence use a different path). Should have no effect on the external behavior of the compiler.
complete set of regions are available when converting types.
…o be mostly improved, to my eye. Nonetheless, as this commit demonstrates, the previous commits was a [breaking-change]. In practice, breakage is focused on functions of this form: ```rust fn foo(..., object: Box<FnMut()>) ```` where `FnMut()` could be any trait object type. The older scheme defaulted objects in argument position so that they were bounded by a fresh lifetime: ```rust fn foo<'a>(..., object: Box<FnMut()+'a>) ``` This meant that the object could contain borrowed data. The newer scheme defaults to a lifetime bound of `'static`: ```rust fn foo(..., object: Box<FnMut()+'static>) ``` This means that the object cannot contain borrowed data. In some cases, the best fix is to stop using `Box`: ```rust fn foo(..., object: &mut FnMut()) ``` but another option is to write an explicit annotation for the `'a` lifetime that used to be implicit. Both fixes are demonstrated in this commit.
nikomatsakis
force-pushed
the
object-lifetime-defaults-2
branch
from
February 16, 2015 16:59
89ef49e
to
503e15b
Compare
bors
added a commit
that referenced
this pull request
Feb 16, 2015
…felix Implement rules described in rust-lang/rfcs#599. Fixes #22211. ~~Based atop PR #22182, so the first few commits (up to and including "Pacify the mercilous nrc") have already been reviewed.~~
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Implement rules described in rust-lang/rfcs#599.
Fixes #22211.
Based atop PR #22182, so the first few commits (up to and including "Pacify the mercilous nrc") have already been reviewed.