Skip to content
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

Merged
merged 1 commit into from
Feb 2, 2022
Merged

Conversation

estebank
Copy link
Contributor

When writing Vec<A:B>, suggest Vec<A::B>.

@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Jan 11, 2022
@rust-highfive
Copy link
Collaborator

r? @cjgillot

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label 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;
| ~~
Copy link
Contributor Author

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 {
Copy link
Contributor Author

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.

@compiler-errors
Copy link
Member

FYI this addresses #91211, thanks for working on this, since I kinda gave up on it :-)

@cjgillot
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented Jan 28, 2022

📌 Commit 40f5ab1 has been approved by cjgillot

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 28, 2022
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>`.
@matthiaskrgr
Copy link
Member

Might need a rebase (failed in rollup: #93425 (comment) )
@bors r-

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jan 28, 2022
When writing `Vec<A:B>`, suggest `Vec<A::B>`.
@estebank
Copy link
Contributor Author

estebank commented Feb 2, 2022

@bors r=cjgillot

@bors
Copy link
Contributor

bors commented Feb 2, 2022

📌 Commit b26ad8d has been approved by cjgillot

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Feb 2, 2022
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
@bors bors merged commit 8ede21b into rust-lang:master Feb 2, 2022
@rustbot rustbot added this to the 1.60.0 milestone Feb 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants