Skip to content

Conversation

@JohnTitor
Copy link
Member

Previously, when an impl Trait captured multiple higher-ranked
lifetimes from an outer impl Trait, the compiler would emit a
separate error for each captured lifetime. This resulted in verbose
and confusing diagnostics, especially in edition 2024 where implicit
captures caused duplicate errors.

This commit introduces error accumulation that collects all capture
spans and lifetime declaration spans, then emits a single consolidated
diagnostic using MultiSpan. The new error shows all captured lifetimes
with visual indicators and lists all declarations in a single note.

r? @estebank
Fixes #143022

  Previously, when an `impl Trait` captured multiple higher-ranked
  lifetimes from an outer `impl Trait`, the compiler would emit a
  separate error for each captured lifetime. This resulted in verbose
  and confusing diagnostics, especially in edition 2024 where implicit
  captures caused duplicate errors.

  This commit introduces error accumulation that collects all capture
  spans and lifetime declaration spans, then emits a single consolidated
  diagnostic using MultiSpan. The new error shows all captured lifetimes
  with visual indicators and lists all declarations in a single note.
@rustbot rustbot added 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. labels Oct 12, 2025
@estebank
Copy link
Contributor

estebank commented Dec 9, 2025

@bors r+

@bors
Copy link
Collaborator

bors commented Dec 9, 2025

📌 Commit e4194c7 has been approved by estebank

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 Dec 9, 2025
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Dec 9, 2025
…rrors, r=estebank

Deduplicate higher-ranked lifetime capture errors in impl Trait

  Previously, when an `impl Trait` captured multiple higher-ranked
  lifetimes from an outer `impl Trait`, the compiler would emit a
  separate error for each captured lifetime. This resulted in verbose
  and confusing diagnostics, especially in edition 2024 where implicit
  captures caused duplicate errors.

  This commit introduces error accumulation that collects all capture
  spans and lifetime declaration spans, then emits a single consolidated
  diagnostic using MultiSpan. The new error shows all captured lifetimes
  with visual indicators and lists all declarations in a single note.

r? `@estebank`
Fixes rust-lang#143022
bors added a commit that referenced this pull request Dec 9, 2025
Rollup of 6 pull requests

Successful merges:

 - #147602 (Deduplicate higher-ranked lifetime capture errors in impl Trait)
 - #147725 (Remove -Zoom=panic)
 - #148491 ( Correctly provide suggestions when encountering `async fn` with a `dyn Trait` return type)
 - #148717 (Point at span within local macros even when error happens in nested external macro)
 - #149458 (Run clippy on cg_gcc in CI)
 - #149816 (Make typo in field and name suggestions verbose)

r? `@ghost`
`@rustbot` modify labels: rollup
Zalathar added a commit to Zalathar/rust that referenced this pull request Dec 10, 2025
…rrors, r=estebank

Deduplicate higher-ranked lifetime capture errors in impl Trait

  Previously, when an `impl Trait` captured multiple higher-ranked
  lifetimes from an outer `impl Trait`, the compiler would emit a
  separate error for each captured lifetime. This resulted in verbose
  and confusing diagnostics, especially in edition 2024 where implicit
  captures caused duplicate errors.

  This commit introduces error accumulation that collects all capture
  spans and lifetime declaration spans, then emits a single consolidated
  diagnostic using MultiSpan. The new error shows all captured lifetimes
  with visual indicators and lists all declarations in a single note.

r? ``@estebank``
Fixes rust-lang#143022
Zalathar added a commit to Zalathar/rust that referenced this pull request Dec 10, 2025
…rrors, r=estebank

Deduplicate higher-ranked lifetime capture errors in impl Trait

  Previously, when an `impl Trait` captured multiple higher-ranked
  lifetimes from an outer `impl Trait`, the compiler would emit a
  separate error for each captured lifetime. This resulted in verbose
  and confusing diagnostics, especially in edition 2024 where implicit
  captures caused duplicate errors.

  This commit introduces error accumulation that collects all capture
  spans and lifetime declaration spans, then emits a single consolidated
  diagnostic using MultiSpan. The new error shows all captured lifetimes
  with visual indicators and lists all declarations in a single note.

r? ```@estebank```
Fixes rust-lang#143022
bors added a commit that referenced this pull request Dec 10, 2025
Rollup of 12 pull requests

Successful merges:

 - #147602 (Deduplicate higher-ranked lifetime capture errors in impl Trait)
 - #147725 (Remove -Zoom=panic)
 - #148294 (callconv: fix mips64 aggregate argument passing for C FFI)
 - #148491 ( Correctly provide suggestions when encountering `async fn` with a `dyn Trait` return type)
 - #149417 (tidy: Detect outdated workspaces in workspace list)
 - #149458 (Run clippy on cg_gcc in CI)
 - #149679 (Restrict spe_acc to PowerPC SPE targets)
 - #149781 (Don't suggest wrapping attr in unsafe if it may come from proc macro)
 - #149795 (Use `let`...`else` instead of `match foo { ... _ => return };` and `if let ... else return` in std)
 - #149816 (Make typo in field and name suggestions verbose)
 - #149824 (Add a regression test for issue 145748)
 - #149826 (compiletest: tidy up `adb_path`/`adb_test_dir` handling)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors
Copy link
Collaborator

bors commented Dec 10, 2025

⌛ Testing commit e4194c7 with merge bad5026...

@bors
Copy link
Collaborator

bors commented Dec 10, 2025

☀️ Test successful - checks-actions
Approved by: estebank
Pushing bad5026 to main...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Dec 10, 2025
@bors bors merged commit bad5026 into rust-lang:main Dec 10, 2025
11 checks passed
@rustbot rustbot added this to the 1.94.0 milestone Dec 10, 2025
@github-actions
Copy link
Contributor

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 2e667b0 (parent) -> bad5026 (this PR)

Test differences

Show 6 test diffs

Stage 1

  • [ui] tests/ui/impl-trait/higher-ranked-lifetime-capture-deduplication.rs#edition2015: [missing] -> pass (J1)
  • [ui] tests/ui/impl-trait/higher-ranked-lifetime-capture-deduplication.rs#edition2024: [missing] -> pass (J1)

Stage 2

  • [ui] tests/ui/impl-trait/higher-ranked-lifetime-capture-deduplication.rs#edition2015: [missing] -> pass (J0)
  • [ui] tests/ui/impl-trait/higher-ranked-lifetime-capture-deduplication.rs#edition2024: [missing] -> pass (J0)

Additionally, 2 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 bad50269f8eb0fda214f0478c3afb2c6fbb427fd --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-apple-various: 4658.8s -> 3538.4s (-24.0%)
  2. x86_64-gnu-llvm-20: 2750.6s -> 2347.8s (-14.6%)
  3. x86_64-rust-for-linux: 3119.7s -> 2722.7s (-12.7%)
  4. armhf-gnu: 5535.3s -> 4902.2s (-11.4%)
  5. x86_64-gnu-llvm-21-3: 6642.7s -> 5893.1s (-11.3%)
  6. dist-aarch64-msvc: 5462.7s -> 6044.6s (+10.7%)
  7. aarch64-gnu-llvm-20-2: 2442.7s -> 2202.3s (-9.8%)
  8. i686-gnu-2: 6133.1s -> 5537.0s (-9.7%)
  9. i686-msvc-1: 9995.1s -> 10893.5s (+9.0%)
  10. aarch64-msvc-1: 6841.3s -> 7400.7s (+8.2%)
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 (bad5026): comparison URL.

Overall result: no relevant changes - no action needed

@rustbot label: -perf-regression

Instruction count

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

Max RSS (memory usage)

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

Cycles

Results (secondary -0.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.2% [2.2%, 2.2%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.4% [-2.4%, -2.4%] 1
All ❌✅ (primary) - - 0

Binary size

Results (primary -0.0%, secondary -0.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)
- - 0
Improvements ✅
(primary)
-0.0% [-0.0%, -0.0%] 27
Improvements ✅
(secondary)
-0.1% [-0.1%, -0.0%] 5
All ❌✅ (primary) -0.0% [-0.0%, -0.0%] 27

Bootstrap: 469.7s -> 472.547s (0.61%)
Artifact size: 388.99 MiB -> 389.02 MiB (0.01%)

@JohnTitor JohnTitor deleted the dedup-lifetime-capture-errors branch December 11, 2025 22:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merged-by-bors This PR was explicitly merged by bors. 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Higher-ranked lifetimes captured by impl Trait result in too many errors in 2024 edition

5 participants