Deduplicate :: -> : typo errors#74210
Conversation
af493d2 to
06cab8e
Compare
|
I made some indentation changes in a block, so you might prefer to ignore whitespace in the diff. |
ab72aff to
ba3cf12
Compare
|
(@petrochenkov I can remove the last commit and not handle those cases in this PR) |
d716e33 to
fe758bb
Compare
| | | ||
| LL | let _ = Foo:A; | ||
| | ^ help: write a path separator instead: `::` | ||
|
|
There was a problem hiding this comment.
For reference, this is the current output:
error: expected type, found `2`
--> src/main.rs:6:19
|
6 | let _ = Foo:B(2); //~ ERROR expected type
| - ^ expected type
| |
| help: maybe write a path separator here: `::`
|
= note: `#![feature(type_ascription)]` lets you annotate an expression with a type: `<expr>: <type>`
error: expected one of `!`, `(`, `.`, `::`, `;`, `<`, or `?`, found `{`
--> src/main.rs:9:19
|
9 | let _ = Foo:C { x: 1 }; //~ ERROR expected one of
| - ^ expected one of 7 possible tokens
| |
| help: maybe write a path separator here: `::`
|
= note: `#![feature(type_ascription)]` lets you annotate an expression with a type: `<expr>: <type>`
error: expected type, found reserved keyword `box`
--> src/main.rs:2:25
|
2 | let _ = Option:Some(vec![0, 1]); //~ ERROR expected type, found
| - ^^^^^^^^^^
| | |
| | expected type
| | in this macro invocation
| | this macro call doesn't expand to a type
| help: maybe write a path separator here: `::`
|
= note: `#![feature(type_ascription)]` lets you annotate an expression with a type: `<expr>: <type>`
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0423]: expected value, found enum `Option`
--> src/main.rs:2:13
|
2 | let _ = Option:Some(vec![0, 1]); //~ ERROR expected type, found
| ^^^^^^
|
help: try using one of the enum's variants
|
2 | let _ = std::option::Option::None:Some(vec![0, 1]); //~ ERROR expected type, found
| ^^^^^^^^^^^^^^^^^^^^^^^^^
2 | let _ = std::option::Option::Some:Some(vec![0, 1]); //~ ERROR expected type, found
| ^^^^^^^^^^^^^^^^^^^^^^^^^
help: consider importing one of these items instead
|
1 | use serde::de::Unexpected::Option;
|
1 | use serde_value::Unexpected::Option;
|
1 | use serde_value::Value::Option;
|
error[E0573]: expected type, found variant `Some`
--> src/main.rs:2:20
|
2 | let _ = Option:Some(vec![0, 1]); //~ ERROR expected type, found
| ^^^^^^^^^^^^^^^^ not a type
|
help: try using the variant's enum
|
2 | let _ = Option:core::option::Option; //~ ERROR expected type, found
| ^^^^^^^^^^^^^^^^^^^^
2 | let _ = Option:futures_core::core_reexport::option::Option; //~ ERROR expected type, found
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2 | let _ = Option:futures_util::core_reexport::option::Option; //~ ERROR expected type, found
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2 | let _ = Option:lzw::Bits; //~ ERROR expected type, found
| ^^^^^^^^^
and 5 other candidates
help: maybe you meant to write a path separator here
|
2 | let _ = Option::Some(vec![0, 1]); //~ ERROR expected type, found
| ^^
error[E0423]: expected value, found enum `Foo`
--> src/main.rs:5:13
|
5 | let _ = Foo:A; //~ ERROR expected `::`, found `:`
| ^^^
|
help: try using one of the enum's variants
|
5 | let _ = Foo::A:A; //~ ERROR expected `::`, found `:`
| ^^^^^^
5 | let _ = Foo::B:A; //~ ERROR expected `::`, found `:`
| ^^^^^^
5 | let _ = Foo::C:A; //~ ERROR expected `::`, found `:`
| ^^^^^^
error[E0412]: cannot find type `A` in this scope
--> src/main.rs:5:17
|
5 | let _ = Foo:A; //~ ERROR expected `::`, found `:`
| ^ not found in this scope
|
help: there is an enum variant `crate::Foo::A`; try using the variant's enum
|
5 | let _ = Foo:crate::Foo; //~ ERROR expected `::`, found `:`
| ^^^^^^^^^^
help: maybe you meant to write a path separator here
|
5 | let _ = Foo::A; //~ ERROR expected `::`, found `:`
| ^^
help: you might be missing a type parameter
|
4 | fn qux<A>() {
| ^^^
Yes, could you split the changes, then I'll get a chance to r+ one of the parts before the return from vacation. |
|
I'm offline until Monday, but can do so then. Should I rebase to single commit or into smaller logical changes? |
aa8598a to
9958256
Compare
|
Rebased onto a single commit. |
* Deduplicate type ascription LHS errors * Remove duplicated `:` -> `::` suggestion from parse error * Tweak wording to be more accurate * Modify `current_type_ascription` to reduce span wrangling * remove now unnecessary match arm * Add run-rustfix to appropriate tests
9958256 to
6ed06b2
Compare
|
@bors r+ |
|
📌 Commit 6ed06b2 has been approved by |
|
☀️ Test successful - checks-actions, checks-azure |
Deduplicate errors caused by the same type ascription typo, including
ones suggested during parsing that would get reported again during
resolve. Fix #70382.