Files
rust/tests/ui/impl-trait/issues/issue-67830.stderr
T
Yuki Okushi e4194c7075 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.
2025-10-12 16:51:28 +09:00

18 lines
718 B
Plaintext

error[E0657]: `impl Trait` cannot capture higher-ranked lifetime from outer `impl Trait`
--> $DIR/issue-67830.rs:20:48
|
LL | fn test() -> impl for<'a> MyFn<&'a A, Output = impl Iterator + 'a> {
| ^^^^^^^^^^^^^^^^--
| |
| `impl Trait` implicitly captures all lifetimes in scope
|
note: lifetime declared here
--> $DIR/issue-67830.rs:20:23
|
LL | fn test() -> impl for<'a> MyFn<&'a A, Output = impl Iterator + 'a> {
| ^^
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0657`.