-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Detect ::
-> :
typo in type argument
#92788
Conversation
r? @cjgillot (rust-highfive has picked a reviewer for you, use r? to override) |
error[E0405]: cannot find trait `B` in this scope | ||
--> $DIR/type-ascription-instead-of-path-in-type.rs:6:18 | ||
| | ||
LL | let _: Vec<A:B> = A::B; | ||
| ^ not found in this scope | ||
| | ||
help: you might have meant to write a path instead of an associated type bound | ||
| | ||
LL | let _: Vec<A::B> = A::B; | ||
| ~~ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally we would silence all the errors after this one. It should be possible as a follow up.
{ | ||
continue; | ||
}; | ||
if base_span == trait_ref.span { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can make the suggestion always accurate by also checking if ident::trait_ref
would be a valid type.
FYI this addresses #91211, thanks for working on this, since I kinda gave up on it :-) |
@bors r+ |
📌 Commit 40f5ab1 has been approved by |
Detect `::` -> `:` typo in type argument When writing `Vec<A:B>`, suggest `Vec<A::B>`.
Might need a rebase (failed in rollup: #93425 (comment) ) |
When writing `Vec<A:B>`, suggest `Vec<A::B>`.
@bors r=cjgillot |
📌 Commit b26ad8d has been approved by |
Detect `::` -> `:` typo in type argument When writing `Vec<A:B>`, suggest `Vec<A::B>`.
…askrgr Rollup of 7 pull requests Successful merges: - rust-lang#92758 (librustdoc: impl core::fmt::Write for rustdoc::html::render::Buffer) - rust-lang#92788 (Detect `::` -> `:` typo in type argument) - rust-lang#93420 (Improve wrapping on settings page) - rust-lang#93493 (Document valid values of the char type) - rust-lang#93531 (Fix incorrect panic message in example) - rust-lang#93559 (Add missing | between print options) - rust-lang#93560 (Fix two incorrect "it's" (typos in comments)) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
When writing
Vec<A:B>
, suggestVec<A::B>
.