We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
mut
let
1 parent 9ee22ff commit ea2df3aCopy full SHA for ea2df3a
compiler/rustc_parse/src/parser/stmt.rs
@@ -55,6 +55,19 @@ impl<'a> Parser<'a> {
55
return Ok(Some(stmt.into_inner()));
56
}
57
58
+ if self.token.is_keyword(kw::Mut) && self.is_keyword_ahead(1, &[kw::Let]) {
59
+ self.bump();
60
+ let mut_let_span = lo.to(self.token.span);
61
+ self.struct_span_err(mut_let_span, "invalid variable declaration")
62
+ .span_suggestion(
63
+ mut_let_span,
64
+ "switch the order of `mut` and `let`",
65
+ "let mut",
66
+ Applicability::MaybeIncorrect,
67
+ )
68
+ .emit();
69
+ }
70
+
71
Ok(Some(if self.token.is_keyword(kw::Let) {
72
self.parse_local_mk(lo, attrs, capture_semi, force_collect)?
73
} else if self.is_kw_followed_by_ident(kw::Mut) {
0 commit comments