Skip to content

Conversation

Zalathar
Copy link
Contributor

@Zalathar Zalathar commented Oct 6, 2025

Successful merges:

r? @ghost
@rustbot modify labels: rollup

Create a similar rollup

Enselic and others added 7 commits September 22, 2025 07:25
If a user does e.g.

    impl From<Bar> for foo::Foo

and get a compilation error about that `From<Bar>` is not implemented
for `Foo`, check if multiple versions of the crate with `Foo` is present
in the dependency graph. If so, give a hint about it.

I encountered this case in the wild and didn't realize I had multiple
versions of a crate in my dependency graph. So I was a bit confused at
first. This fix will make life easier for others.
…bjorn3

support link modifier `as-needed` for raw-dylib-elf

This pull request:

* emits `-Wl,--as-needed` instead of `-Wl,--no-as-needed` for `raw-dylib-elf`, keeping it consistent with `dylib`
* allows combination of link kind `raw-dylib` and link modifier `as-needed`, thus allowing free choice of behavior

r? `@bjorn3`

cc rust-lang#135694
cc rust-lang#99424
…ieyouxu

compiler: Hint at multiple crate versions if trait impl is for wrong ADT

If a user does e.g.

    impl From<Bar> for foo::Foo

and get a compilation error about that `From<Bar>` is not implemented for `Foo`, check if multiple versions of the crate with `Foo` is present in the dependency graph. If so, give a hint about it.

Note that a test is added as a separate commit so it is easy to see what effect the fix has on the emitted error message.

This can be seen as a continuation of rust-lang#124944.

I think this closes RUST-71693 but I haven't checked since it lacks a minimal reproducer. If this gets merged I'll ask that reporter if this fix works for them.

## Real world example

I encountered this case in the wild and didn't realize I had multiple versions of a crate in my dependency graph. So I was a bit confused at first. For reference, here is what that looked like.

<details>
<summary>Click to expand</summary>

### Before fix

```
error[E0277]: the trait bound `lambda_http::lambda_runtime::Diagnostic: From<Error>` is not satisfied
   --> src/main.rs:73:5
    |
73  |     lambda_http::run(service_fn(handle_event)).await
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `From<Error>` is not implemented for `lambda_http::lambda_runtime::Diagnostic`
    |
    = help: the following other types implement trait `From<T>`:
              `lambda_http::lambda_runtime::Diagnostic` implements `From<&str>`
              `lambda_http::lambda_runtime::Diagnostic` implements `From<Box<dyn StdError + Send + Sync>>`
              `lambda_http::lambda_runtime::Diagnostic` implements `From<Box<dyn StdError>>`
              `lambda_http::lambda_runtime::Diagnostic` implements `From<Infallible>`
              `lambda_http::lambda_runtime::Diagnostic` implements `From<lambda_runtime::deserializer::DeserializeError>`
              `lambda_http::lambda_runtime::Diagnostic` implements `From<std::io::Error>`
              `lambda_http::lambda_runtime::Diagnostic` implements `From<std::string::String>`
    = note: required for `Error` to implement `Into<lambda_http::lambda_runtime::Diagnostic>`
note: required by a bound in `lambda_http::run`
   --> /home/martin/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/lambda_http-0.17.0/src/lib.rs:199:26
    |
194 | pub async fn run<'a, R, S, E>(handler: S) -> Result<(), Error>
    |              --- required by a bound in this function
...
199 |     E: std::fmt::Debug + Into<Diagnostic>,
    |                          ^^^^^^^^^^^^^^^^ required by this bound in `run`

error[E0277]: the trait bound `lambda_http::lambda_runtime::Diagnostic: From<Error>` is not satisfied
   --> src/main.rs:73:48
    |
73  |     lambda_http::run(service_fn(handle_event)).await
    |                                                ^^^^^ the trait `From<Error>` is not implemented for `lambda_http::lambda_runtime::Diagnostic`
    |
    = help: the following other types implement trait `From<T>`:
              `lambda_http::lambda_runtime::Diagnostic` implements `From<&str>`
              `lambda_http::lambda_runtime::Diagnostic` implements `From<Box<dyn StdError + Send + Sync>>`
              `lambda_http::lambda_runtime::Diagnostic` implements `From<Box<dyn StdError>>`
              `lambda_http::lambda_runtime::Diagnostic` implements `From<Infallible>`
              `lambda_http::lambda_runtime::Diagnostic` implements `From<lambda_runtime::deserializer::DeserializeError>`
              `lambda_http::lambda_runtime::Diagnostic` implements `From<std::io::Error>`
              `lambda_http::lambda_runtime::Diagnostic` implements `From<std::string::String>`
    = note: required for `Error` to implement `Into<lambda_http::lambda_runtime::Diagnostic>`
note: required by a bound in `lambda_http::run`
   --> /home/martin/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/lambda_http-0.17.0/src/lib.rs:199:26
    |
194 | pub async fn run<'a, R, S, E>(handler: S) -> Result<(), Error>
    |              --- required by a bound in this function
...
199 |     E: std::fmt::Debug + Into<Diagnostic>,
    |                          ^^^^^^^^^^^^^^^^ required by this bound in `run`

For more information about this error, try `rustc --explain E0277`.
error: could not compile `auto-merge-dependabot-pull-requests-webhook` (bin "auto-merge-dependabot-pull-requests-webhook") due to 2 previous errors
```

### After fix

```
   Compiling auto-merge-dependabot-pull-requests-webhook v0.1.0 (/home/martin/src/auto-merge-dependabot-prs/rust-webhook)
error[E0277]: the trait bound `lambda_http::lambda_runtime::Diagnostic: From<Error>` is not satisfied
   --> src/main.rs:73:5
    |
 73 |     lambda_http::run(service_fn(handle_event)).await
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `From<Error>` is not implemented for `lambda_http::lambda_runtime::Diagnostic`
    |
help: item with same name found
   --> /home/martin/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/lambda_runtime-0.13.0/src/diagnostic.rs:43:1
    |
 43 | pub struct Diagnostic {
    | ^^^^^^^^^^^^^^^^^^^^^
    = note: perhaps two different versions of crate `lambda_runtime` are being used?
    = help: the following other types implement trait `From<T>`:
              `lambda_http::lambda_runtime::Diagnostic` implements `From<&str>`
              `lambda_http::lambda_runtime::Diagnostic` implements `From<Box<dyn StdError + Send + Sync>>`
              `lambda_http::lambda_runtime::Diagnostic` implements `From<Box<dyn StdError>>`
              `lambda_http::lambda_runtime::Diagnostic` implements `From<Infallible>`
              `lambda_http::lambda_runtime::Diagnostic` implements `From<lambda_runtime::deserializer::DeserializeError>`
              `lambda_http::lambda_runtime::Diagnostic` implements `From<std::io::Error>`
              `lambda_http::lambda_runtime::Diagnostic` implements `From<std::string::String>`
    = note: required for `Error` to implement `Into<lambda_http::lambda_runtime::Diagnostic>`
note: required by a bound in `lambda_http::run`
   --> /home/martin/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/lambda_http-0.17.0/src/lib.rs:199:26
    |
194 | pub async fn run<'a, R, S, E>(handler: S) -> Result<(), Error>
    |              --- required by a bound in this function
...
199 |     E: std::fmt::Debug + Into<Diagnostic>,
    |                          ^^^^^^^^^^^^^^^^ required by this bound in `run`

error[E0277]: the trait bound `lambda_http::lambda_runtime::Diagnostic: From<Error>` is not satisfied
   --> src/main.rs:73:48
    |
 73 |     lambda_http::run(service_fn(handle_event)).await
    |                                                ^^^^^ the trait `From<Error>` is not implemented for `lambda_http::lambda_runtime::Diagnostic`
    |
help: item with same name found
   --> /home/martin/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/lambda_runtime-0.13.0/src/diagnostic.rs:43:1
    |
 43 | pub struct Diagnostic {
    | ^^^^^^^^^^^^^^^^^^^^^
    = note: perhaps two different versions of crate `lambda_runtime` are being used?
    = help: the following other types implement trait `From<T>`:
              `lambda_http::lambda_runtime::Diagnostic` implements `From<&str>`
              `lambda_http::lambda_runtime::Diagnostic` implements `From<Box<dyn StdError + Send + Sync>>`
              `lambda_http::lambda_runtime::Diagnostic` implements `From<Box<dyn StdError>>`
              `lambda_http::lambda_runtime::Diagnostic` implements `From<Infallible>`
              `lambda_http::lambda_runtime::Diagnostic` implements `From<lambda_runtime::deserializer::DeserializeError>`
              `lambda_http::lambda_runtime::Diagnostic` implements `From<std::io::Error>`
              `lambda_http::lambda_runtime::Diagnostic` implements `From<std::string::String>`
    = note: required for `Error` to implement `Into<lambda_http::lambda_runtime::Diagnostic>`
note: required by a bound in `lambda_http::run`
   --> /home/martin/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/lambda_http-0.17.0/src/lib.rs:199:26
    |
194 | pub async fn run<'a, R, S, E>(handler: S) -> Result<(), Error>
    |              --- required by a bound in this function
...
199 |     E: std::fmt::Debug + Into<Diagnostic>,
    |                          ^^^^^^^^^^^^^^^^ required by this bound in `run`

For more information about this error, try `rustc --explain E0277`.
error: could not compile `auto-merge-dependabot-pull-requests-webhook` (bin "auto-merge-dependabot-pull-requests-webhook") due to 2 previous errors
```

</details>

try-job: dist-various-1
try-job: aarch64-msvc-1
…imize-end_expansion, r=GuillaumeGomez

[rustdoc] Cleanup "highlight::end_expansion"

~Looks like a ~5% improvement on the highlight benchmark.
Obviously, highlighting is only a small part of rustdoc's runtime, so improvement won't be as large on rustc-perf (if there's even an improvement), but holding fingers for a nice gain.~

Perf seems neutral, but IMHO this is a nice small cleanup regardless.

r? `@GuillaumeGomez` (& perf run please!)
@rustbot rustbot added A-attributes Area: Attributes (`#[…]`, `#![…]`) A-run-make Area: port run-make Makefiles to rmake.rs S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output. rollup A PR which is a rollup labels Oct 6, 2025
@Zalathar
Copy link
Contributor Author

Zalathar commented Oct 6, 2025

@bors r+ rollup=never p=5

@bors
Copy link
Collaborator

bors commented Oct 6, 2025

📌 Commit c8113a7 has been approved by Zalathar

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 6, 2025
@bors
Copy link
Collaborator

bors commented Oct 6, 2025

⌛ Testing commit c8113a7 with merge 8111a2d...

@bors
Copy link
Collaborator

bors commented Oct 6, 2025

☀️ Test successful - checks-actions
Approved by: Zalathar
Pushing 8111a2d to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Oct 6, 2025
@bors bors merged commit 8111a2d into rust-lang:master Oct 6, 2025
11 checks passed
@rustbot rustbot added this to the 1.92.0 milestone Oct 6, 2025
@rust-timer
Copy link
Collaborator

📌 Perf builds for each rolled up PR:

PR# Message Perf Build Sha
#146027 support link modifier as-needed for raw-dylib-elf 578138ce9e5010ed99cdecf7704a40861002108c (link)
#146874 compiler: Hint at multiple crate versions if trait impl is … 8f103bc5d50bed5cf5de2f36a48011e75e98e91a (link)
#147237 [rustdoc] Cleanup "highlight::end_expansion" a2685c0e7428b32f3622fab7782521af3dcc584c (link)

previous master: d2acb427e4

In the case of a perf regression, run the following command for each PR you suspect might be the cause: @rust-timer build $SHA

Copy link
Contributor

github-actions bot commented Oct 6, 2025

What is this? This is an experimental post-merge analysis report that shows differences in test outcomes between the merged PR and its parent PR.

Comparing d2acb42 (parent) -> 8111a2d (this PR)

Test differences

Show 44 test diffs

Stage 1

  • [run-make] tests/run-make/duplicate-dependency: [missing] -> pass (J0)
  • [ui] tests/ui/linkage-attr/raw-dylib/elf/as_needed.rs#as_needed: [missing] -> pass (J0)
  • [ui] tests/ui/linkage-attr/raw-dylib/elf/as_needed.rs#merge_1: [missing] -> pass (J0)
  • [ui] tests/ui/linkage-attr/raw-dylib/elf/as_needed.rs#merge_2: [missing] -> pass (J0)
  • [ui] tests/ui/linkage-attr/raw-dylib/elf/as_needed.rs#merge_3: [missing] -> pass (J0)
  • [ui] tests/ui/linkage-attr/raw-dylib/elf/as_needed.rs#merge_4: [missing] -> pass (J0)
  • [ui] tests/ui/linkage-attr/raw-dylib/elf/as_needed.rs#no_as_needed: [missing] -> pass (J0)
  • [ui] tests/ui/linkage-attr/raw-dylib/elf/as_needed.rs#no_modifier: [missing] -> pass (J0)

Stage 2

  • [ui] tests/ui/linkage-attr/raw-dylib/elf/as_needed.rs#as_needed: [missing] -> ignore (only executed when the architecture is x86_64) (J1)
  • [ui] tests/ui/linkage-attr/raw-dylib/elf/as_needed.rs#merge_1: [missing] -> ignore (only executed when the architecture is x86_64) (J1)
  • [ui] tests/ui/linkage-attr/raw-dylib/elf/as_needed.rs#merge_2: [missing] -> ignore (only executed when the architecture is x86_64) (J1)
  • [ui] tests/ui/linkage-attr/raw-dylib/elf/as_needed.rs#merge_3: [missing] -> ignore (only executed when the architecture is x86_64) (J1)
  • [ui] tests/ui/linkage-attr/raw-dylib/elf/as_needed.rs#merge_4: [missing] -> ignore (only executed when the architecture is x86_64) (J1)
  • [ui] tests/ui/linkage-attr/raw-dylib/elf/as_needed.rs#no_as_needed: [missing] -> ignore (only executed when the architecture is x86_64) (J1)
  • [ui] tests/ui/linkage-attr/raw-dylib/elf/as_needed.rs#no_modifier: [missing] -> ignore (only executed when the architecture is x86_64) (J1)
  • [ui] tests/ui/linkage-attr/raw-dylib/elf/as_needed.rs#as_needed: [missing] -> ignore (only executed when the target binary format is ELF) (J2)
  • [ui] tests/ui/linkage-attr/raw-dylib/elf/as_needed.rs#merge_1: [missing] -> ignore (only executed when the target binary format is ELF) (J2)
  • [ui] tests/ui/linkage-attr/raw-dylib/elf/as_needed.rs#merge_2: [missing] -> ignore (only executed when the target binary format is ELF) (J2)
  • [ui] tests/ui/linkage-attr/raw-dylib/elf/as_needed.rs#merge_3: [missing] -> ignore (only executed when the target binary format is ELF) (J2)
  • [ui] tests/ui/linkage-attr/raw-dylib/elf/as_needed.rs#merge_4: [missing] -> ignore (only executed when the target binary format is ELF) (J2)
  • [ui] tests/ui/linkage-attr/raw-dylib/elf/as_needed.rs#no_as_needed: [missing] -> ignore (only executed when the target binary format is ELF) (J2)
  • [ui] tests/ui/linkage-attr/raw-dylib/elf/as_needed.rs#no_modifier: [missing] -> ignore (only executed when the target binary format is ELF) (J2)
  • [ui] tests/ui/linkage-attr/raw-dylib/elf/as_needed.rs#as_needed: [missing] -> pass (J3)
  • [ui] tests/ui/linkage-attr/raw-dylib/elf/as_needed.rs#merge_1: [missing] -> pass (J3)
  • [ui] tests/ui/linkage-attr/raw-dylib/elf/as_needed.rs#merge_2: [missing] -> pass (J3)
  • [ui] tests/ui/linkage-attr/raw-dylib/elf/as_needed.rs#merge_3: [missing] -> pass (J3)
  • [ui] tests/ui/linkage-attr/raw-dylib/elf/as_needed.rs#merge_4: [missing] -> pass (J3)
  • [ui] tests/ui/linkage-attr/raw-dylib/elf/as_needed.rs#no_as_needed: [missing] -> pass (J3)
  • [ui] tests/ui/linkage-attr/raw-dylib/elf/as_needed.rs#no_modifier: [missing] -> pass (J3)
  • [ui] tests/ui/linkage-attr/raw-dylib/elf/as_needed.rs#as_needed: [missing] -> ignore (only executed when the target environment is gnu) (J4)
  • [ui] tests/ui/linkage-attr/raw-dylib/elf/as_needed.rs#merge_1: [missing] -> ignore (only executed when the target environment is gnu) (J4)
  • [ui] tests/ui/linkage-attr/raw-dylib/elf/as_needed.rs#merge_2: [missing] -> ignore (only executed when the target environment is gnu) (J4)
  • [ui] tests/ui/linkage-attr/raw-dylib/elf/as_needed.rs#merge_3: [missing] -> ignore (only executed when the target environment is gnu) (J4)
  • [ui] tests/ui/linkage-attr/raw-dylib/elf/as_needed.rs#merge_4: [missing] -> ignore (only executed when the target environment is gnu) (J4)
  • [ui] tests/ui/linkage-attr/raw-dylib/elf/as_needed.rs#no_as_needed: [missing] -> ignore (only executed when the target environment is gnu) (J4)
  • [ui] tests/ui/linkage-attr/raw-dylib/elf/as_needed.rs#no_modifier: [missing] -> ignore (only executed when the target environment is gnu) (J4)
  • [run-make] tests/run-make/duplicate-dependency: [missing] -> pass (J5)
  • [run-make] tests/run-make/duplicate-dependency: [missing] -> ignore (ignored if target does not support std) (J6)

Additionally, 6 doctest diffs were found. These are ignored, as they are noisy.

Job group index

Test dashboard

Run

cargo run --manifest-path src/ci/citool/Cargo.toml -- \
    test-dashboard 8111a2d6da405e9684a8a83c2c9d69036bf23f12 --output-dir test-dashboard

And then open test-dashboard/index.html in your browser to see an overview of all executed tests.

Job duration changes

  1. dist-aarch64-linux: 8598.4s -> 6400.6s (-25.6%)
  2. x86_64-rust-for-linux: 2587.8s -> 3076.5s (18.9%)
  3. aarch64-gnu-llvm-20-2: 2186.7s -> 2466.1s (12.8%)
  4. aarch64-msvc-1: 6881.8s -> 7742.6s (12.5%)
  5. dist-aarch64-apple: 9301.6s -> 8138.2s (-12.5%)
  6. x86_64-gnu-tools: 3388.8s -> 3802.2s (12.2%)
  7. aarch64-gnu-debug: 3800.1s -> 4262.6s (12.2%)
  8. dist-aarch64-msvc: 5404.9s -> 6021.7s (11.4%)
  9. i686-gnu-nopt-1: 7319.9s -> 8154.8s (11.4%)
  10. aarch64-gnu: 6358.5s -> 7037.5s (10.7%)
How to interpret the job duration changes?

Job durations can vary a lot, based on the actual runner instance
that executed the job, system noise, invalidated caches, etc. The table above is provided
mostly for t-infra members, for simpler debugging of potential CI slow-downs.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (8111a2d): comparison URL.

Overall result: ✅ improvements - no action needed

@rustbot label: -perf-regression

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-0.9% [-1.0%, -0.8%] 6
All ❌✅ (primary) - - 0

Max RSS (memory usage)

Results (primary -2.6%, secondary -1.1%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
2.0% [2.0%, 2.0%] 1
Improvements ✅
(primary)
-2.6% [-2.8%, -2.5%] 2
Improvements ✅
(secondary)
-4.1% [-4.1%, -4.1%] 1
All ❌✅ (primary) -2.6% [-2.8%, -2.5%] 2

Cycles

Results (secondary -0.9%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
3.2% [3.2%, 3.2%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.3% [-2.4%, -2.1%] 3
All ❌✅ (primary) - - 0

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 470.924s -> 471.909s (0.21%)
Artifact size: 388.38 MiB -> 388.29 MiB (-0.02%)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-attributes Area: Attributes (`#[…]`, `#![…]`) A-run-make Area: port run-make Makefiles to rmake.rs merged-by-bors This PR was explicitly merged by bors. rollup A PR which is a rollup S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants