Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit a28349d

Browse files
committedFeb 27, 2024
Detect more cases of = to : typo
When a `Local` is fully parsed, but not followed by a `;`, keep the `:` span arround and mention it. If the type could continue being parsed as an expression, suggest replacing the `:` with a `=`. ``` error: expected one of `!`, `+`, `->`, `::`, `;`, or `=`, found `.` --> file.rs:2:32 | 2 | let _: std::env::temp_dir().join("foo"); | - ^ expected one of `!`, `+`, `->`, `::`, `;`, or `=` | | | while parsing the type for `_` | help: use `=` if you meant to assign ``` Fix #119665.
1 parent 933a05b commit a28349d

17 files changed

+142
-57
lines changed
 

‎compiler/rustc_ast/src/ast.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -670,6 +670,16 @@ impl Pat {
670670
});
671671
contains_never_pattern
672672
}
673+
674+
/// Return a name suitable for diagnostics.
675+
pub fn descr(&self) -> Option<String> {
676+
match &self.kind {
677+
PatKind::Wild => Some("_".to_string()),
678+
PatKind::Ident(BindingAnnotation::NONE, ident, None) => Some(format!("{ident}")),
679+
PatKind::Ref(pat, mutbl) => pat.descr().map(|d| format!("&{}{d}", mutbl.prefix_str())),
680+
_ => None,
681+
}
682+
}
673683
}
674684

675685
/// A single field in a struct pattern.
@@ -1052,6 +1062,7 @@ pub struct Local {
10521062
pub ty: Option<P<Ty>>,
10531063
pub kind: LocalKind,
10541064
pub span: Span,
1065+
pub colon_sp: Option<Span>,
10551066
pub attrs: AttrVec,
10561067
pub tokens: Option<LazyAttrTokenStream>,
10571068
}
@@ -3335,7 +3346,7 @@ mod size_asserts {
33353346
static_assert_size!(Item, 136);
33363347
static_assert_size!(ItemKind, 64);
33373348
static_assert_size!(LitKind, 24);
3338-
static_assert_size!(Local, 72);
3349+
static_assert_size!(Local, 80);
33393350
static_assert_size!(MetaItemLit, 40);
33403351
static_assert_size!(Param, 40);
33413352
static_assert_size!(Pat, 72);

‎compiler/rustc_ast/src/mut_visit.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -609,7 +609,7 @@ pub fn noop_visit_parenthesized_parameter_data<T: MutVisitor>(
609609
}
610610

611611
pub fn noop_visit_local<T: MutVisitor>(local: &mut P<Local>, vis: &mut T) {
612-
let Local { id, pat, ty, kind, span, attrs, tokens } = local.deref_mut();
612+
let Local { id, pat, ty, kind, span, colon_sp, attrs, tokens } = local.deref_mut();
613613
vis.visit_id(id);
614614
vis.visit_pat(pat);
615615
visit_opt(ty, |ty| vis.visit_ty(ty));
@@ -624,6 +624,7 @@ pub fn noop_visit_local<T: MutVisitor>(local: &mut P<Local>, vis: &mut T) {
624624
}
625625
}
626626
vis.visit_span(span);
627+
visit_opt(colon_sp, |sp| vis.visit_span(sp));
627628
visit_attrs(attrs, vis);
628629
visit_lazy_tts(tokens, vis);
629630
}

‎compiler/rustc_expand/src/build.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ impl<'a> ExtCtxt<'a> {
165165
id: ast::DUMMY_NODE_ID,
166166
kind: LocalKind::Init(ex),
167167
span: sp,
168+
colon_sp: None,
168169
attrs: AttrVec::new(),
169170
tokens: None,
170171
});
@@ -194,6 +195,7 @@ impl<'a> ExtCtxt<'a> {
194195
id: ast::DUMMY_NODE_ID,
195196
kind: LocalKind::Init(ex),
196197
span: sp,
198+
colon_sp: None,
197199
attrs: AttrVec::new(),
198200
tokens: None,
199201
});
@@ -208,6 +210,7 @@ impl<'a> ExtCtxt<'a> {
208210
id: ast::DUMMY_NODE_ID,
209211
kind: LocalKind::Decl,
210212
span,
213+
colon_sp: None,
211214
attrs: AttrVec::new(),
212215
tokens: None,
213216
});

‎compiler/rustc_parse/src/parser/expr.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ impl<'a> Parser<'a> {
429429
/// The method does not advance the current token.
430430
///
431431
/// Also performs recovery for `and` / `or` which are mistaken for `&&` and `||` respectively.
432-
fn check_assoc_op(&self) -> Option<Spanned<AssocOp>> {
432+
pub fn check_assoc_op(&self) -> Option<Spanned<AssocOp>> {
433433
let (op, span) = match (AssocOp::from_token(&self.token), self.token.ident()) {
434434
// When parsing const expressions, stop parsing when encountering `>`.
435435
(
@@ -990,7 +990,7 @@ impl<'a> Parser<'a> {
990990
}
991991
}
992992

993-
fn parse_dot_suffix_expr(&mut self, lo: Span, base: P<Expr>) -> PResult<'a, P<Expr>> {
993+
pub fn parse_dot_suffix_expr(&mut self, lo: Span, base: P<Expr>) -> PResult<'a, P<Expr>> {
994994
match self.token.uninterpolate().kind {
995995
token::Ident(..) => self.parse_dot_suffix(base, lo),
996996
token::Literal(token::Lit { kind: token::Integer, symbol, suffix }) => {

‎compiler/rustc_parse/src/parser/stmt.rs

Lines changed: 60 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -294,17 +294,22 @@ impl<'a> Parser<'a> {
294294
let (pat, colon) =
295295
self.parse_pat_before_ty(None, RecoverComma::Yes, PatternLocation::LetBinding)?;
296296

297-
let (err, ty) = if colon {
297+
let (err, ty, colon_sp) = if colon {
298298
// Save the state of the parser before parsing type normally, in case there is a `:`
299299
// instead of an `=` typo.
300300
let parser_snapshot_before_type = self.clone();
301301
let colon_sp = self.prev_token.span;
302302
match self.parse_ty() {
303-
Ok(ty) => (None, Some(ty)),
303+
Ok(ty) => (None, Some(ty), Some(colon_sp)),
304304
Err(mut err) => {
305-
if let Ok(snip) = self.span_to_snippet(pat.span) {
306-
err.span_label(pat.span, format!("while parsing the type for `{snip}`"));
307-
}
305+
err.span_label(
306+
colon_sp,
307+
format!(
308+
"while parsing the type for {}",
309+
pat.descr()
310+
.map_or_else(|| "the binding".to_string(), |n| format!("`{n}`"))
311+
),
312+
);
308313
// we use noexpect here because we don't actually expect Eq to be here
309314
// but we are still checking for it in order to be able to handle it if
310315
// it is there
@@ -317,11 +322,11 @@ impl<'a> Parser<'a> {
317322
mem::replace(self, parser_snapshot_before_type);
318323
Some((parser_snapshot_after_type, colon_sp, err))
319324
};
320-
(err, None)
325+
(err, None, Some(colon_sp))
321326
}
322327
}
323328
} else {
324-
(None, None)
329+
(None, None, None)
325330
};
326331
let init = match (self.parse_initializer(err.is_some()), err) {
327332
(Ok(init), None) => {
@@ -380,7 +385,16 @@ impl<'a> Parser<'a> {
380385
}
381386
};
382387
let hi = if self.token == token::Semi { self.token.span } else { self.prev_token.span };
383-
Ok(P(ast::Local { ty, pat, kind, id: DUMMY_NODE_ID, span: lo.to(hi), attrs, tokens: None }))
388+
Ok(P(ast::Local {
389+
ty,
390+
pat,
391+
kind,
392+
id: DUMMY_NODE_ID,
393+
span: lo.to(hi),
394+
colon_sp,
395+
attrs,
396+
tokens: None,
397+
}))
384398
}
385399

386400
fn check_let_else_init_bool_expr(&self, init: &ast::Expr) {
@@ -746,15 +760,51 @@ impl<'a> Parser<'a> {
746760
}
747761
}
748762
StmtKind::Expr(_) | StmtKind::MacCall(_) => {}
749-
StmtKind::Local(local) if let Err(e) = self.expect_semi() => {
763+
StmtKind::Local(local) if let Err(mut e) = self.expect_semi() => {
750764
// We might be at the `,` in `let x = foo<bar, baz>;`. Try to recover.
751765
match &mut local.kind {
752766
LocalKind::Init(expr) | LocalKind::InitElse(expr, _) => {
753767
self.check_mistyped_turbofish_with_multiple_type_params(e, expr)?;
754768
// We found `foo<bar, baz>`, have we fully recovered?
755769
self.expect_semi()?;
756770
}
757-
LocalKind::Decl => return Err(e),
771+
LocalKind::Decl => {
772+
if let Some(colon_sp) = local.colon_sp {
773+
e.span_label(
774+
colon_sp,
775+
format!(
776+
"while parsing the type for {}",
777+
local.pat.descr().map_or_else(
778+
|| "the binding".to_string(),
779+
|n| format!("`{n}`")
780+
)
781+
),
782+
);
783+
let suggest_eq = if self.token.kind == token::Dot
784+
&& let _ = self.bump()
785+
&& let mut snapshot = self.create_snapshot_for_diagnostic()
786+
&& let Ok(_) = snapshot
787+
.parse_dot_suffix_expr(colon_sp, self.mk_expr_err(colon_sp))
788+
{
789+
true
790+
} else if let Some(op) = self.check_assoc_op()
791+
&& op.node.can_continue_expr_unambiguously()
792+
{
793+
true
794+
} else {
795+
false
796+
};
797+
if suggest_eq {
798+
e.span_suggestion_short(
799+
colon_sp,
800+
"use `=` if you meant to assign",
801+
"=",
802+
Applicability::MaybeIncorrect,
803+
);
804+
}
805+
}
806+
return Err(e);
807+
}
758808
}
759809
eat_semi = false;
760810
}

‎tests/ui/const-generics/bad-const-generic-exprs.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,9 +146,9 @@ error: expected one of `,` or `>`, found `0`
146146
--> $DIR/bad-const-generic-exprs.rs:43:17
147147
|
148148
LL | let _: Wow<!0>;
149-
| - ^ expected one of `,` or `>`
150-
| |
151-
| while parsing the type for `_`
149+
| - ^ expected one of `,` or `>`
150+
| |
151+
| while parsing the type for `_`
152152
|
153153
help: you might have meant to end the type parameters here
154154
|

‎tests/ui/issues/issue-34334.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ error: expected one of `,`, `:`, or `>`, found `=`
22
--> $DIR/issue-34334.rs:2:29
33
|
44
LL | let sr: Vec<(u32, _, _) = vec![];
5-
| -- ^ expected one of `,`, `:`, or `>`
6-
| |
7-
| while parsing the type for `sr`
5+
| - ^ expected one of `,`, `:`, or `>`
6+
| |
7+
| while parsing the type for `sr`
88
|
99
help: you might have meant to end the type parameters here
1010
|

‎tests/ui/parser/better-expected.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ error: expected one of `!`, `(`, `+`, `::`, `;`, `<`, or `]`, found `3`
22
--> $DIR/better-expected.rs:2:19
33
|
44
LL | let x: [isize 3];
5-
| - ^ expected one of 7 possible tokens
6-
| |
7-
| while parsing the type for `x`
5+
| - ^ expected one of 7 possible tokens
6+
| |
7+
| while parsing the type for `x`
88

99
error: aborting due to 1 previous error
1010

‎tests/ui/parser/issues/issue-84117.stderr

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ error: expected one of `>`, a const expression, lifetime, or type, found `}`
22
--> $DIR/issue-84117.rs:2:67
33
|
44
LL | let outer_local:e_outer<&str, { let inner_local:e_inner<&str, }
5-
| ----------- ^ expected one of `>`, a const expression, lifetime, or type
6-
| |
7-
| while parsing the type for `inner_local`
5+
| - ^ expected one of `>`, a const expression, lifetime, or type
6+
| |
7+
| while parsing the type for `inner_local`
88
|
99
help: you might have meant to end the type parameters here
1010
|
@@ -25,7 +25,7 @@ error: expected one of `,` or `>`, found `}`
2525
--> $DIR/issue-84117.rs:8:1
2626
|
2727
LL | let outer_local:e_outer<&str, { let inner_local:e_inner<&str, }
28-
| ----------- while parsing the type for `outer_local` - expected one of `,` or `>`
28+
| - while parsing the type for `outer_local` - expected one of `,` or `>`
2929
...
3030
LL | }
3131
| ^ unexpected token
@@ -43,9 +43,9 @@ error: expected one of `>`, a const expression, lifetime, or type, found `}`
4343
--> $DIR/issue-84117.rs:2:67
4444
|
4545
LL | let outer_local:e_outer<&str, { let inner_local:e_inner<&str, }
46-
| ----------- ^ expected one of `>`, a const expression, lifetime, or type
47-
| |
48-
| while parsing the type for `inner_local`
46+
| - ^ expected one of `>`, a const expression, lifetime, or type
47+
| |
48+
| while parsing the type for `inner_local`
4949
|
5050
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
5151
help: you might have meant to end the type parameters here

‎tests/ui/parser/missing-closing-angle-bracket-eq-constraint.stderr

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ error: expected one of `,`, `:`, or `>`, found `=`
22
--> $DIR/missing-closing-angle-bracket-eq-constraint.rs:7:23
33
|
44
LL | let v : Vec<(u32,_) = vec![];
5-
| - ^ expected one of `,`, `:`, or `>`
6-
| |
7-
| while parsing the type for `v`
5+
| - ^ expected one of `,`, `:`, or `>`
6+
| |
7+
| while parsing the type for `v`
88
|
99
help: you might have meant to end the type parameters here
1010
|
@@ -15,9 +15,9 @@ error: expected one of `!`, `(`, `+`, `,`, `::`, `<`, or `>`, found `{`
1515
--> $DIR/missing-closing-angle-bracket-eq-constraint.rs:13:32
1616
|
1717
LL | let foo : Foo::<T1, T2 = Foo {_a : arg1, _b : arg2};
18-
| --- ^ expected one of 7 possible tokens
19-
| |
20-
| while parsing the type for `foo`
18+
| - ^ expected one of 7 possible tokens
19+
| |
20+
| while parsing the type for `foo`
2121
|
2222
help: you might have meant to end the type parameters here
2323
|
@@ -28,9 +28,9 @@ error: expected one of `,`, `:`, or `>`, found `=`
2828
--> $DIR/missing-closing-angle-bracket-eq-constraint.rs:18:18
2929
|
3030
LL | let v : Vec<'a = vec![];
31-
| - ^ expected one of `,`, `:`, or `>`
32-
| |
33-
| while parsing the type for `v`
31+
| - ^ expected one of `,`, `:`, or `>`
32+
| |
33+
| while parsing the type for `v`
3434
|
3535
help: you might have meant to end the type parameters here
3636
|

‎tests/ui/parser/nested-missing-closing-angle-bracket.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error: expected one of `,` or `>`, found `;`
22
--> $DIR/nested-missing-closing-angle-bracket.rs:2:46
33
|
44
LL | let v : Vec::<Vec<(u32,_,_)> = vec![vec![]];
5-
| - while parsing the type for `v` ^ expected one of `,` or `>`
5+
| - while parsing the type for `v` ^ expected one of `,` or `>`
66

77
error: aborting due to 1 previous error
88

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
fn main() {
2+
let _: std::env::temp_dir().join("foo"); //~ ERROR expected one of
3+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
error: expected one of `!`, `+`, `->`, `::`, `;`, or `=`, found `.`
2+
--> $DIR/recover-colon-instead-of-eq-in-local.rs:2:32
3+
|
4+
LL | let _: std::env::temp_dir().join("foo");
5+
| - ^ expected one of `!`, `+`, `->`, `::`, `;`, or `=`
6+
| |
7+
| while parsing the type for `_`
8+
| help: use `=` if you meant to assign
9+
10+
error: aborting due to 1 previous error
11+

‎tests/ui/parser/removed-syntax/removed-syntax-fn-sigil.stderr

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ error: expected one of `->`, `;`, or `=`, found `~`
88
--> $DIR/removed-syntax-fn-sigil.rs:2:14
99
|
1010
LL | let x: fn~() = || ();
11-
| ^ expected one of `->`, `;`, or `=`
11+
| - ^ expected one of `->`, `;`, or `=`
12+
| |
13+
| while parsing the type for `x`
1214

1315
error: aborting due to 2 previous errors
1416

‎tests/ui/pattern/bindings-after-at/nested-type-ascription-syntactically-invalid.stderr

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ error: expected one of `!`, `(`, `+`, `::`, `;`, `<`, or `=`, found `@`
22
--> $DIR/nested-type-ascription-syntactically-invalid.rs:18:15
33
|
44
LL | let a: u8 @ b = 0;
5-
| ^ expected one of 7 possible tokens
5+
| - ^ expected one of 7 possible tokens
6+
| |
7+
| while parsing the type for `a`
68

79
error: expected one of `)`, `,`, `@`, or `|`, found `:`
810
--> $DIR/nested-type-ascription-syntactically-invalid.rs:24:15
@@ -16,7 +18,9 @@ error: expected one of `!`, `(`, `+`, `::`, `;`, `<`, or `=`, found `@`
1618
--> $DIR/nested-type-ascription-syntactically-invalid.rs:30:15
1719
|
1820
LL | let a: T1 @ Outer(b: T2);
19-
| ^ expected one of 7 possible tokens
21+
| - ^ expected one of 7 possible tokens
22+
| |
23+
| while parsing the type for `a`
2024

2125
error: aborting due to 3 previous errors
2226

‎tests/ui/stats/hir-stats.stderr

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,16 @@ ast-stats-1 - BoundPredicate 56 ( 0.8%) 1
1010
ast-stats-1 Attribute 64 ( 1.0%) 2 32
1111
ast-stats-1 - Normal 32 ( 0.5%) 1
1212
ast-stats-1 - DocComment 32 ( 0.5%) 1
13-
ast-stats-1 Local 72 ( 1.1%) 1 72
14-
ast-stats-1 Arm 96 ( 1.5%) 2 48
15-
ast-stats-1 ForeignItem 96 ( 1.5%) 1 96
16-
ast-stats-1 - Fn 96 ( 1.5%) 1
13+
ast-stats-1 Local 80 ( 1.2%) 1 80
14+
ast-stats-1 Arm 96 ( 1.4%) 2 48
15+
ast-stats-1 ForeignItem 96 ( 1.4%) 1 96
16+
ast-stats-1 - Fn 96 ( 1.4%) 1
1717
ast-stats-1 FnDecl 120 ( 1.8%) 5 24
1818
ast-stats-1 FieldDef 160 ( 2.4%) 2 80
1919
ast-stats-1 Stmt 160 ( 2.4%) 5 32
2020
ast-stats-1 - Local 32 ( 0.5%) 1
2121
ast-stats-1 - MacCall 32 ( 0.5%) 1
22-
ast-stats-1 - Expr 96 ( 1.5%) 3
22+
ast-stats-1 - Expr 96 ( 1.4%) 3
2323
ast-stats-1 Param 160 ( 2.4%) 4 40
2424
ast-stats-1 Block 192 ( 2.9%) 6 32
2525
ast-stats-1 Variant 208 ( 3.1%) 2 104
@@ -28,7 +28,7 @@ ast-stats-1 - Trait 352 ( 5.3%) 4
2828
ast-stats-1 AssocItem 352 ( 5.3%) 4 88
2929
ast-stats-1 - Type 176 ( 2.7%) 2
3030
ast-stats-1 - Fn 176 ( 2.7%) 2
31-
ast-stats-1 GenericParam 480 ( 7.3%) 5 96
31+
ast-stats-1 GenericParam 480 ( 7.2%) 5 96
3232
ast-stats-1 Pat 504 ( 7.6%) 7 72
3333
ast-stats-1 - Struct 72 ( 1.1%) 1
3434
ast-stats-1 - Wild 72 ( 1.1%) 1
@@ -53,7 +53,7 @@ ast-stats-1 - Impl 136 ( 2.1%) 1
5353
ast-stats-1 - Fn 272 ( 4.1%) 2
5454
ast-stats-1 - Use 408 ( 6.2%) 3
5555
ast-stats-1 ----------------------------------------------------------------
56-
ast-stats-1 Total 6_616
56+
ast-stats-1 Total 6_624
5757
ast-stats-1
5858
ast-stats-2 POST EXPANSION AST STATS
5959
ast-stats-2 Name Accumulated Size Count Item Size
@@ -64,7 +64,7 @@ ast-stats-2 Crate 40 ( 0.6%) 1 40
6464
ast-stats-2 ExprField 48 ( 0.7%) 1 48
6565
ast-stats-2 WherePredicate 56 ( 0.8%) 1 56
6666
ast-stats-2 - BoundPredicate 56 ( 0.8%) 1
67-
ast-stats-2 Local 72 ( 1.0%) 1 72
67+
ast-stats-2 Local 80 ( 1.1%) 1 80
6868
ast-stats-2 Arm 96 ( 1.3%) 2 48
6969
ast-stats-2 ForeignItem 96 ( 1.3%) 1 96
7070
ast-stats-2 - Fn 96 ( 1.3%) 1
@@ -86,7 +86,7 @@ ast-stats-2 - Trait 352 ( 4.9%) 4
8686
ast-stats-2 AssocItem 352 ( 4.9%) 4 88
8787
ast-stats-2 - Type 176 ( 2.4%) 2
8888
ast-stats-2 - Fn 176 ( 2.4%) 2
89-
ast-stats-2 GenericParam 480 ( 6.7%) 5 96
89+
ast-stats-2 GenericParam 480 ( 6.6%) 5 96
9090
ast-stats-2 Pat 504 ( 7.0%) 7 72
9191
ast-stats-2 - Struct 72 ( 1.0%) 1
9292
ast-stats-2 - Wild 72 ( 1.0%) 1
@@ -113,7 +113,7 @@ ast-stats-2 - Impl 136 ( 1.9%) 1
113113
ast-stats-2 - Fn 272 ( 3.8%) 2
114114
ast-stats-2 - Use 544 ( 7.5%) 4
115115
ast-stats-2 ----------------------------------------------------------------
116-
ast-stats-2 Total 7_216
116+
ast-stats-2 Total 7_224
117117
ast-stats-2
118118
hir-stats HIR STATS
119119
hir-stats Name Accumulated Size Count Item Size

‎tests/ui/type/type-ascription-instead-of-initializer.stderr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ error: expected type, found `10`
22
--> $DIR/type-ascription-instead-of-initializer.rs:2:31
33
|
44
LL | let x: Vec::with_capacity(10, 20);
5-
| -- ^^ expected type
6-
| ||
7-
| |help: use `=` if you meant to assign
8-
| while parsing the type for `x`
5+
| - ^^ expected type
6+
| |
7+
| while parsing the type for `x`
8+
| help: use `=` if you meant to assign
99

1010
error[E0061]: this function takes 1 argument but 2 arguments were supplied
1111
--> $DIR/type-ascription-instead-of-initializer.rs:2:12

0 commit comments

Comments
 (0)
Please sign in to comment.