@@ -498,21 +498,6 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
498498 }
499499 }
500500
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-
516501 fn visit_pat ( & mut self , pattern : & ' a ast:: Pat ) {
517502 match & pattern. kind {
518503 PatKind :: Slice ( pats) => {
@@ -805,6 +790,12 @@ pub fn check_crate(krate: &ast::Crate,
805790 gate_all ! ( label_break_value, "labels on blocks are unstable" ) ;
806791 gate_all ! ( box_syntax, "box expression syntax is experimental; you can call `Box::new` instead" ) ;
807792
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+
808799 visit:: walk_crate ( & mut visitor, krate) ;
809800}
810801
0 commit comments