After #109128, there's some leftover code in feature gating.
|
fn visit_stmt(&mut self, stmt: &'a ast::Stmt) { |
|
if let ast::StmtKind::Semi(expr) = &stmt.kind |
|
&& let ast::ExprKind::Assign(lhs, _, _) = &expr.kind |
|
&& let ast::ExprKind::Type(..) = lhs.kind |
|
&& self.sess.parse_sess.span_diagnostic.err_count() == 0 |
|
&& !self.features.type_ascription |
|
&& !lhs.span.allows_unstable(sym::type_ascription) |
|
{ |
|
// When we encounter a statement of the form `foo: Ty = val;`, this will emit a type |
|
// ascription error, but the likely intention was to write a `let` statement. (#78907). |
|
feature_err( |
|
&self.sess.parse_sess, |
|
sym::type_ascription, |
|
lhs.span, |
|
"type ascription is experimental", |
|
).span_suggestion_verbose( |
|
lhs.span.shrink_to_lo(), |
|
"you might have meant to introduce a new binding", |
|
"let ", |
|
Applicability::MachineApplicable, |
|
).emit(); |
|
} |
|
visit::walk_stmt(self, stmt); |
|
} |
It should be removed, although it needs to be ensured that code like it does not compile afterwards (I haven't tested it).
cc @chenyukang
After #109128, there's some leftover code in feature gating.
rust/compiler/rustc_ast_passes/src/feature_gate.rs
Lines 378 to 401 in 613a5c9
It should be removed, although it needs to be ensured that code like it does not compile afterwards (I haven't tested it).
cc @chenyukang