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 9 pull requests #118881

Merged
merged 27 commits into from
Dec 12, 2023
Merged

Rollup of 9 pull requests #118881

merged 27 commits into from
Dec 12, 2023

Commits on Nov 15, 2023

  1. Clarify how to choose a FutureIncompatibilityReason variant.

    There has been some confusion about how to choose these variants, or
    what the procedure is for handling future-incompatible errors. Hopefully
    this helps provide some more information on how these work.
    ehuss committed Nov 15, 2023
    Configuration menu
    Copy the full SHA
    7a812c1 View commit details
    Browse the repository at this point in the history

Commits on Nov 20, 2023

  1. On borrow return type, suggest borrowing from arg or owned return type

    When we encounter a function with a return type that has an anonymous
    lifetime with no argument to borrow from, besides suggesting the
    `'static` lifetime we now also suggest changing the arguments to be
    borrows or changing the return type to be an owned type.
    
    ```
    error[E0106]: missing lifetime specifier
      --> $DIR/variadic-ffi-6.rs:7:6
       |
    LL | ) -> &usize {
       |      ^ expected named lifetime parameter
       |
       = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from
    help: consider using the `'static` lifetime, but this is uncommon unless you're returning a borrowed value from a `const` or a `static`
       |
    LL | ) -> &'static usize {
       |       +++++++
    help: instead, you are more likely to want to change one of the arguments to be borrowed...
       |
    LL |     x: &usize,
       |        +
    help: ...or alternatively, to want to return an owned value
       |
    LL - ) -> &usize {
    LL + ) -> usize {
       |
    ```
    
    Fix rust-lang#85843.
    estebank committed Nov 20, 2023
    Configuration menu
    Copy the full SHA
    b7a23bc View commit details
    Browse the repository at this point in the history
  2. Account for impl Trait in lifetime suggestion

    When encountering
    ```rust
    fn g(mut x: impl Iterator<Item = &()>) -> Option<&()> { /* */ }
    ```
    Suggest
    ```rust
    fn g<'a>(mut x: impl Iterator<Item = &'a ()>) -> Option<&'a ()> { /* */ }
    ```
    estebank committed Nov 20, 2023
    Configuration menu
    Copy the full SHA
    5fce361 View commit details
    Browse the repository at this point in the history
  3. Tweak wording

    estebank committed Nov 20, 2023
    Configuration menu
    Copy the full SHA
    d30252e View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    dec7f00 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    2a92d82 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    85f26ad View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    bb9d720 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    02bea16 View commit details
    Browse the repository at this point in the history
  9. let-chain fmt

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

Commits on Dec 9, 2023

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

Commits on Dec 12, 2023

  1. Improve an error involving attribute values.

    Attribute values must be literals. The error you get when that doesn't
    hold is pretty bad, e.g.:
    ```
    unexpected expression: 1 + 1
    ```
    You also get the same error if the attribute value is a literal, but an
    invalid literal, e.g.:
    ```
    unexpected expression: "foo"suffix
    ```
    
    This commit does two things.
    - Changes the error message to "attribute value must be a literal",
      which gives a better idea of what the problem is and how to fix it. It
      also no longer prints the invalid expression, because the carets below
      highlight it anyway.
    - Separates the "not a literal" case from the "invalid literal" case.
      Which means invalid literals now get the specific error at the literal
      level, rather than at the attribute level.
    nnethercote committed Dec 12, 2023
    Configuration menu
    Copy the full SHA
    226edf6 View commit details
    Browse the repository at this point in the history
  2. rustdoc-search: clean up parser

    The `c === "="` was redundant when `isSeparatorCharacter` already
    checks that.
    
    The function `isStopCharacter` and `isEndCharacter` functions
    did exactly the same thing and have synonymous names.
    There doesn't seem much point in having both.
    notriddle committed Dec 12, 2023
    Configuration menu
    Copy the full SHA
    4f80833 View commit details
    Browse the repository at this point in the history
  3. rustc_codegen_llvm: Enforce rustc::potential_query_instability lint

    Stop allowing `rustc::potential_query_instability` on all of
    `rustc_codegen_llvm` and instead allow it on a case-by-case basis. In
    this case, both instances are safe to allow.
    Enselic committed Dec 12, 2023
    Configuration menu
    Copy the full SHA
    f44ccba View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    46a8015 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    e274372 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    19e0c98 View commit details
    Browse the repository at this point in the history
  7. tests: CGU tests require build-pass, not check-pass (remove FIXME)

    CGU tests require CGU code to be exercised. We can't merely do "cargo
    check" on these tests.
    Enselic committed Dec 12, 2023
    Configuration menu
    Copy the full SHA
    41c9404 View commit details
    Browse the repository at this point in the history
  8. Rollup merge of rust-lang#116740 - lenko-d:const_evaluatable_failed_f…

    …or_non_unevaluated_const, r=BoxyUwU
    
    dont ICE when ConstKind::Expr for is_const_evaluatable
    
    The problem is that we are not handling ConstKind::Expr inside report_not_const_evaluatable_error
    
    Fixes [rust-lang#114151]
    matthiaskrgr authored Dec 12, 2023
    Configuration menu
    Copy the full SHA
    b2a0175 View commit details
    Browse the repository at this point in the history
  9. Rollup merge of rust-lang#117914 - estebank:issue-85843, r=wesleywiser

    On borrow return type, suggest borrowing from arg or owned return type
    
    When we encounter a function with a return type that has an anonymous lifetime with no argument to borrow from, besides suggesting the `'static` lifetime we now also suggest changing the arguments to be borrows or changing the return type to be an owned type.
    
    ```
    error[E0106]: missing lifetime specifier
      --> $DIR/variadic-ffi-6.rs:7:6
       |
    LL | ) -> &usize {
       |      ^ expected named lifetime parameter
       |
       = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from
    help: consider using the `'static` lifetime, but this is uncommon unless you're returning a borrowed value from a `const` or a `static`
       |
    LL | ) -> &'static usize {
       |       +++++++
    help: instead, you are more likely to want to change one of the arguments to be borrowed...
       |
    LL |     x: &usize,
       |        +
    help: ...or alternatively, to want to return an owned value
       |
    LL - ) -> &usize {
    LL + ) -> usize {
       |
    ```
    
    Fix rust-lang#85843.
    matthiaskrgr authored Dec 12, 2023
    Configuration menu
    Copy the full SHA
    ffdb471 View commit details
    Browse the repository at this point in the history
  10. Rollup merge of rust-lang#117927 - ehuss:future-incompat-docs, r=wesl…

    …eywiser
    
    Clarify how to choose a FutureIncompatibilityReason variant.
    
    There has been some confusion about how to choose these variants, or what the procedure is for handling future-incompatible errors. Hopefully this helps provide some more information on how these work.
    matthiaskrgr authored Dec 12, 2023
    Configuration menu
    Copy the full SHA
    111c40e View commit details
    Browse the repository at this point in the history
  11. Rollup merge of rust-lang#118855 - nnethercote:improve-attribute-valu…

    …e-error, r=compiler-errors,petrochenkov
    
    Improve an error involving attribute values.
    
    Attribute values must be literals. The error you get when that doesn't hold is pretty bad, e.g.:
    ```
    unexpected expression: 1 + 1
    ```
    You also get the same error if the attribute value is a literal, but an invalid literal, e.g.:
    ```
    unexpected expression: "foo"suffix
    ```
    
    This commit does two things.
    - Changes the error message to "attribute value must be a literal", which gives a better idea of what the problem is and how to fix it. It also no longer prints the invalid expression, because the carets below highlight it anyway.
    - Separates the "not a literal" case from the "invalid literal" case. Which means invalid literals now get the specific error at the literal level, rather than at the attribute level.
    
    r? `@compiler-errors`
    matthiaskrgr authored Dec 12, 2023
    Configuration menu
    Copy the full SHA
    cd7809b View commit details
    Browse the repository at this point in the history
  12. Rollup merge of rust-lang#118856 - notriddle:notriddle/search-js, r=G…

    …uillaumeGomez
    
    rustdoc-search: clean up parser
    
    The `c === "="` was redundant when `isSeparatorCharacter` already checks that.
    
    The function `isStopCharacter` and `isEndCharacter` functions did exactly the same thing and have synonymous names. There doesn't seem much point in having both.
    matthiaskrgr authored Dec 12, 2023
    Configuration menu
    Copy the full SHA
    6459121 View commit details
    Browse the repository at this point in the history
  13. Rollup merge of rust-lang#118865 - Enselic:rustc_codegen_llvm-lint-fi…

    …x, r=petrochenkov
    
    rustc_codegen_llvm: Enforce `rustc::potential_query_instability` lint
    
    Stop allowing `rustc::potential_query_instability` on all of `rustc_codegen_llvm` and instead allow it on a case-by-case basis if it is safe to do so. In this case, all 2 instances are safe to allow.
    
    Part of rust-lang#84447 which is E-help-wanted.
    matthiaskrgr authored Dec 12, 2023
    Configuration menu
    Copy the full SHA
    04c77a5 View commit details
    Browse the repository at this point in the history
  14. Rollup merge of rust-lang#118866 - krasimirgg:llvm-18-ref, r=durin42

    llvm-wrapper: adapt for LLVM API change
    
    LLVM commit llvm/llvm-project@f09cf34 (old) moved some functions to a different header. It looks we were getting it transitively in PassWrapper, and something in LLVM recently removed it from the set of transitively available headers, so include it directly:
    https://buildkite.com/llvm-project/rust-llvm-integrate-prototype/builds/24416#018c5de6-b9c9-4b22-9473-6070d99dcfa7/233-537
    
    r? `@nikic`
    matthiaskrgr authored Dec 12, 2023
    Configuration menu
    Copy the full SHA
    9ed12f8 View commit details
    Browse the repository at this point in the history
  15. Rollup merge of rust-lang#118868 - Nadrieril:correctly-gate-never_pat…

    …terns-parsing, r=petrochenkov
    
    Correctly gate the parsing of match arms without body
    
    rust-lang#118527 accidentally allowed the following to parse on stable:
    ```rust
    match Some(0) {
        None => { foo(); }
        #[cfg(FALSE)]
        Some(_)
    }
    ```
    
    This fixes that oversight. The way I choose which error to emit is the best I could think of, I'm open if you know a better way.
    
    r? `@petrochenkov` since you're the one who noticed
    matthiaskrgr authored Dec 12, 2023
    Configuration menu
    Copy the full SHA
    d661974 View commit details
    Browse the repository at this point in the history
  16. Rollup merge of rust-lang#118877 - Enselic:remove-cgu-fixme, r=Nilstrieb

    tests: CGU tests require build-pass, not check-pass (remove FIXME)
    
    CGU tests require CGU code to be exercised. We can't merely do "cargo check" on these tests.
    
    Part of rust-lang#62277
    matthiaskrgr authored Dec 12, 2023
    Configuration menu
    Copy the full SHA
    010f301 View commit details
    Browse the repository at this point in the history