Skip to content
Permalink
Browse files

Remove `ArgSource::Recovery`

  • Loading branch information...
estebank committed May 31, 2019
1 parent b3ac88a commit 1ee45da2b9789881b8c79d6a1af8a2c9fd5364f2
Showing with 5 additions and 7 deletions.
  1. +1 −1 src/librustc/hir/lowering.rs
  2. +0 −2 src/libsyntax/ast.rs
  3. +1 −1 src/libsyntax/mut_visit.rs
  4. +3 −3 src/libsyntax/parse/parser.rs
@@ -2298,7 +2298,7 @@ impl<'a> LoweringContext<'a> {

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)),
}
}
@@ -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.
@@ -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),
}
}
@@ -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 @@ impl<'a> Parser<'a> {
// 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 {

0 comments on commit 1ee45da

Please sign in to comment.
You can’t perform that action at this time.