mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 16:24:46 +00:00
remove EarlySyntaxWarning for type ascription
This commit is contained in:
parent
b002c9ff11
commit
2d27932b6c
@ -2,7 +2,6 @@ use rustc_ast as ast;
|
|||||||
use rustc_ast::visit::{self, AssocCtxt, FnCtxt, FnKind, Visitor};
|
use rustc_ast::visit::{self, AssocCtxt, FnCtxt, FnKind, Visitor};
|
||||||
use rustc_ast::{attr, AssocConstraint, AssocConstraintKind, NodeId};
|
use rustc_ast::{attr, AssocConstraint, AssocConstraintKind, NodeId};
|
||||||
use rustc_ast::{PatKind, RangeEnd};
|
use rustc_ast::{PatKind, RangeEnd};
|
||||||
use rustc_errors::StashKey;
|
|
||||||
use rustc_feature::{AttributeGate, BuiltinAttribute, Features, GateIssue, BUILTIN_ATTRIBUTE_MAP};
|
use rustc_feature::{AttributeGate, BuiltinAttribute, Features, GateIssue, BUILTIN_ATTRIBUTE_MAP};
|
||||||
use rustc_session::parse::{feature_err, feature_err_issue, feature_warn};
|
use rustc_session::parse::{feature_err, feature_err_issue, feature_warn};
|
||||||
use rustc_session::Session;
|
use rustc_session::Session;
|
||||||
@ -380,19 +379,6 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
|
|||||||
|
|
||||||
fn visit_expr(&mut self, e: &'a ast::Expr) {
|
fn visit_expr(&mut self, e: &'a ast::Expr) {
|
||||||
match e.kind {
|
match e.kind {
|
||||||
ast::ExprKind::Type(..) => {
|
|
||||||
if self.sess.parse_sess.span_diagnostic.err_count() > 0 {
|
|
||||||
// And if it isn't, cancel the early-pass warning.
|
|
||||||
if let Some(err) = self
|
|
||||||
.sess
|
|
||||||
.parse_sess
|
|
||||||
.span_diagnostic
|
|
||||||
.steal_diagnostic(e.span, StashKey::EarlySyntaxWarning)
|
|
||||||
{
|
|
||||||
err.cancel()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ast::ExprKind::TryBlock(_) => {
|
ast::ExprKind::TryBlock(_) => {
|
||||||
gate_feature_post!(&self, try_blocks, e.span, "`try` expression is experimental");
|
gate_feature_post!(&self, try_blocks, e.span, "`try` expression is experimental");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user