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

Add lint for never type regressions #68350

Closed
wants to merge 25 commits into from

Commits on Jan 17, 2020

  1. Configuration menu
    Copy the full SHA
    da33dc0 View commit details
    Browse the repository at this point in the history
  2. Emit warning

    Aaron1011 committed Jan 17, 2020
    Configuration menu
    Copy the full SHA
    0c49893 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    3a22be9 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    d0dc1e3 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    ebf1918 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    5253bb6 View commit details
    Browse the repository at this point in the history
  7. Tweak error message

    Aaron1011 committed Jan 17, 2020
    Configuration menu
    Copy the full SHA
    087af85 View commit details
    Browse the repository at this point in the history
  8. Some fixup and cleanup

    Aaron1011 committed Jan 17, 2020
    Configuration menu
    Copy the full SHA
    932d7c2 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    10cd2e3 View commit details
    Browse the repository at this point in the history
  10. More refactoring

    Aaron1011 committed Jan 17, 2020
    Configuration menu
    Copy the full SHA
    a8ce823 View commit details
    Browse the repository at this point in the history
  11. Add a bunch of comments

    Aaron1011 committed Jan 17, 2020
    Configuration menu
    Copy the full SHA
    65318da View commit details
    Browse the repository at this point in the history
  12. Some additional cleanup

    Aaron1011 committed Jan 17, 2020
    Configuration menu
    Copy the full SHA
    61b879c View commit details
    Browse the repository at this point in the history
  13. Change warning to error

    Aaron1011 committed Jan 17, 2020
    Configuration menu
    Copy the full SHA
    c5691a8 View commit details
    Browse the repository at this point in the history
  14. Add some tests

    Aaron1011 committed Jan 17, 2020
    Configuration menu
    Copy the full SHA
    1ed39bc View commit details
    Browse the repository at this point in the history

Commits on Jan 18, 2020

  1. Fix tidy errors

    Aaron1011 committed Jan 18, 2020
    Configuration menu
    Copy the full SHA
    d4bd422 View commit details
    Browse the repository at this point in the history
  2. Fix failing test

    Aaron1011 committed Jan 18, 2020
    Configuration menu
    Copy the full SHA
    f1961b5 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    643a708 View commit details
    Browse the repository at this point in the history

Commits on Jan 19, 2020

  1. Configuration menu
    Copy the full SHA
    a81c513 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    9eb803a View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    78a831f View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    3aefe61 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    409e8d7 View commit details
    Browse the repository at this point in the history
  6. Update test output

    Aaron1011 committed Jan 19, 2020
    Configuration menu
    Copy the full SHA
    39af896 View commit details
    Browse the repository at this point in the history
  7. Add explicit type annotations for vec.push(break) test

    This code was being correctly matched by the never-type fallback lint.
    
    In this case, the fallback is actually safe - constructing a `Vec<!>` is
    perfectly fine. However, the lint doesn't know that - without knowing
    about the inner details of `Vec`, there's no way of knowing that
    changing `Vec::<()>::new()` to `Vec::<!>::new()` is safe.
    
    I think this should be sufficiently rare in practice as to not be an
    issue. If a Vec<_> gets inferred to Vec<!> due to fallback, you must
    have never pushed anything to it (or else fallback would not have run
    due to the type variable being constrained).
    
    If the error does come up, adding type annotations is sufficient to fix
    the problem - using `Vec<()>`, `Vec<!> or (before the `!` type is stabilized)
    `Vec<std::convert::Infallible`, or really any type, will work.
    
    Alternatively, we might consider special-casing some (or all) safe methods in
    `libcore` and `libstd`, as fallback should never cause an issue with
    them.
    Aaron1011 committed Jan 19, 2020
    Configuration menu
    Copy the full SHA
    c82ea60 View commit details
    Browse the repository at this point in the history

Commits on Jan 26, 2020

  1. Configuration menu
    Copy the full SHA
    fe77a00 View commit details
    Browse the repository at this point in the history