mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-27 18:57:42 +03:00
Make : -> = typo suggestion verbose
This commit is contained in:
@@ -362,7 +362,7 @@ fn parse_local(&mut self, super_: Option<Span>, attrs: AttrVec) -> PResult<'a, B
|
||||
// init parsed, ty error
|
||||
// Could parse the type as if it were the initializer, it is likely there was a
|
||||
// typo in the code: `:` instead of `=`. Add suggestion and emit the error.
|
||||
err.span_suggestion_short(
|
||||
err.span_suggestion_verbose(
|
||||
colon_sp,
|
||||
"use `=` if you meant to assign",
|
||||
" =",
|
||||
@@ -1134,7 +1134,7 @@ pub fn parse_full_stmt(
|
||||
false
|
||||
};
|
||||
if suggest_eq {
|
||||
e.span_suggestion_short(
|
||||
e.span_suggestion_verbose(
|
||||
colon_sp,
|
||||
"use `=` if you meant to assign",
|
||||
"=",
|
||||
|
||||
@@ -1271,7 +1271,7 @@ fn suggest_typo(
|
||||
Some((pat_sp, Some(ty_sp), None))
|
||||
if ty_sp.contains(base_error.span) && base_error.could_be_expr =>
|
||||
{
|
||||
err.span_suggestion_short(
|
||||
err.span_suggestion_verbose(
|
||||
pat_sp.between(ty_sp),
|
||||
"use `=` if you meant to assign",
|
||||
" = ",
|
||||
|
||||
@@ -17,7 +17,12 @@ LL | let a: [i32, ];
|
||||
| - ^ expected `;` or `]`
|
||||
| |
|
||||
| while parsing the type for `a`
|
||||
| help: use `=` if you meant to assign
|
||||
|
|
||||
help: use `=` if you meant to assign
|
||||
|
|
||||
LL - let a: [i32, ];
|
||||
LL + let a = [i32, ];
|
||||
|
|
||||
|
||||
error: expected `;` or `]`, found `,`
|
||||
--> $DIR/array-type-no-semi.rs:12:16
|
||||
|
||||
@@ -13,7 +13,12 @@ LL | let _: std::env::temp_dir().join("foo");
|
||||
| - ^ expected one of `!`, `+`, `->`, `::`, `;`, or `=`
|
||||
| |
|
||||
| while parsing the type for `_`
|
||||
| help: use `=` if you meant to assign
|
||||
|
|
||||
help: use `=` if you meant to assign
|
||||
|
|
||||
LL - let _: std::env::temp_dir().join("foo");
|
||||
LL + let _= std::env::temp_dir().join("foo");
|
||||
|
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
||||
@@ -2,9 +2,13 @@ error[E0573]: expected type, found local variable `num`
|
||||
--> $DIR/let-binding-init-expr-as-ty.rs:2:27
|
||||
|
|
||||
LL | let foo: i32::from_be(num);
|
||||
| -- ^^^ not a type
|
||||
| |
|
||||
| help: use `=` if you meant to assign
|
||||
| ^^^ not a type
|
||||
|
|
||||
help: use `=` if you meant to assign
|
||||
|
|
||||
LL - let foo: i32::from_be(num);
|
||||
LL + let foo = i32::from_be(num);
|
||||
|
|
||||
|
||||
error: argument types not allowed with return type notation
|
||||
--> $DIR/let-binding-init-expr-as-ty.rs:2:26
|
||||
|
||||
@@ -5,7 +5,12 @@ LL | let x: Vec::with_capacity(10, 20);
|
||||
| - ^^ expected type
|
||||
| |
|
||||
| while parsing the type for `x`
|
||||
| help: use `=` if you meant to assign
|
||||
|
|
||||
help: use `=` if you meant to assign
|
||||
|
|
||||
LL - let x: Vec::with_capacity(10, 20);
|
||||
LL + let x = Vec::with_capacity(10, 20);
|
||||
|
|
||||
|
||||
error[E0061]: this function takes 1 argument but 2 arguments were supplied
|
||||
--> $DIR/type-ascription-instead-of-initializer.rs:2:12
|
||||
|
||||
Reference in New Issue
Block a user