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

Handle bindings in substructure of patterns with type ascriptions #55274

Merged

Commits on Oct 26, 2018

  1. Remove PlaceContext from API of mir::Visitor::visit_projection_elem.

    It is unused, and would not make sense to maintain in the commits later in this PR.
    pnkfelix committed Oct 26, 2018
    Configuration menu
    Copy the full SHA
    26c4069 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    54681b0 View commit details
    Browse the repository at this point in the history
  3. Refactoring: added PatternTypeAnnotation wrapper around `UserTypeAn…

    …notation` to ease future changes.
    pnkfelix committed Oct 26, 2018
    Configuration menu
    Copy the full SHA
    36d8432 View commit details
    Browse the repository at this point in the history
  4. Added mir::UserTypeProjection, a stub for a structure that projects…

    … *into* a given UserTypeAnnotation.
    
    (That is, it will pull out some component type held or referenced by
    the type annotation.)
    
    Note: this still needs to actually do projection itself. That comes in
    a later commit
    pnkfelix committed Oct 26, 2018
    Configuration menu
    Copy the full SHA
    28ce99d View commit details
    Browse the repository at this point in the history
  5. Checkpoint: Added abstraction over collection of projections into use…

    …r type.
    
    I did not think I would need this in the MIR, but in general local
    decls are going to need to support this. (That, or we need to be able
    define a least-upper-bound for a collection of types encountered via
    the pattern compilation.)
    pnkfelix committed Oct 26, 2018
    Configuration menu
    Copy the full SHA
    b569caf View commit details
    Browse the repository at this point in the history
  6. Add the actual chain of projections to UserTypeProjection.

    Update the existing NLL `patterns.rs` test accordingly.
    
    includes changes addressing review feedback:
    
     * Added example to docs for `UserTypeProjections` illustrating how we
       build up multiple projections when descending into a pattern with
       type ascriptions.
    
     * Adapted niko's suggested docs for `UserTypeProjection`.
    
     * Factored out `projection_ty` from more general `projection_ty_core`
       (as a drive-by, made its callback an `FnMut`, as I discovered later
       that I need that).
    
     * Add note to docs that `PlaceTy.field_ty(..)` does not normalize its result.
    
     * Normalize as we project out `field_ty`.
    pnkfelix committed Oct 26, 2018
    Configuration menu
    Copy the full SHA
    740e8a3 View commit details
    Browse the repository at this point in the history
  7. Update mir-opt tests to reflect change to AscribeUserType to carry …

    …a `UserTypeProjection`.
    pnkfelix committed Oct 26, 2018
    Configuration menu
    Copy the full SHA
    7e76196 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    f09a0eb View commit details
    Browse the repository at this point in the history
  9. Add test for normalization during field-lookup on patterns with ascri…

    …bed types.
    
    As a drive-by, also added test analogous to existing
    static_to_a_to_static_through_tuple, but now apply to a struct instead
    of a tuple.
    pnkfelix committed Oct 26, 2018
    Configuration menu
    Copy the full SHA
    92cbe47 View commit details
    Browse the repository at this point in the history
  10. Add intern table for List<ProjectionElem<'tcx, (), ()>>.

    Also added alias `ProjectionKind<'tcx>` for `ProjectionElem<'tcx, (), ()>`.
    pnkfelix committed Oct 26, 2018
    Configuration menu
    Copy the full SHA
    47e2d82 View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    82ab668 View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    639a3ff View commit details
    Browse the repository at this point in the history