]> git.lizzy.rs Git - rust.git/commitdiff
Remove `ArgSource::Recovery`
authorEsteban Küber <esteban@kuber.com.ar>
Fri, 31 May 2019 01:02:40 +0000 (18:02 -0700)
committerEsteban Küber <esteban@kuber.com.ar>
Fri, 31 May 2019 01:02:40 +0000 (18:02 -0700)
src/librustc/hir/lowering.rs
src/libsyntax/ast.rs
src/libsyntax/mut_visit.rs
src/libsyntax/parse/parser.rs

index 248d9d3950c2e07d75ccd8db00ed53c799499447..08fbd0d20d74dac3a23818ad7ee4cf5e4fc187aa 100644 (file)
@@ -2298,7 +2298,7 @@ fn lower_arg(&mut self, arg: &Arg) -> hir::Arg {
 
     fn lower_arg_source(&mut self, source: &ArgSource) -> hir::ArgSource {
         match source {
-            ArgSource::Normal | ArgSource::Recovery => hir::ArgSource::Normal,
+            ArgSource::Normal => hir::ArgSource::Normal,
             ArgSource::AsyncFn(pat) => hir::ArgSource::AsyncFn(self.lower_pat(pat)),
         }
     }
index 3e25f22f0a43b6709d088005464d091c75b081b6..75e83bd9f9c74db2f0b606452781f3e389da361e 100644 (file)
@@ -1780,8 +1780,6 @@ pub enum ArgSource {
     Normal,
     /// Argument from `async fn` lowering, contains the original binding pattern.
     AsyncFn(P<Pat>),
-    /// Placeholder argument caused by incorrect syntax. Used to silence unecessary errors.
-    Recovery,
 }
 
 /// Alternative representation for `Arg`s describing `self` parameter of methods.
index e31bded0dec5b938593aaa641a6c9d4e1cc2ed08..0016c0d4d7e2b26ade57deeecdd568b5fb016c53 100644 (file)
@@ -580,7 +580,7 @@ pub fn noop_visit_arg<T: MutVisitor>(Arg { id, pat, ty, source }: &mut Arg, vis:
 
 pub fn noop_visit_arg_source<T: MutVisitor>(source: &mut ArgSource, vis: &mut T) {
     match source {
-        ArgSource::Normal | ArgSource::Recovery => {},
+        ArgSource::Normal => {},
         ArgSource::AsyncFn(pat) => vis.visit_pat(pat),
     }
 }
index 2c35b9ea7fdada71056b3286342abd6d09558043..3bb34d0402db7b6fa00e89ee3e1d9ad89a644001 100644 (file)
@@ -464,7 +464,7 @@ fn dummy_arg(ident: Ident) -> Arg {
         span: ident.span,
         id: ast::DUMMY_NODE_ID
     };
-    Arg { ty: P(ty), pat: pat, id: ast::DUMMY_NODE_ID, source: ast::ArgSource::Recovery }
+    Arg { ty: P(ty), pat: pat, id: ast::DUMMY_NODE_ID, source: ast::ArgSource::Normal }
 }
 
 #[derive(Copy, Clone, Debug)]
@@ -5619,8 +5619,8 @@ fn parse_fn_decl_with_self<F>(&mut self, parse_arg_fn: F) -> PResult<'a, P<FnDec
         // Replace duplicated recovered arguments with `_` pattern to avoid unecessary errors.
         let mut seen_inputs = FxHashSet::default();
         for input in fn_inputs.iter_mut() {
-            let opt_ident = if let (PatKind::Ident(_, ident, _), ast::ArgSource::Recovery) = (
-                &input.pat.node, &input.source,
+            let opt_ident = if let (PatKind::Ident(_, ident, _), TyKind::Err) = (
+                &input.pat.node, &input.ty,
             ) {
                 Some(*ident)
             } else {