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

Object lifetime defaults (RFC 599) #22230

Merged
merged 8 commits into from
Feb 16, 2015

Commits on Feb 16, 2015

  1. Configuration menu
    Copy the full SHA
    931a3c4 View commit details
    Browse the repository at this point in the history
  2. Various simplifications and renamings based on the fact that old-scho…

    …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.
    nikomatsakis committed Feb 16, 2015
    Configuration menu
    Copy the full SHA
    f5c6a23 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    80d1f14 View commit details
    Browse the repository at this point in the history
  4. Factor out the "region substs" creation to occur earlier, so that the

    complete set of regions are available when converting types.
    nikomatsakis committed Feb 16, 2015
    Configuration menu
    Copy the full SHA
    ab57988 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    369adaf View commit details
    Browse the repository at this point in the history
  6. Fix fallout in libsyntax from RFC 599. Clarity and efficiency seems t…

    …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 committed Feb 16, 2015
    Configuration menu
    Copy the full SHA
    f58a1bf View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    d0ef166 View commit details
    Browse the repository at this point in the history
  8. Address nits by @pnkfelix

    nikomatsakis committed Feb 16, 2015
    Configuration menu
    Copy the full SHA
    503e15b View commit details
    Browse the repository at this point in the history