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

Partial future-proofing for Box<T, A> #50097

Merged
merged 5 commits into from
Apr 27, 2018
Merged

Commits on Apr 20, 2018

  1. Pass the right type to box_free() in MIR

    Currently, MIR just passes the raw Box to box_free(), which happens to
    work because practically, it's the same thing. But that might not be
    true in the future, with Box<T, A: Alloc>.
    
    The MIR inline pass actually fixes up the argument while inlining
    box_free, but this is not enabled by default and doesn't necessarily
    happen (the inline threshold needs to be passed).
    
    This change effectively moves what the MIR inline pass does to the
    elaborate_drops pass, so that box_free() is passed the raw pointer
    instead of the Box.
    glandium committed Apr 20, 2018
    Configuration menu
    Copy the full SHA
    43b24c6 View commit details
    Browse the repository at this point in the history
  2. Remove the explicit box_free type check

    Because box_free is now passed a pointer instead of a Box, we can stop
    relying on TypeChecked::check_box_free_inputs, because
    TypeChecker::check_call_inputs should be enough, like for all other
    function calls.
    
    It seems it was not actually reached anyways in cases where it would
    have made a difference. (issue rust-lang#50071)
    glandium committed Apr 20, 2018
    Configuration menu
    Copy the full SHA
    dfa6111 View commit details
    Browse the repository at this point in the history
  3. Support an alternative form for box_free

    box_free currently takes a pointer. With the prospect of the Box type
    definition changing in the future to include an allocator, box_free will
    also need to be aware of this. In order to prepare for that future, we
    allow box_free to take a form where its argument are the fields of the
    Box.
    
    e.g. if Box is defined as `Box(A, B, C)`, then box_free signature
    becomes `box_free(a: A, b: B, c: C)`.
    
    We however still allow the current form (taking a pointer), so that the
    same compiler can handle both forms, which helps with bootstrap.
    glandium committed Apr 20, 2018
    Configuration menu
    Copy the full SHA
    6614fa0 View commit details
    Browse the repository at this point in the history
  4. Adapt the owned_box lang item to allow a Box type with defaulted para…

    …meters
    
    A Box type with associated allocator would, on its own, be a backwards
    incompatible change, because of the additional parameter, but if that
    additional parameter has a default, then backwards compatibility with
    the current definition of the type is preserved.
    
    But the owned_box lang item currently doesn't allow such extra
    parameters, so add support for this.
    glandium committed Apr 20, 2018
    Configuration menu
    Copy the full SHA
    64f5233 View commit details
    Browse the repository at this point in the history

Commits on Apr 25, 2018

  1. Switch box_free to take the destructured contents of Box

    As of now, Box only contains a Unique pointer, so this is the sole
    argument to box_free. Consequently, we remove the code supporting
    the previous box_free signature. We however keep the old definition
    for bootstrapping purpose.
    glandium committed Apr 25, 2018
    Configuration menu
    Copy the full SHA
    bd8c177 View commit details
    Browse the repository at this point in the history