Rust diagnostic for impl Trait
suggests broken code
#97760
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Given the following code:
https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=87a0987f6c8b7b1a67b03338e2a4ed09
The issues also reproduces with the nightly version on the playground.
The current output is:
The proposed code has multiple problems.
The code doubles the
where
leading to broken Rust.The diagnostic correctly introduces the
I: IntoIterator
, but does not replace theimpl IntoIterator
in the function arguments.If you remove the
where
from the initial example, the diagnostic changes to include+++
markers for the added code. These seem helpful and to me it is not clear why they are missing initially.The text was updated successfully, but these errors were encountered: