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 #122065

Closed
wants to merge 29 commits into from

Commits on Feb 27, 2024

  1. Stabilize the #[diagnostic] namespace and `#[diagnostic::on_unimple…

    …mented]` attribute
    
    This PR stabilizes the `#[diagnostic]` attribute namespace and a minimal
    option of the `#[diagnostic::on_unimplemented]` attribute.
    
    The `#[diagnostic]` attribute namespace is meant to provide a home for
    attributes that allow users to influence error messages emitted by the
    compiler. The compiler is not guaranteed to use any of this hints,
    however it should accept any (non-)existing attribute in this namespace
    and potentially emit lint-warnings for unused attributes and options.
    This is meant to allow discarding certain attributes/options in the
    future to allow fundamental changes to the compiler without the need to
    keep then non-meaningful options working.
    
    The `#[diagnostic::on_unimplemented]` attribute is allowed to appear
    on a trait definition. This allows crate authors to hint the compiler
    to emit a specific error message if a certain trait is not implemented.
    For the `#[diagnostic::on_unimplemented]` attribute the following
    options are implemented:
    
    * `message` which provides the text for the top level error message
    * `label` which provides the text for the label shown inline in the
    broken code in the error message
    * `note` which provides additional notes.
    
    The `note` option can appear several times, which results in several
    note messages being emitted. If any of the other options appears several
    times the first occurrence of the relevant option specifies the actually
    used value. Any other occurrence generates an lint warning. For any
    other non-existing option a lint-warning is generated.
    
    All three options accept a text as argument. This text is allowed to
    contain format parameters referring to generic argument or `Self` by
    name via the `{Self}` or `{NameOfGenericArgument}` syntax. For any
    non-existing argument a lint warning is generated.
    
    Tracking issue: rust-lang#111996
    weiznich committed Feb 27, 2024
    Configuration menu
    Copy the full SHA
    d013b5a View commit details
    Browse the repository at this point in the history

Commits on Mar 4, 2024

  1. Removing absolute path in proc-macro

    With rust 1.75 the absolute build path is embedding into '.rustc' section and which causes reproducibility issues. Detailed issue is here.
    rust-lang#120825 (comment)
    
    With this change the 'absolute path' changed back to '/rust/$hash' format.
    sundeep-kokkonda authored Mar 4, 2024
    Configuration menu
    Copy the full SHA
    a9a9798 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    50de6bc View commit details
    Browse the repository at this point in the history
  3. Remove unused structs

    mu001999 committed Mar 4, 2024
    Configuration menu
    Copy the full SHA
    1aa3671 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    59c69b8 View commit details
    Browse the repository at this point in the history
  5. doc: Add better explanation

    orion GONZALEZ (contractor) committed Mar 4, 2024
    Configuration menu
    Copy the full SHA
    cace4b0 View commit details
    Browse the repository at this point in the history

Commits on Mar 5, 2024

  1. bootstrap: print test name on failure even with verbose-tests=false

    This makes it much easier to know which test failed without having to wait for compiletest to completely finish running. Before:
    ```
    Testing stage0 compiletest suite=ui mode=ui (x86_64-unknown-linux-gnu)
    
    running 15274 tests
    iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii    88/15274
    iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii   176/15274
    iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii   264/15274
    iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii   352/15274
    iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii   440/15274
    iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii   528/15274
    iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiFFiiiiiii
    ...
    ```
    
    After:
    ```
    Testing stage0 compiletest suite=ui mode=ui (x86_64-unknown-linux-gnu)
    
    running 15274 tests
    iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii    88/15274
    iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii   176/15274
    iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii   264/15274
    iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii   352/15274
    iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii   440/15274
    iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii   528/15274
    iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
    [ui] tests/ui/associated-type-bounds/implied-in-supertrait.rs ... F
    
    [ui] tests/ui/associated-type-bounds/return-type-notation/basic.rs#next_with ... F
    iiiiiiiiiiiii
    ...
    ```
    
    This serves a similar use case to the existing RUSTC_TEST_FAIL_FAST, but is on by default and as a result much more discoverable.
    We should consider unifying RUSTC_TEST_FAIL_FAST with the `--no-fail-fast` flag in the future for consistency and discoverability.
    jyn514 committed Mar 5, 2024
    Configuration menu
    Copy the full SHA
    678e217 View commit details
    Browse the repository at this point in the history
  2. libtest: Print the names of failed tests eagerly

    Previously, libtest would wait until all tests finished running to print the progress, which made it
    annoying to run many tests at once (since you don't know which have failed). Change it to print the
    names as soon as they fail.
    
    This also adds a test for the terse output; previously it was untested.
    jyn514 committed Mar 5, 2024
    Configuration menu
    Copy the full SHA
    8bfe9db View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    38a0227 View commit details
    Browse the repository at this point in the history
  4. Enable f16 and f128 in HIR

    tgross35 committed Mar 5, 2024
    Configuration menu
    Copy the full SHA
    6422be2 View commit details
    Browse the repository at this point in the history
  5. Add feature gates for f16 and f128

    Includes related tests and documentation pages.
    tgross35 committed Mar 5, 2024
    Configuration menu
    Copy the full SHA
    ad307fc View commit details
    Browse the repository at this point in the history
  6. Remove unneeded f16 and f128 parser tests

    Superceded by feature gate tests.
    tgross35 committed Mar 5, 2024
    Configuration menu
    Copy the full SHA
    1145ba0 View commit details
    Browse the repository at this point in the history
  7. Add UI tests related to feature-gated primitives

    Add a test that `f16` and `f128` are usable with the feature gate
    enabled, as well as a test that user types with the same name as
    primitives are not improperly gated.
    tgross35 committed Mar 5, 2024
    Configuration menu
    Copy the full SHA
    b8f45a3 View commit details
    Browse the repository at this point in the history
  8. Apply suggestions

    orion GONZALEZ (contractor) committed Mar 5, 2024
    Configuration menu
    Copy the full SHA
    beb45df View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    ebc45c8 View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    6120de9 View commit details
    Browse the repository at this point in the history

Commits on Mar 6, 2024

  1. Rollup merge of rust-lang#113518 - jyn514:streaming-failures, r=cuviper

    bootstrap/libtest: print test name eagerly on failure even with `verbose-tests=false` / `--quiet`
    
    Previously, libtest would wait until all tests finished running to print the progress, which made it
    annoying to run many tests at once (since you don't know which have failed). Change it to print the
    names as soon as they fail.
    
    This makes it much easier to know which test failed without having to wait for compiletest to completely finish running. Before:
    ```
    Testing stage0 compiletest suite=ui mode=ui (x86_64-unknown-linux-gnu)
    
    running 15274 tests
    iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii    88/15274
    iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii   176/15274
    iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii   264/15274
    iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii   352/15274
    iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii   440/15274
    iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii   528/15274
    iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiFFiiiiiii
    ...
    ```
    
    After:
    ```
    Testing stage0 compiletest suite=ui mode=ui (x86_64-unknown-linux-gnu)
    
    running 15274 tests
    iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii    88/15274
    iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii   176/15274
    iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii   264/15274
    iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii   352/15274
    iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii   440/15274
    iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii   528/15274
    iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
    [ui] tests/ui/associated-type-bounds/implied-in-supertrait.rs ... F
    
    [ui] tests/ui/associated-type-bounds/return-type-notation/basic.rs#next_with ... F
    iiiiiiiiiiiii
    ...
    ```
    
    This serves a similar use case to the existing RUSTC_TEST_FAIL_FAST, but is on by default and as a result much more discoverable. We should consider unifying RUSTC_TEST_FAIL_FAST with the `--no-fail-fast` flag in the future for consistency and discoverability.
    matthiaskrgr authored Mar 6, 2024
    Configuration menu
    Copy the full SHA
    b31c712 View commit details
    Browse the repository at this point in the history
  2. Rollup merge of rust-lang#119888 - weiznich:stablize_diagnostic_names…

    …pace, r=compiler-errors
    
    Stabilize the `#[diagnostic]` namespace and `#[diagnostic::on_unimplemented]` attribute
    
    This PR stabilizes the `#[diagnostic]` attribute namespace and a minimal option of the `#[diagnostic::on_unimplemented]` attribute.
    
    The `#[diagnostic]` attribute namespace is meant to provide a home for attributes that allow users to influence error messages emitted by the compiler. The compiler is not guaranteed to use any of this hints, however it should accept any (non-)existing attribute in this namespace and potentially emit lint-warnings for unused attributes and options. This is meant to allow discarding certain attributes/options in the future to allow fundamental changes to the compiler without the need to keep then non-meaningful options working.
    
    The `#[diagnostic::on_unimplemented]` attribute is allowed to appear on a trait definition. This allows crate authors to hint the compiler to emit a specific error message if a certain trait is not implemented. For the `#[diagnostic::on_unimplemented]` attribute the following options are implemented:
    
    * `message` which provides the text for the top level error message
    * `label` which provides the text for the label shown inline in the broken code in the error message
    * `note` which provides additional notes.
    
    The `note` option can appear several times, which results in several note messages being emitted. If any of the other options appears several times the first occurrence of the relevant option specifies the actually used value. Any other occurrence generates an lint warning. For any other non-existing option a lint-warning is generated.
    
    All three options accept a text as argument. This text is allowed to contain format parameters referring to generic argument or `Self` by name via the `{Self}` or `{NameOfGenericArgument}` syntax. For any non-existing argument a lint warning is generated.
    
    This allows to have a trait definition like:
    
    ```rust
    #[diagnostic::on_unimplemented(
        message = "My Message for `ImportantTrait<{A}>` is not implemented for `{Self}`",
        label = "My Label",
        note = "Note 1",
        note = "Note 2"
    )]
    trait ImportantTrait<A> {}
    
    ```
    
    which then generates for the following code
    
    ```rust
    fn use_my_trait(_: impl ImportantTrait<i32>) {}
    
    fn main() {
        use_my_trait(String::new());
    }
    ```
    
    this error message:
    
    ```
    error[E0277]: My Message for `ImportantTrait<i32>` is not implemented for `String`
      --> src/main.rs:14:18
       |
    14 |     use_my_trait(String::new());
       |     ------------ ^^^^^^^^^^^^^ My Label
       |     |
       |     required by a bound introduced by this call
       |
       = help: the trait `ImportantTrait<i32>` is not implemented for `String`
       = note: Note 1
       = note: Note 2
    ```
    
    [Playground with the unstable feature](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=05133acce8e1d163d481e97631f17536)
    
    Fixes rust-lang#111996
    matthiaskrgr authored Mar 6, 2024
    Configuration menu
    Copy the full SHA
    620446b View commit details
    Browse the repository at this point in the history
  3. Rollup merge of rust-lang#121752 - mu001999:dead_code/improve, r=pnkf…

    …elix
    
    Detect unused struct impls pub trait
    
    Fixes rust-lang#47851
    matthiaskrgr authored Mar 6, 2024
    Configuration menu
    Copy the full SHA
    744384c View commit details
    Browse the repository at this point in the history
  4. Rollup merge of rust-lang#121926 - tgross35:f16-f128-step3-feature-ga…

    …te, r=compiler-errors
    
    `f16` and `f128` step 3: compiler support & feature gate
    
    Continuation of rust-lang#121841, another portion of rust-lang#114607
    
    This PR exposes the new types to the world and adds a feature gate. Marking this as a draft because I need some feedback on where I did the feature gate check. It also does not yet catch type via suffixed literals (so the feature gate test will fail, probably some others too because I haven't belssed).
    
    If there is a better place to check all types after resolution, I can do that. If not, I figure maybe I can add a second gate location in AST when it checks numeric suffixes.
    
    Unfortunately I still don't think there is much testing to be done for correctness (codegen tests or parsed value checks) until we have basic library support. I think that will be the next step.
    
    Tracking issue: rust-lang#116909
    
    r? `@compiler-errors`
    cc `@Nilstrieb`
    `@rustbot` label +F-f16_and_f128
    matthiaskrgr authored Mar 6, 2024
    Configuration menu
    Copy the full SHA
    1e73b5d View commit details
    Browse the repository at this point in the history
  5. Rollup merge of rust-lang#121959 - sundeep-kokkonda:patch-2, r=davidtwco

    Removing absolute path in proc-macro
    
    With rust 1.75 the absolute build path name is embedding into proc-macro (.rustc section) and which causes reproducibility issues.
    Detailed issue description is here - rust-lang#120825 (comment)
    
    With this change the 'absolute path' changed back to '/rust/$hash' format as in earlier revisions.
    matthiaskrgr authored Mar 6, 2024
    Configuration menu
    Copy the full SHA
    3c05059 View commit details
    Browse the repository at this point in the history
  6. Rollup merge of rust-lang#122015 - dev-ardi:master, r=nnethercote

    Add better explanation for `rustc_index::IndexVec`
    
    I feel like I didn't do a great job explaining what this does in rust-lang#119800, so this PR tries to give an example of why and how you would use it.
    
    Addresses rust-lang#93792.
    matthiaskrgr authored Mar 6, 2024
    Configuration menu
    Copy the full SHA
    e5503b6 View commit details
    Browse the repository at this point in the history
  7. Rollup merge of rust-lang#122027 - compiler-errors:rpitit-cycle, r=sp…

    …astorino
    
    Uplift some feeding out of `associated_type_for_impl_trait_in_impl` and into queries
    
    This PR moves the `type_of` and `generics_of` query feeding out of `associated_type_for_impl_trait_in_impl`, since eagerly feeding results in query cycles due to a subtle interaction with `resolve_bound_vars`.
    
    Fixes rust-lang#122019
    
    r? spastorino
    matthiaskrgr authored Mar 6, 2024
    Configuration menu
    Copy the full SHA
    90a9718 View commit details
    Browse the repository at this point in the history
  8. Rollup merge of rust-lang#122038 - Alexendoo:unused-qualifications, r…

    …=petrochenkov
    
    Fix linting paths with qself in `unused_qualifications`
    
    Fixes rust-lang#121999
    
    `resolve_qpath` ends up being called again with `qself` set to `None` to check trait items from fully qualified paths. To avoid this the lint is moved to a place that accounts for this already
    
    https://github.com/rust-lang/rust/blob/96561a8fd134e8f2b205769a4fca03b392d9f484/compiler/rustc_resolve/src/late.rs#L4074-L4088
    
    r? `@petrochenkov`
    matthiaskrgr authored Mar 6, 2024
    Configuration menu
    Copy the full SHA
    0936b1c View commit details
    Browse the repository at this point in the history
  9. Rollup merge of rust-lang#121885 - reitermarkus:generic-nonzero-inner…

    …, r=oli-obk
    
    Move generic `NonZero` `rustc_layout_scalar_valid_range_start` attribute to inner type.
    
    Tracking issue: rust-lang#120257
    
    r? ``@dtolnay``
    matthiaskrgr authored Mar 6, 2024
    Configuration menu
    Copy the full SHA
    6fd5793 View commit details
    Browse the repository at this point in the history

Commits on Mar 8, 2024

  1. Configuration menu
    Copy the full SHA
    276f399 View commit details
    Browse the repository at this point in the history
  2. Fix lint.

    reitermarkus committed Mar 8, 2024
    Configuration menu
    Copy the full SHA
    59794f7 View commit details
    Browse the repository at this point in the history
  3. Fix miri tests.

    reitermarkus committed Mar 8, 2024
    Configuration menu
    Copy the full SHA
    42309b4 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    a58eb80 View commit details
    Browse the repository at this point in the history