-
Notifications
You must be signed in to change notification settings - Fork 13.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
E0277 incorrect suggested where
bound when type is impl Trait argument
#86488
Comments
Current output:
|
We might want to bisect the |
The diagnostic was introduced in #82194 cargo-rustc-bisect
Which was later removed and "progressed" in #97778 cargo-bisect-rustc
The fix did not add the test for this case as far as I see @rustbot label: -E-needs-bisection +A-trait-system |
Thanks for the bisection! I've checked PR #97778 and found tests/ui/suggestions/issue-97760.rs which checks exactly this case (I've manually verified it by running rustc 1.52). Closing as fixed by #97778. |
My reading is that tests/ui/suggestions/issue-97760.rs is a different issue. The error therein on 1.52 is
which is syntaxically incorrect ( That said, I'm by no means an expert, so if it's obvious to you that the two issues are actually closely enough related and that there's no need for an extra regression test - then I would trust you on that. |
Ah no, you're absolutely right, I was tired and misread the output |
I've now also relabeled this issue: While we're no longer emitting an invalid suggestion, I guess it would be nice if it could suggest replying the APIT with a type parameter in addition to introducing new bounds (tho converting APITs is not always possible and can be a breaking change). Free to add a regression test for the original issue (we should probably open a new issue for the above and keep this one E-needs-test). |
Given the following code (playground):
The current output is:
Following either of those suggestions yields code that doesn’t compile, because impl Trait isn’t allowed in that position. Even if it becomes allowed someday, I feel like they would still be incorrect, since each impl Trait need not refer to the same type?
Ideally the output should look like:
Examples are on stable (1.53.0), but this also affects 1.54.0-nightly (44456677b 2021-06-12).
The text was updated successfully, but these errors were encountered: