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 7 pull requests #118651

Closed
wants to merge 22 commits into from

Commits on Nov 16, 2023

  1. Provide context when ? can't be called because of Result<_, E>

    When a method chain ending in `?` causes an E0277 because the
    expression's `Result::Err` variant doesn't have a type that can be
    converted to the `Result<_, E>` type parameter in the return type,
    provide additional context of which parts of the chain can and can't
    support the `?` operator.
    
    ```
    error[E0277]: `?` couldn't convert the error to `String`
      --> $DIR/question-mark-result-err-mismatch.rs:28:25
       |
    LL | fn bar() -> Result<(), String> {
       |             ------------------ expected `String` because of this
    LL |     let x = foo();
       |             ----- this can be annotated with `?` because it has type `Result<String, String>`
    LL |     let one = x
    LL |         .map(|s| ())
       |          ----------- this can be annotated with `?` because it has type `Result<(), String>`
    LL |         .map_err(|_| ())?;
       |          ---------------^ the trait `From<()>` is not implemented for `String`
       |          |
       |          this can't be annotated with `?` because it has type `Result<(), ()>`
       |
       = note: the question mark operation (`?`) implicitly performs a conversion on the error value using the `From` trait
       = help: the following other types implement trait `From<T>`:
                 <String as From<char>>
                 <String as From<Box<str>>>
                 <String as From<Cow<'a, str>>>
                 <String as From<&str>>
                 <String as From<&mut str>>
                 <String as From<&String>>
       = note: required for `Result<(), String>` to implement `FromResidual<Result<Infallible, ()>>`
    ```
    
    Fix rust-lang#72124.
    estebank committed Nov 16, 2023
    Configuration menu
    Copy the full SHA
    2faaea9 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    276b74d View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    e688742 View commit details
    Browse the repository at this point in the history
  4. Reduce verbosity of error

    estebank committed Nov 16, 2023
    Configuration menu
    Copy the full SHA
    cc49398 View commit details
    Browse the repository at this point in the history
  5. add comments

    estebank committed Nov 16, 2023
    Configuration menu
    Copy the full SHA
    d92c2b5 View commit details
    Browse the repository at this point in the history
  6. let-chain fmt

    estebank committed Nov 16, 2023
    Configuration menu
    Copy the full SHA
    cce82d8 View commit details
    Browse the repository at this point in the history

Commits on Nov 21, 2023

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

Commits on Nov 22, 2023

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

Commits on Dec 4, 2023

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

Commits on Dec 5, 2023

  1. Configuration menu
    Copy the full SHA
    65212a0 View commit details
    Browse the repository at this point in the history
  2. bootstrap(builder.rs): Don't explicitly warn against `semicolon_in_ex…

    …pressions_from_macros`
    
    This already wasn't passed in bootstrap.py and the lint itself already warns-by-default for 2 years now and has already been added to the future-incompat group in Rust 1.68.
    
    See rust-lang#79813 for the tracking issue.
    Xanewok committed Dec 5, 2023
    Configuration menu
    Copy the full SHA
    a0ba895 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    334577f View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    3448284 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    b97ff8e View commit details
    Browse the repository at this point in the history
  6. Add more

    compiler-errors committed Dec 5, 2023
    Configuration menu
    Copy the full SHA
    f6c30b3 View commit details
    Browse the repository at this point in the history
  7. Rollup merge of rust-lang#116496 - estebank:question-method-chain-con…

    …text, r=compiler-errors
    
    Provide context when `?` can't be called because of `Result<_, E>`
    
    When a method chain ending in `?` causes an E0277 because the expression's `Result::Err` variant doesn't have a type that can be converted to the `Result<_, E>` type parameter in the return type, provide additional context of which parts of the chain can and can't support the `?` operator.
    
    ```
    error[E0277]: `?` couldn't convert the error to `String`
      --> $DIR/question-mark-result-err-mismatch.rs:27:25
       |
    LL | fn bar() -> Result<(), String> {
       |             ------------------ expected `String` because of this
    LL |     let x = foo();
       |             ----- this has type `Result<_, String>`
    ...
    LL |         .map_err(|_| ())?;
       |          ---------------^ the trait `From<()>` is not implemented for `String`
       |          |
       |          this can't be annotated with `?` because it has type `Result<_, ()>`
       |
       = note: the question mark operation (`?`) implicitly performs a conversion on the error value using the `From` trait
       = help: the following other types implement trait `From<T>`:
                 <String as From<char>>
                 <String as From<Box<str>>>
                 <String as From<Cow<'a, str>>>
                 <String as From<&str>>
                 <String as From<&mut str>>
                 <String as From<&String>>
       = note: required for `Result<(), String>` to implement `FromResidual<Result<Infallible, ()>>`
    ```
    
    Fix rust-lang#72124.
    matthiaskrgr committed Dec 5, 2023
    Configuration menu
    Copy the full SHA
    94fd369 View commit details
    Browse the repository at this point in the history
  8. Rollup merge of rust-lang#118123 - RalfJung:internal-lib-features, r=…

    …compiler-errors
    
    Add support for making lib features internal
    
    We have the notion of an "internal" lang feature: a feature that is never intended to be stabilized, and using which can cause ICEs and other issues without that being considered a bug.
    
    This extends that idea to lib features as well. It is an alternative to rust-lang#115623: instead of using an attribute to declare lib features internal, we simply do this based on the name. Everything ending in `_internals` or `_internal` is considered internal.
    
    Then we rename `core_intrinsics` to `core_intrinsics_internal`, which fixes rust-lang#115597.
    matthiaskrgr committed Dec 5, 2023
    Configuration menu
    Copy the full SHA
    13d386e View commit details
    Browse the repository at this point in the history
  9. Rollup merge of rust-lang#118268 - compiler-errors:pretty-print, r=es…

    …tebank
    
    Pretty print `Fn<(..., ...)>` trait refs with parentheses (almost) always
    
    It's almost always better, at least in diagnostics, to print `Fn(i32, u32)` instead of `Fn<(i32, u32)>`.
    
    Related to but doesn't fix rust-lang#118225. That needs a separate fix.
    matthiaskrgr committed Dec 5, 2023
    Configuration menu
    Copy the full SHA
    18b7570 View commit details
    Browse the repository at this point in the history
  10. Rollup merge of rust-lang#118346 - compiler-errors:deeply-normalize-f…

    …or-diagnostic, r=lcnr
    
    Add `deeply_normalize_for_diagnostics`, use it in coherence
    
    r? lcnr
    
    Normalize trait refs used for coherence error reporting with `-Ztrait-solver=next-coherence`.
    
    Two things:
    1. I said before that we can't add this to `TyErrCtxt` because we compute `OverlapResult`s even if there are no diagnostics being emitted, e.g. for a reservation impl.
    2. I didn't want to add this to an `InferCtxtExt` trait because I felt it was unnecessary. I don't particularly care about the API though.
    matthiaskrgr committed Dec 5, 2023
    Configuration menu
    Copy the full SHA
    1503a53 View commit details
    Browse the repository at this point in the history
  11. Rollup merge of rust-lang#118585 - sjwang05:issue-118564, r=compiler-…

    …errors
    
    Fix parser ICE when recovering `dyn`/`impl` after `for<...>`
    
    Fixes rust-lang#118564
    matthiaskrgr committed Dec 5, 2023
    Configuration menu
    Copy the full SHA
    ee37f4a View commit details
    Browse the repository at this point in the history
  12. Rollup merge of rust-lang#118605 - fee1-dead-contrib:rm-rustc_host, r…

    …=compiler-errors
    
    Remove `#[rustc_host]`, use internal desugaring
    
    Also removed a way for users to explicitly specify the host param since that isn't particularly useful. This should eliminate any pain with encoding attributes across crates and etc.
    
    r? ``@compiler-errors``
    matthiaskrgr committed Dec 5, 2023
    Configuration menu
    Copy the full SHA
    848dc33 View commit details
    Browse the repository at this point in the history
  13. Rollup merge of rust-lang#118642 - Xanewok:patch-1, r=clubby789

    bootstrap(builder.rs): Don't explicitly warn against `semicolon_in_expressions_from_macros`
    
    This already wasn't passed in bootstrap.py and the lint itself already warns-by-default for 2 years now and has already been added to the future-incompat group in Rust 1.68.
    
    See rust-lang#79813 for the tracking issue.
    matthiaskrgr committed Dec 5, 2023
    Configuration menu
    Copy the full SHA
    ed076f8 View commit details
    Browse the repository at this point in the history