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

Rollup of 17 pull requests #73475

Closed
wants to merge 77 commits into from

Commits on May 20, 2020

  1. Implement partial error recovery for let with BinOpEq

    When parsing `let x: i8 += 1` the compiler interprets `i8` as a trait
    which makes it more complicated to do error recovery. More advanced
    error recovery is not implemented in this commit.
    mibac138 committed May 20, 2020
    Configuration menu
    Copy the full SHA
    d4fe955 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    48ff12a View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    05d6531 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    6ad24ba View commit details
    Browse the repository at this point in the history

Commits on May 21, 2020

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

Commits on May 26, 2020

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

Commits on May 28, 2020

  1. Configuration menu
    Copy the full SHA
    3313bf6 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    358dc1d View commit details
    Browse the repository at this point in the history

Commits on May 30, 2020

  1. Configuration menu
    Copy the full SHA
    f7d745f View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    7a6d03c View commit details
    Browse the repository at this point in the history

Commits on Jun 4, 2020

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

Commits on Jun 13, 2020

  1. Configuration menu
    Copy the full SHA
    724dfba View commit details
    Browse the repository at this point in the history
  2. Make new type param suggestion more targetted

    Do not suggest new type param when encountering a missing type in an ADT
    field with generic parameters.
    
    Fix rust-lang#72640.
    estebank committed Jun 13, 2020
    Configuration menu
    Copy the full SHA
    4606168 View commit details
    Browse the repository at this point in the history
  3. Note numeric literals that can never fit in an expected type

    re rust-lang#72380 (comment)
    
    Given the toy code
    
    ```rust
    fn is_positive(n: usize) {
      n > -1_isize;
    }
    ```
    
    We currently get a type mismatch error like the following:
    
    ```
    error[E0308]: mismatched types
     --> src/main.rs:2:9
      |
    2 |     n > -1_isize;
      |         ^^^^^^^^ expected `usize`, found `isize`
      |
    help: you can convert an `isize` to `usize` and panic if the converted value wouldn't fit
      |
    2 |     n > (-1_isize).try_into().unwrap();
      |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ```
    
    But clearly, `-1` can never fit into a `usize`, so the suggestion will
    always panic. A more useful message would tell the user that the value
    can never fit in the expected type:
    
    ```
    error[E0308]: mismatched types
     --> test.rs:2:9
      |
    2 |     n > -1_isize;
      |         ^^^^^^^^ expected `usize`, found `isize`
      |
    note: `-1_isize` can never fit into `usize`
     --> test.rs:2:9
      |
    2 |     n > -1_isize;
      |         ^^^^^^^^
    ```
    
    Which is what this commit implements.
    
    I only added this check for negative literals because
    
    - Currently we can only perform such a check for literals (constant
      value propagation is outside the scope of the typechecker at this
      point)
    - A lint error for out-of-range numeric literals is already emitted
    
    IMO it makes more sense to put this check in librustc_lint, but as far
    as I can tell the typecheck pass happens before the lint pass, so I've
    added it here.
    
    r? @estebank
    ayazhafiz committed Jun 13, 2020
    Configuration menu
    Copy the full SHA
    afbbd38 View commit details
    Browse the repository at this point in the history

Commits on Jun 14, 2020

  1. Configuration menu
    Copy the full SHA
    2b936bb View commit details
    Browse the repository at this point in the history
  2. Add rust features to print target features

    `crt-static` is a rust specific target feature that's absent from llvm feature table, adding it there.
    aszenz authored Jun 14, 2020
    Configuration menu
    Copy the full SHA
    e32db84 View commit details
    Browse the repository at this point in the history

Commits on Jun 15, 2020

  1. Configuration menu
    Copy the full SHA
    f62903b View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    6b7cacb View commit details
    Browse the repository at this point in the history
  3. Fix whitespace

    doctorn committed Jun 15, 2020
    Configuration menu
    Copy the full SHA
    d23bedd View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    ee810a7 View commit details
    Browse the repository at this point in the history
  5. Fix whitespace

    doctorn committed Jun 15, 2020
    Configuration menu
    Copy the full SHA
    11b56fb View commit details
    Browse the repository at this point in the history
  6. Fix sanitizer test

    doctorn committed Jun 15, 2020
    Configuration menu
    Copy the full SHA
    babda94 View commit details
    Browse the repository at this point in the history
  7. Update sanitizer test

    doctorn committed Jun 15, 2020
    Configuration menu
    Copy the full SHA
    e8e0a0e View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    9e51008 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    81c9094 View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    4e90f17 View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    921f35f View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    e755889 View commit details
    Browse the repository at this point in the history
  13. Configuration menu
    Copy the full SHA
    bc15790 View commit details
    Browse the repository at this point in the history
  14. Configuration menu
    Copy the full SHA
    539e978 View commit details
    Browse the repository at this point in the history
  15. review comments: wording

    estebank committed Jun 15, 2020
    Configuration menu
    Copy the full SHA
    31ea589 View commit details
    Browse the repository at this point in the history
  16. Configuration menu
    Copy the full SHA
    10d9bf1 View commit details
    Browse the repository at this point in the history
  17. Register new eror code

    estebank committed Jun 15, 2020
    Configuration menu
    Copy the full SHA
    34d8692 View commit details
    Browse the repository at this point in the history
  18. small tweaks

    estebank committed Jun 15, 2020
    Configuration menu
    Copy the full SHA
    e31367d View commit details
    Browse the repository at this point in the history
  19. Configuration menu
    Copy the full SHA
    f7a1f97 View commit details
    Browse the repository at this point in the history
  20. fix rebase

    estebank committed Jun 15, 2020
    Configuration menu
    Copy the full SHA
    bfe1434 View commit details
    Browse the repository at this point in the history
  21. add FIXME to EnumTagInfo

    RalfJung committed Jun 15, 2020
    Configuration menu
    Copy the full SHA
    10c8d2a View commit details
    Browse the repository at this point in the history
  22. Expand "recursive opaque type" diagnostic

    Fix rust-lang#70968, partially address rust-lang#66523.
    estebank committed Jun 15, 2020
    Configuration menu
    Copy the full SHA
    96f5584 View commit details
    Browse the repository at this point in the history
  23. review comments

    estebank committed Jun 15, 2020
    Configuration menu
    Copy the full SHA
    8f12485 View commit details
    Browse the repository at this point in the history
  24. Configuration menu
    Copy the full SHA
    268decb View commit details
    Browse the repository at this point in the history
  25. Configuration menu
    Copy the full SHA
    e855b90 View commit details
    Browse the repository at this point in the history

Commits on Jun 16, 2020

  1. Configuration menu
    Copy the full SHA
    0bcefd9 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    302fb50 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    046165a View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    6c5345f View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    827ccf7 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    f0d3689 View commit details
    Browse the repository at this point in the history
  7. format derives

    Co-authored-by: lzutao <[email protected]>
    mark-i-m and tesuji authored Jun 16, 2020
    Configuration menu
    Copy the full SHA
    cfdbbb5 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    4506a35 View commit details
    Browse the repository at this point in the history
  9. break long line for formatting

    aszenz committed Jun 16, 2020
    Configuration menu
    Copy the full SHA
    9f50f84 View commit details
    Browse the repository at this point in the history
  10. trim whitespace

    aszenz committed Jun 16, 2020
    Configuration menu
    Copy the full SHA
    457acbd View commit details
    Browse the repository at this point in the history

Commits on Jun 17, 2020

  1. Suggest new type param on single char ident

    Suggest new type parameter on single char uppercase ident even if it
    doesn't appear in a field's type parameter.
    
    Address comment in rust-lang#72641.
    estebank committed Jun 17, 2020
    Configuration menu
    Copy the full SHA
    af45d8a View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    d7277df View commit details
    Browse the repository at this point in the history
  3. add blank line bw sections

    Separate target features from rust ones with a blank line
    
    Co-authored-by: Josh Stone <[email protected]>
    aszenz and cuviper authored Jun 17, 2020
    Configuration menu
    Copy the full SHA
    caffb28 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    7a89a33 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    b60cefe View commit details
    Browse the repository at this point in the history
  6. review comments

    estebank committed Jun 17, 2020
    Configuration menu
    Copy the full SHA
    8d1a380 View commit details
    Browse the repository at this point in the history
  7. Restore some write_fmts

    Lucretiel committed Jun 17, 2020
    Configuration menu
    Copy the full SHA
    14d385b View commit details
    Browse the repository at this point in the history

Commits on Jun 18, 2020

  1. Configuration menu
    Copy the full SHA
    e5c5df8 View commit details
    Browse the repository at this point in the history
  2. Document format correction

    qy3u committed Jun 18, 2020
    Configuration menu
    Copy the full SHA
    d134870 View commit details
    Browse the repository at this point in the history
  3. Rollup merge of rust-lang#70551 - mark-i-m:ty-err-2, r=varkor

    Make all uses of ty::Error delay a span bug
    
    r? @eddyb
    
    A second attempt at rust-lang#70245
    
    resolves rust-lang#70866
    Manishearth authored Jun 18, 2020
    Configuration menu
    Copy the full SHA
    d176448 View commit details
    Browse the repository at this point in the history
  4. Rollup merge of rust-lang#71338 - estebank:recursive-impl-trait, r=ni…

    …komatsakis
    
    Expand "recursive opaque type" diagnostic
    
    Fix rust-lang#70968, partially address rust-lang#66523.
    Manishearth authored Jun 18, 2020
    Configuration menu
    Copy the full SHA
    2e9e434 View commit details
    Browse the repository at this point in the history
  5. Rollup merge of rust-lang#71976 - mibac138:let-recovery, r=estebank

    Improve diagnostics for `let x += 1`
    
    Fixes(?) rust-lang#66736
    
    The code responsible for the `E0404` errors is [here](https://github.com/rust-lang/rust/blob/master/src/librustc_parse/parser/ty.rs#L399-L424) which I don't think can be easily modified to prevent emitting an error in one specific case. Because of this I couldn't get rid of `E0404` and instead added `E0067` along with a help message which will fix the problem.
    
    r? @estebank
    Manishearth authored Jun 18, 2020
    Configuration menu
    Copy the full SHA
    09ca6a4 View commit details
    Browse the repository at this point in the history
  6. Rollup merge of rust-lang#72497 - RalfJung:tag-term, r=oli-obk

    tag/niche terminology cleanup
    
    The term "discriminant" was used in two ways throughout the compiler:
    * every enum variant has a corresponding discriminant, that can be given explicitly with `Variant = N`.
    * that discriminant is then encoded in memory to store which variant is active -- but this encoded form of the discriminant was also often called "discriminant", even though it is conceptually quite different (e.g., it can be smaller in size, or even use niche-filling).
    
    After discussion with @eddyb, this renames the second term to "tag". The way the tag is encoded can be either `TagEncoding::Direct` (formerly `DiscriminantKind::Tag`) or `TagEncoding::Niche` (formerly `DiscrimianntKind::Niche`).
    
    This finally resolves some long-standing confusion I had about the handling of variant indices and discriminants, which surfaced in rust-lang#72419.
    
    (There is also a `DiscriminantKind` type in libcore, it remains unaffected. I think this corresponds to the discriminant, not the tag, so that seems all right.)
    
    r? @eddyb
    Manishearth authored Jun 18, 2020
    Configuration menu
    Copy the full SHA
    0a9ad17 View commit details
    Browse the repository at this point in the history
  7. Rollup merge of rust-lang#72628 - MikailBag:array-default-tests, r=sh…

    …epmaster
    
    Add tests for 'impl Default for [T; N]'
    
    Related: rust-lang#71690.
    This pull request adds two tests:
    - Even it T::default() panics, no leaks occur.
    - [T; 0] is Default even if T is not.
    
    I believe at some moment `Default` impl for arrays will be rewritten to use const generics instead of macros, and these tests will help to prevent behavior changes.
    Manishearth authored Jun 18, 2020
    Configuration menu
    Copy the full SHA
    538671b View commit details
    Browse the repository at this point in the history
  8. Rollup merge of rust-lang#72705 - Lucretiel:stdio-forwarding, r=Amanieu

    Added io forwarding methods to the stdio structs
    
    Added methods to forward the `io::Read` and `io::Write` methods of the myriad wrapper structs in `stdio.rs` to their underlying readers / writers. This is especially important for the structs on the outside of a locking boundary, to ensure that the lock isn't being dropped and re-acquired in a loop.
    Manishearth authored Jun 18, 2020
    Configuration menu
    Copy the full SHA
    90a2403 View commit details
    Browse the repository at this point in the history
  9. Rollup merge of rust-lang#72804 - estebank:opaque-missing-lts-in-fn-2…

    …, r=nikomatsakis
    
    Further tweak lifetime errors involving `dyn Trait` and `impl Trait` in return position
    
    * Suggest substituting `'static` lifetime in impl/dyn `Trait + 'static` instead of `Trait + 'static + '_`
    * When `'static` is explicit, also suggest constraining argument with it
    * Reduce verbosity of suggestion message and mention lifetime in label
    * Tweak output for overlapping required/captured spans
    * Give these errors an error code
    
    Follow up to rust-lang#72543.
    
    r? @nikomatsakis
    Manishearth authored Jun 18, 2020
    Configuration menu
    Copy the full SHA
    32b4084 View commit details
    Browse the repository at this point in the history
  10. Rollup merge of rust-lang#72814 - RalfJung:mir-visir-terminator, r=ol…

    …i-obk
    
    remove visit_terminator_kind from MIR visitor
    
    For some reason, we had both `visit_terminator` and `visit_terminator_kind`. In contrast, for `Statement` we just have `visit_statement`. So this cleans things up by removing `visit_terminator_kind` and porting its users to `visit_terminator`.
    Manishearth authored Jun 18, 2020
    Configuration menu
    Copy the full SHA
    be8fe77 View commit details
    Browse the repository at this point in the history
  11. Rollup merge of rust-lang#72836 - poliorcetics:std-time-os-specificit…

    …ies, r=shepmaster
    
    Complete the std::time documentation to warn about the inconsistencies between OS
    
    Fixes rust-lang#48980.
    
    I put the new documentation in `src/libstd/time.rs` at the module-level because it affects all types, even the one that are not directly system dependents if they are used with affected types, but there may be a better place for it.
    Manishearth authored Jun 18, 2020
    Configuration menu
    Copy the full SHA
    f419606 View commit details
    Browse the repository at this point in the history
  12. Rollup merge of rust-lang#72968 - integer32llc:docs-arrow-keys, r=Gui…

    …llaumeGomez
    
    Only highlight doc search results via mouseover if mouse has moved
    
    ## What happens
    
    - Go to https://doc.rust-lang.org/stable/std/index.html
    - Put your mouse cursor somewhere in the middle where search results will appear and then don't move the mouse
    - Press 's' to focus the search box
    - Type a query that brings up enough search results to go under where your mouse cursor is
    - Press the down arrow
    - The search result that is one below where your mouse cursor is will be highlighted.
    
    ## What I expected
    
    When not currently using the mouse, I expect doing a search and then pressing the down arrow to always highlight the first search result immediately below the search box.
    
    ## The fix
    
    This feels a bit hacky to me; I'm open to other solutions. This introduces a global JS var that keeps track of whether the person searching has moved their mouse after doing a search or not, and only uses the mouse position to highlight search results if the person HAS moved the mouse AFTER doing a search.
    Manishearth authored Jun 18, 2020
    Configuration menu
    Copy the full SHA
    4641943 View commit details
    Browse the repository at this point in the history
  13. Rollup merge of rust-lang#73034 - doctorn:nomangle-inline-linkage, r=…

    …matthewjasper
    
    Export `#[inline]` fns with extern indicators
    
    In ancient history (rust-lang#36280) we stopped `#[inline]` fns being codegened if they weren't used. However,
    
    - rust-lang#72944
    - rust-lang#72463
    
    observe that when writing something like
    
    ```rust
    #![crate_type = "cdylib"]
    
    #[no_mangle]
    #[inline]
    pub extern "C" fn foo() {
        // ...
    }
    ```
    
    we really _do_ want `foo` to be codegened. This change makes this the case.
    
    Resolves rust-lang#72944, resolves rust-lang#72463 (and maybe some more)
    Manishearth authored Jun 18, 2020
    Configuration menu
    Copy the full SHA
    89825e2 View commit details
    Browse the repository at this point in the history
  14. Rollup merge of rust-lang#73315 - GuillaumeGomez:clean-up-config-strs…

    …, r=kinnison
    
    Clean up some weird command strings
    
    r? @kinnison
    Manishearth authored Jun 18, 2020
    Configuration menu
    Copy the full SHA
    d315db4 View commit details
    Browse the repository at this point in the history
  15. Rollup merge of rust-lang#73320 - estebank:type-param-sugg-more, r=da…

    …vidtwco
    
    Make new type param suggestion more targetted
    
    Do not suggest new type param when encountering a missing type in an ADT
    field with generic parameters.
    
    Fix rust-lang#72640.
    Manishearth authored Jun 18, 2020
    Configuration menu
    Copy the full SHA
    6717409 View commit details
    Browse the repository at this point in the history
  16. Rollup merge of rust-lang#73334 - ayazhafiz:err/num-type-cannot-fit, …

    …r=estebank
    
    Note numeric literals that can never fit in an expected type
    
    re rust-lang#72380 (comment)
    
    Given the toy code
    
    ```rust
    fn is_positive(n: usize) {
      n > -1_isize;
    }
    ```
    
    We currently get a type mismatch error like the following:
    
    ```
    error[E0308]: mismatched types
     --> src/main.rs:2:9
      |
    2 |     n > -1_isize;
      |         ^^^^^^^^ expected `usize`, found `isize`
      |
    help: you can convert an `isize` to `usize` and panic if the converted value wouldn't fit
      |
    2 |     n > (-1_isize).try_into().unwrap();
      |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ```
    
    But clearly, `-1` can never fit into a `usize`, so the suggestion will
    always panic. A more useful message would tell the user that the value
    can never fit in the expected type:
    
    ```
    error[E0308]: mismatched types
     --> test.rs:2:9
      |
    2 |     n > -1_isize;
      |         ^^^^^^^^ expected `usize`, found `isize`
      |
    note: `-1_isize` can never fit into `usize`
     --> test.rs:2:9
      |
    2 |     n > -1_isize;
      |         ^^^^^^^^
    ```
    
    Which is what this commit implements.
    
    I only added this check for negative literals because
    
    - Currently we can only perform such a check for literals (constant
      value propagation is outside the scope of the typechecker at this
      point)
    - A lint error for out-of-range numeric literals is already emitted
    
    IMO it makes more sense to put this check in librustc_lint, but as far
    as I can tell the typecheck pass happens before the lint pass, so I've
    added it here.
    
    r? @estebank
    Manishearth authored Jun 18, 2020
    Configuration menu
    Copy the full SHA
    a2125e5 View commit details
    Browse the repository at this point in the history
  17. Rollup merge of rust-lang#73346 - aszenz:patch-1, r=cuviper

    Add rust specific features to print target features
    
    Fixes rust-lang#71583
    
    `crt-static` is a rust specific target feature that's absent from llvm feature table, adding it there so that it shows under `rustc --print target-features`.
    
    Probably the most native implementation I could think of, would love to get feedback.
    Manishearth authored Jun 18, 2020
    Configuration menu
    Copy the full SHA
    8fa2f09 View commit details
    Browse the repository at this point in the history
  18. Rollup merge of rust-lang#73464 - qy3u:fs-document-format-correction,…

    … r=jonas-schievink
    
    Document format correction
    
    Minor amendments to the document.
    
    r? @steveklabnik
    Manishearth authored Jun 18, 2020
    Configuration menu
    Copy the full SHA
    d8f6804 View commit details
    Browse the repository at this point in the history
  19. Rollup merge of rust-lang#73465 - lzutao:spec-char-tostring, r=sfackler

    Add specialization of `ToString for char`
    
    Closes rust-lang#73462
    Manishearth authored Jun 18, 2020
    Configuration menu
    Copy the full SHA
    67d5f65 View commit details
    Browse the repository at this point in the history