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

Fix handling of empty types in patterns. #38069

Merged
merged 22 commits into from
Jan 6, 2017

Commits on Jan 3, 2017

  1. Start enabling empty types in pattern matching.

    Remove the assumption at the start of is_useful that any suitably-long array of
    wildcard patterns is useful relative the any empty vector. Instead we just
    continue to recurse column-wise over the matrix.
    
    This assumption is false in the presence of empty types.
    eg. in the simplest case:
    
    let x: ! = ...;
    match x {
        // This pattern should not be considered useful by the algorithm
        _   => ...
    }
    canndrew committed Jan 3, 2017
    Configuration menu
    Copy the full SHA
    9ad2044 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    bcdbe94 View commit details
    Browse the repository at this point in the history
  3. More pattern matching for empty types changes

    Fix is_uninhabited for enum types. It used to assume that an enums variant's
    fields were all private.
    
    Fix MIR generation for irrefutable Variant pattern matches. This allows code
    like this to work:
    
        let x: Result<32, !> = Ok(123);
        let Ok(y) = x;
    
    Carry type information on dummy wildcard patterns. Sometimes we need to expand
    these patterns into their constructors and we don't want to be expanding a
    TyError into a Constructor::Single.
    canndrew committed Jan 3, 2017
    Configuration menu
    Copy the full SHA
    9c5e86d View commit details
    Browse the repository at this point in the history
  4. Improve error message, fix and add tests.

    Changes the non-exhaustive match error message to generate more general
    witnesses.
    canndrew committed Jan 3, 2017
    Configuration menu
    Copy the full SHA
    9ba9cd5 View commit details
    Browse the repository at this point in the history
  5. Style fix

    canndrew committed Jan 3, 2017
    Configuration menu
    Copy the full SHA
    cfc45d5 View commit details
    Browse the repository at this point in the history
  6. Fix build after rebase

    canndrew committed Jan 3, 2017
    Configuration menu
    Copy the full SHA
    d2827aa View commit details
    Browse the repository at this point in the history
  7. Fix build after rebase

    canndrew committed Jan 3, 2017
    Configuration menu
    Copy the full SHA
    56f355c View commit details
    Browse the repository at this point in the history
  8. Fix test I broke

    canndrew committed Jan 3, 2017
    Configuration menu
    Copy the full SHA
    f8c4d10 View commit details
    Browse the repository at this point in the history
  9. Add drain method to AccumulateVec/ArrayVec

    You can now call .drain(..) on SmallVec, AccumulateVec and ArrayVec
    canndrew committed Jan 3, 2017
    Configuration menu
    Copy the full SHA
    9482492 View commit details
    Browse the repository at this point in the history
  10. Refactor is_uninhabited

    We now cache the inhabitedness of types in the GlobalCtxt.
    
    Rather than calculating whether a type is visibly uninhabited from a given
    NodeId we calculate the full set of NodeIds from which a type is visibly
    uninhabited then cache that set. We can then use that to answer queries about
    the inhabitedness of a type relative to any given node.
    canndrew committed Jan 3, 2017
    Configuration menu
    Copy the full SHA
    7946597 View commit details
    Browse the repository at this point in the history
  11. Fix inhabitedness bug

    canndrew committed Jan 3, 2017
    Configuration menu
    Copy the full SHA
    44a70f0 View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    5ba61ed View commit details
    Browse the repository at this point in the history
  13. Amend compile-fail tests

    canndrew committed Jan 3, 2017
    Configuration menu
    Copy the full SHA
    a157082 View commit details
    Browse the repository at this point in the history
  14. Remove E0001 diagnostic

    canndrew committed Jan 3, 2017
    Configuration menu
    Copy the full SHA
    4136ba0 View commit details
    Browse the repository at this point in the history
  15. Fix build after rebase.

    Mostly just rename stuff.
    Visibility checks use DefIds rather than NodeIds now.
    canndrew committed Jan 3, 2017
    Configuration menu
    Copy the full SHA
    9f83e96 View commit details
    Browse the repository at this point in the history
  16. fix comment that got split in two

    nikomatsakis authored and canndrew committed Jan 3, 2017
    Configuration menu
    Copy the full SHA
    699b25f View commit details
    Browse the repository at this point in the history
  17. Spelling. s/forrest/forest

    canndrew committed Jan 3, 2017
    Configuration menu
    Copy the full SHA
    e9ffc40 View commit details
    Browse the repository at this point in the history
  18. Configuration menu
    Copy the full SHA
    f947890 View commit details
    Browse the repository at this point in the history
  19. Fix make tidy

    canndrew committed Jan 3, 2017
    Configuration menu
    Copy the full SHA
    c0cd145 View commit details
    Browse the repository at this point in the history

Commits on Jan 4, 2017

  1. Fix build after rebase

    canndrew committed Jan 4, 2017
    Configuration menu
    Copy the full SHA
    70b7bd9 View commit details
    Browse the repository at this point in the history

Commits on Jan 5, 2017

  1. Configuration menu
    Copy the full SHA
    291c84a View commit details
    Browse the repository at this point in the history
  2. fix doc test for E0001

    canndrew committed Jan 5, 2017
    Configuration menu
    Copy the full SHA
    275c19d View commit details
    Browse the repository at this point in the history