@@ -498,21 +498,6 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
498
498
}
499
499
}
500
500
501
- fn visit_expr ( & mut self , e : & ' a ast:: Expr ) {
502
- match e. kind {
503
- ast:: ExprKind :: Type ( ..) => {
504
- // To avoid noise about type ascription in common syntax errors, only emit if it
505
- // is the *only* error.
506
- if self . parse_sess . span_diagnostic . err_count ( ) == 0 {
507
- gate_feature_post ! ( & self , type_ascription, e. span,
508
- "type ascription is experimental" ) ;
509
- }
510
- }
511
- _ => { }
512
- }
513
- visit:: walk_expr ( self , e)
514
- }
515
-
516
501
fn visit_pat ( & mut self , pattern : & ' a ast:: Pat ) {
517
502
match & pattern. kind {
518
503
PatKind :: Slice ( pats) => {
@@ -805,6 +790,12 @@ pub fn check_crate(krate: &ast::Crate,
805
790
gate_all ! ( label_break_value, "labels on blocks are unstable" ) ;
806
791
gate_all ! ( box_syntax, "box expression syntax is experimental; you can call `Box::new` instead" ) ;
807
792
793
+ // To avoid noise about type ascription in common syntax errors,
794
+ // only emit if it is the *only* error. (Also check it last.)
795
+ if parse_sess. span_diagnostic . err_count ( ) == 0 {
796
+ gate_all ! ( type_ascription, "type ascription is experimental" ) ;
797
+ }
798
+
808
799
visit:: walk_crate ( & mut visitor, krate) ;
809
800
}
810
801
0 commit comments