rust/tests/ui/impl-trait/issues
bors bad50269f8 Auto merge of #147602 - JohnTitor:dedup-lifetime-capture-errors, 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 https://github.com/rust-lang/rust/issues/143022
2025-12-10 06:52:27 +00:00
..
fuzzer-ice-issue-112201.rs add TypingMode::Borrowck 2025-04-03 11:13:10 +02:00
fuzzer-ice-issue-112201.stderr add TypingMode::Borrowck 2025-04-03 11:13:10 +02:00
infinite-impl-trait-issue-38064.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
infinite-impl-trait-issue-38064.stderr Bless tests. 2023-01-27 20:10:17 +00:00
issue-21659-show-relevant-trait-impls-3.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
issue-21659-show-relevant-trait-impls-3.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
issue-35668.rs move (and remove) impl Trait tests 2025-05-09 02:35:18 +00:00
issue-35668.stderr move (and remove) impl Trait tests 2025-05-09 02:35:18 +00:00
issue-36792.rs move (and remove) impl Trait tests 2025-05-09 02:35:18 +00:00
issue-42479.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
issue-46959.rs move (and remove) impl Trait tests 2025-05-09 02:35:18 +00:00
issue-49376.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
issue-49556.rs move (and remove) impl Trait tests 2025-05-09 02:35:18 +00:00
issue-49579.rs move (and remove) impl Trait tests 2025-05-09 02:35:18 +00:00
issue-49685.rs move (and remove) impl Trait tests 2025-05-09 02:35:18 +00:00
issue-51185.rs move (and remove) impl Trait tests 2025-05-09 02:35:18 +00:00
issue-52128.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
issue-53457.rs Implement #[define_opaque] attribute for functions. 2025-03-11 12:05:02 +00:00
issue-54600.rs UI tests: add missing diagnostic kinds where possible 2025-04-08 23:06:31 +03:00
issue-54600.stderr (Re-)Implement impl_trait_in_bindings 2024-12-14 03:21:24 +00:00
issue-54840.rs UI tests: add missing diagnostic kinds where possible 2025-04-08 23:06:31 +03:00
issue-54840.stderr (Re-)Implement impl_trait_in_bindings 2024-12-14 03:21:24 +00:00
issue-54895.edition2015.stderr Deduplicate higher-ranked lifetime capture errors in impl Trait 2025-10-12 16:51:28 +09:00
issue-54895.edition2024.stderr Deduplicate higher-ranked lifetime capture errors in impl Trait 2025-10-12 16:51:28 +09:00
issue-54895.rs Deduplicate higher-ranked lifetime capture errors in impl Trait 2025-10-12 16:51:28 +09:00
issue-54966.rs move (and remove) impl Trait tests 2025-05-09 02:35:18 +00:00
issue-54966.stderr Merge E0412 into E0425 2025-12-02 18:25:13 +00:00
issue-55608-captures-empty-region.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
issue-55872-1.rs move (and remove) impl Trait tests 2025-05-09 02:35:18 +00:00
issue-55872-1.stderr move (and remove) impl Trait tests 2025-05-09 02:35:18 +00:00
issue-55872-2.rs Remove the witness type from coroutine args 2025-07-31 17:38:28 +00:00
issue-55872-2.stderr Remove the witness type from coroutine args 2025-07-31 17:38:28 +00:00
issue-55872-3.rs Remove the witness type from coroutine args 2025-07-31 17:38:28 +00:00
issue-55872-3.stderr Remove the witness type from coroutine args 2025-07-31 17:38:28 +00:00
issue-55872.rs move (and remove) impl Trait tests 2025-05-09 02:35:18 +00:00
issue-55872.stderr move (and remove) impl Trait tests 2025-05-09 02:35:18 +00:00
issue-56445.rs move (and remove) impl Trait tests 2025-05-09 02:35:18 +00:00
issue-57464-unexpected-regions.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
issue-57979-deeply-nested-impl-trait-in-assoc-proj.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
issue-57979-deeply-nested-impl-trait-in-assoc-proj.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
issue-57979-impl-trait-in-path.rs Move an impl-Trait check from AST validation to AST lowering 2024-10-27 07:41:52 +01:00
issue-57979-impl-trait-in-path.stderr Move an impl-Trait check from AST validation to AST lowering 2024-10-27 07:41:52 +01:00
issue-57979-nested-impl-trait-in-assoc-proj.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
issue-57979-nested-impl-trait-in-assoc-proj.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
issue-58504.rs UI tests: add missing diagnostic kinds where possible 2025-04-08 23:06:31 +03:00
issue-58504.stderr (Re-)Implement impl_trait_in_bindings 2024-12-14 03:21:24 +00:00
issue-58956.rs UI tests: add missing diagnostic kinds where possible 2025-04-08 23:06:31 +03:00
issue-58956.stderr (Re-)Implement impl_trait_in_bindings 2024-12-14 03:21:24 +00:00
issue-62742.rs Relate receiver invariantly in method probe for Mode::Path 2024-09-16 10:55:07 -04:00
issue-62742.stderr When a trait isn't implemented, but another similar impl is found, point at it: 2025-10-31 20:38:31 +00:00
issue-65581.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
issue-67830.rs Stop proving outlives constraints on regions we already reported errors on 2024-05-29 09:27:07 +00:00
issue-67830.stderr Deduplicate higher-ranked lifetime capture errors in impl Trait 2025-10-12 16:51:28 +09:00
issue-68532.rs move (and remove) impl Trait tests 2025-05-09 02:35:18 +00:00
issue-70877.rs Implement #[define_opaque] attribute for functions. 2025-03-11 12:05:02 +00:00
issue-70877.stderr Implement #[define_opaque] attribute for functions. 2025-03-11 12:05:02 +00:00
issue-70971.rs UI tests: add missing diagnostic kinds where possible 2025-04-08 23:06:31 +03:00
issue-70971.stderr (Re-)Implement impl_trait_in_bindings 2024-12-14 03:21:24 +00:00
issue-72911.rs move (and remove) impl Trait tests 2025-05-09 02:35:18 +00:00
issue-72911.stderr move (and remove) impl Trait tests 2025-05-09 02:35:18 +00:00
issue-74282.rs Implement #[define_opaque] attribute for functions. 2025-03-11 12:05:02 +00:00
issue-74282.stderr Implement #[define_opaque] attribute for functions. 2025-03-11 12:05:02 +00:00
issue-77987.rs Implement #[define_opaque] attribute for functions. 2025-03-11 12:05:02 +00:00
issue-78722-2.rs Implement #[define_opaque] attribute for functions. 2025-03-11 12:05:02 +00:00
issue-78722-2.stderr Implement #[define_opaque] attribute for functions. 2025-03-11 12:05:02 +00:00
issue-78722.rs Implement #[define_opaque] attribute for functions. 2025-03-11 12:05:02 +00:00
issue-78722.stderr Implement #[define_opaque] attribute for functions. 2025-03-11 12:05:02 +00:00
issue-79099.edition2015.stderr Add edition checks for some tests that had divergent output 2025-06-25 17:02:26 +00:00
issue-79099.edition2024.stderr Add edition checks for some tests that had divergent output 2025-06-25 17:02:26 +00:00
issue-79099.rs Add edition checks for some tests that had divergent output 2025-06-25 17:02:26 +00:00
issue-82139.rs Split out a separate feature gate for impl trait in associated types 2023-04-12 16:17:31 +00:00
issue-82139.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
issue-83919.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
issue-83919.stderr Use root obligation on E0277 for some cases 2024-03-03 18:53:35 +00:00
issue-83929-impl-trait-in-generic-default.rs Split note, fix const/static impl trait error 2024-01-07 18:00:03 +00:00
issue-83929-impl-trait-in-generic-default.stderr Split note, fix const/static impl trait error 2024-01-07 18:00:03 +00:00
issue-84073.rs Use sup instead of eq when unifying self type 2024-04-21 20:10:12 -04:00
issue-84073.stderr Use sup instead of eq when unifying self type 2024-04-21 20:10:12 -04:00
issue-84919.rs UI tests: add missing diagnostic kinds where possible 2025-04-08 23:06:31 +03:00
issue-84919.stderr (Re-)Implement impl_trait_in_bindings 2024-12-14 03:21:24 +00:00
issue-86201.rs Implement #[define_opaque] attribute for functions. 2025-03-11 12:05:02 +00:00
issue-86642.rs UI tests: add missing diagnostic kinds where possible 2025-04-08 23:06:31 +03:00
issue-86642.stderr Split note, fix const/static impl trait error 2024-01-07 18:00:03 +00:00
issue-86719.rs Split out a separate feature gate for impl trait in associated types 2023-04-12 16:17:31 +00:00
issue-86719.stderr Split out a separate feature gate for impl trait in associated types 2023-04-12 16:17:31 +00:00
issue-86800.rs add TypingMode::Borrowck 2025-04-03 11:13:10 +02:00
issue-86800.stderr add TypingMode::Borrowck 2025-04-03 11:13:10 +02:00
issue-87295.rs UI tests: add missing diagnostic kinds where possible 2025-04-08 23:06:31 +03:00
issue-87295.stderr (Re-)Implement impl_trait_in_bindings 2024-12-14 03:21:24 +00:00
issue-87340.rs Do not project when there are unconstrained impl params 2025-01-03 05:01:14 +00:00
issue-87340.stderr Do not project when there are unconstrained impl params 2025-01-03 05:01:14 +00:00
issue-87450.rs Just error on recursive opaque ty in HIR typeck 2025-05-20 10:08:56 +00:00
issue-87450.stderr Just error on recursive opaque ty in HIR typeck 2025-05-20 10:08:56 +00:00
issue-88236-2.rs Stop proving outlives constraints on regions we already reported errors on 2024-05-29 09:27:07 +00:00
issue-88236-2.stderr Deduplicate higher-ranked lifetime capture errors in impl Trait 2025-10-12 16:51:28 +09:00
issue-88236.rs Improve error message for opaque captures 2024-03-08 19:08:13 +00:00
issue-88236.stderr Deduplicate higher-ranked lifetime capture errors in impl Trait 2025-10-12 16:51:28 +09:00
issue-89312.rs Implement #[define_opaque] attribute for functions. 2025-03-11 12:05:02 +00:00
issue-92305.rs Bless test fallout (duplicate diagnostics) 2024-03-20 13:00:34 -04:00
issue-92305.stderr Bless test fallout (duplicate diagnostics) 2024-03-20 13:00:34 -04:00
issue-93788.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
issue-99073-2.rs move (and remove) impl Trait tests 2025-05-09 02:35:18 +00:00
issue-99073-2.stderr move (and remove) impl Trait tests 2025-05-09 02:35:18 +00:00
issue-99073.rs move (and remove) impl Trait tests 2025-05-09 02:35:18 +00:00
issue-99073.stderr move (and remove) impl Trait tests 2025-05-09 02:35:18 +00:00
issue-99348-impl-compatibility.rs UI tests: add missing diagnostic kinds where possible 2025-04-08 23:06:31 +03:00
issue-99348-impl-compatibility.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
issue-99642-2.rs move (and remove) impl Trait tests 2025-05-09 02:35:18 +00:00
issue-99642.rs move (and remove) impl Trait tests 2025-05-09 02:35:18 +00:00
issue-99914.rs move (and remove) impl Trait tests 2025-05-09 02:35:18 +00:00
issue-99914.stderr move (and remove) impl Trait tests 2025-05-09 02:35:18 +00:00
issue-100075-2.rs move (and remove) impl Trait tests 2025-05-09 02:35:18 +00:00
issue-100075-2.stderr Just error on recursive opaque ty in HIR typeck 2025-05-20 10:08:56 +00:00
issue-100075.rs move (and remove) impl Trait tests 2025-05-09 02:35:18 +00:00
issue-100075.stderr Just error on recursive opaque ty in HIR typeck 2025-05-20 10:08:56 +00:00
issue-100187.rs move (and remove) impl Trait tests 2025-05-09 02:35:18 +00:00
issue-102605.rs move (and remove) impl Trait tests 2025-05-09 02:35:18 +00:00
issue-102605.stderr move (and remove) impl Trait tests 2025-05-09 02:35:18 +00:00
issue-103181-1.current.stderr move (and remove) impl Trait tests 2025-05-09 02:35:18 +00:00
issue-103181-1.next.stderr move (and remove) impl Trait tests 2025-05-09 02:35:18 +00:00
issue-103181-1.rs move (and remove) impl Trait tests 2025-05-09 02:35:18 +00:00
issue-103181-2.rs move (and remove) impl Trait tests 2025-05-09 02:35:18 +00:00
issue-103181-2.stderr move (and remove) impl Trait tests 2025-05-09 02:35:18 +00:00
issue-103599.rs Just error on recursive opaque ty in HIR typeck 2025-05-20 10:08:56 +00:00
issue-103599.stderr Just error on recursive opaque ty in HIR typeck 2025-05-20 10:08:56 +00:00
issue-104815.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
issue-105826.rs borrowck: more eagerly prepopulate opaques 2024-05-06 16:04:57 +00:00
issue-108591.rs move (and remove) impl Trait tests 2025-05-09 02:35:18 +00:00
issue-108592.rs move (and remove) impl Trait tests 2025-05-09 02:35:18 +00:00
type-error-post-normalization-test.rs borrowck: defer opaque type errors 2025-08-08 19:24:53 +02:00
type-error-post-normalization-test.stderr borrowck: defer opaque type errors 2025-08-08 19:24:53 +02:00