Skip to content

Commit 1ee45da

Browse files
committed
Remove ArgSource::Recovery
1 parent b3ac88a commit 1ee45da

File tree

4 files changed

+5
-7
lines changed

4 files changed

+5
-7
lines changed

src/librustc/hir/lowering.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2298,7 +2298,7 @@ impl<'a> LoweringContext<'a> {
22982298

22992299
fn lower_arg_source(&mut self, source: &ArgSource) -> hir::ArgSource {
23002300
match source {
2301-
ArgSource::Normal | ArgSource::Recovery => hir::ArgSource::Normal,
2301+
ArgSource::Normal => hir::ArgSource::Normal,
23022302
ArgSource::AsyncFn(pat) => hir::ArgSource::AsyncFn(self.lower_pat(pat)),
23032303
}
23042304
}

src/libsyntax/ast.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1780,8 +1780,6 @@ pub enum ArgSource {
17801780
Normal,
17811781
/// Argument from `async fn` lowering, contains the original binding pattern.
17821782
AsyncFn(P<Pat>),
1783-
/// Placeholder argument caused by incorrect syntax. Used to silence unecessary errors.
1784-
Recovery,
17851783
}
17861784

17871785
/// Alternative representation for `Arg`s describing `self` parameter of methods.

src/libsyntax/mut_visit.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -580,7 +580,7 @@ pub fn noop_visit_arg<T: MutVisitor>(Arg { id, pat, ty, source }: &mut Arg, vis:
580580

581581
pub fn noop_visit_arg_source<T: MutVisitor>(source: &mut ArgSource, vis: &mut T) {
582582
match source {
583-
ArgSource::Normal | ArgSource::Recovery => {},
583+
ArgSource::Normal => {},
584584
ArgSource::AsyncFn(pat) => vis.visit_pat(pat),
585585
}
586586
}

src/libsyntax/parse/parser.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,7 @@ fn dummy_arg(ident: Ident) -> Arg {
464464
span: ident.span,
465465
id: ast::DUMMY_NODE_ID
466466
};
467-
Arg { ty: P(ty), pat: pat, id: ast::DUMMY_NODE_ID, source: ast::ArgSource::Recovery }
467+
Arg { ty: P(ty), pat: pat, id: ast::DUMMY_NODE_ID, source: ast::ArgSource::Normal }
468468
}
469469

470470
#[derive(Copy, Clone, Debug)]
@@ -5619,8 +5619,8 @@ impl<'a> Parser<'a> {
56195619
// Replace duplicated recovered arguments with `_` pattern to avoid unecessary errors.
56205620
let mut seen_inputs = FxHashSet::default();
56215621
for input in fn_inputs.iter_mut() {
5622-
let opt_ident = if let (PatKind::Ident(_, ident, _), ast::ArgSource::Recovery) = (
5623-
&input.pat.node, &input.source,
5622+
let opt_ident = if let (PatKind::Ident(_, ident, _), TyKind::Err) = (
5623+
&input.pat.node, &input.ty,
56245624
) {
56255625
Some(*ident)
56265626
} else {

0 commit comments

Comments
 (0)