about summary refs log tree commit diff
diff options
context:
space:
mode:
authoryukang <moorekang@gmail.com>2023-03-14 23:40:09 +0800
committeryukang <moorekang@gmail.com>2023-05-01 16:15:17 +0800
commit10512b2932ba91ddde1ab92c6bb9662f751092c3 (patch)
treea788679f63ce823f4c1cc778eb2044a91aa6bbd6
parentf65b875e830b00ccf4d37461890c2afaccc92067 (diff)
downloadrust-10512b2932ba91ddde1ab92c6bb9662f751092c3.tar.gz
rust-10512b2932ba91ddde1ab92c6bb9662f751092c3.zip
remove current_type_ascription from DiagnosticMetadata
-rw-r--r--compiler/rustc_resolve/src/late.rs14
1 files changed, 1 insertions, 13 deletions
diff --git a/compiler/rustc_resolve/src/late.rs b/compiler/rustc_resolve/src/late.rs
index c1d76920b66..ba4fe20703f 100644
--- a/compiler/rustc_resolve/src/late.rs
+++ b/compiler/rustc_resolve/src/late.rs
@@ -548,9 +548,6 @@ struct DiagnosticMetadata<'ast> {
     /// they are used (in a `break` or `continue` statement)
     unused_labels: FxHashMap<NodeId, Span>,
 
-    /// Only used for better errors on `fn(): fn()`.
-    current_type_ascription: Vec<Span>,
-
     /// Only used for better errors on `let x = { foo: bar };`.
     /// In the case of a parse error with `let x = { foo: bar, };`, this isn't needed, it's only
     /// needed for cases where this parses as a correct type ascription.
@@ -4057,17 +4054,8 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> {
                     }
                 }
             }
-            ExprKind::Type(ref type_expr, ref ty) => {
-                // `ParseSess::type_ascription_path_suggestions` keeps spans of colon tokens in
-                // type ascription. Here we are trying to retrieve the span of the colon token as
-                // well, but only if it's written without spaces `expr:Ty` and therefore confusable
-                // with `expr::Ty`, only in this case it will match the span from
-                // `type_ascription_path_suggestions`.
-                self.diagnostic_metadata
-                    .current_type_ascription
-                    .push(type_expr.span.between(ty.span));
+            ExprKind::Type(ref _type_expr, ref _ty) => {
                 visit::walk_expr(self, expr);
-                self.diagnostic_metadata.current_type_ascription.pop();
             }
             // `async |x| ...` gets desugared to `|x| async {...}`, so we need to
             // resolve the arguments within the proper scopes so that usages of them inside the