Detect :: -> : typo in type argument#92788
Merged
bors merged 1 commit intorust-lang:masterfrom Feb 2, 2022
Merged
Conversation
Contributor
|
r? @cjgillot (rust-highfive has picked a reviewer for you, use r? to override) |
estebank
commented
Jan 11, 2022
Comment on lines
+1
to
+10
| 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; | ||
| | ~~ |
Contributor
Author
There was a problem hiding this comment.
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 { |
Contributor
Author
There was a problem hiding this comment.
We can make the suggestion always accurate by also checking if ident::trait_ref would be a valid type.
Contributor
|
FYI this addresses #91211, thanks for working on this, since I kinda gave up on it :-) |
Contributor
|
@bors r+ |
Collaborator
|
📌 Commit 40f5ab1 has been approved by |
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this pull request
Jan 28, 2022
Detect `::` -> `:` typo in type argument When writing `Vec<A:B>`, suggest `Vec<A::B>`.
Member
|
Might need a rebase (failed in rollup: #93425 (comment) ) |
When writing `Vec<A:B>`, suggest `Vec<A::B>`.
Contributor
Author
|
@bors r=cjgillot |
Collaborator
|
📌 Commit b26ad8d has been approved by |
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this pull request
Feb 2, 2022
Detect `::` -> `:` typo in type argument When writing `Vec<A:B>`, suggest `Vec<A::B>`.
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Feb 2, 2022
…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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When writing
Vec<A:B>, suggestVec<A::B>.