Skip to content

Commit 42752cc

Browse files
committed
Remove now-obsolete visit_pattern_type_pattern
1 parent d848018 commit 42752cc

File tree

6 files changed

+10
-21
lines changed

6 files changed

+10
-21
lines changed

Diff for: compiler/rustc_ast_lowering/src/index.rs

-4
Original file line numberDiff line numberDiff line change
@@ -393,10 +393,6 @@ impl<'a, 'hir> Visitor<'hir> for NodeCollector<'a, 'hir> {
393393
});
394394
}
395395

396-
fn visit_pattern_type_pattern(&mut self, p: &'hir hir::Pat<'hir>) {
397-
self.visit_pat(p)
398-
}
399-
400396
fn visit_precise_capturing_arg(
401397
&mut self,
402398
arg: &'hir PreciseCapturingArg<'hir>,

Diff for: compiler/rustc_hir/src/intravisit.rs

+1-6
Original file line numberDiff line numberDiff line change
@@ -364,11 +364,6 @@ pub trait Visitor<'v>: Sized {
364364
fn visit_ty(&mut self, t: &'v Ty<'v>) -> Self::Result {
365365
walk_ty(self, t)
366366
}
367-
fn visit_pattern_type_pattern(&mut self, _p: &'v Pat<'v>) {
368-
// Do nothing. Only a few visitors need to know the details of the pattern type,
369-
// and they opt into it. All other visitors will just choke on our fake patterns
370-
// because they aren't in a body.
371-
}
372367
fn visit_generic_param(&mut self, p: &'v GenericParam<'v>) -> Self::Result {
373368
walk_generic_param(self, p)
374369
}
@@ -918,7 +913,7 @@ pub fn walk_ty<'v, V: Visitor<'v>>(visitor: &mut V, typ: &'v Ty<'v>) -> V::Resul
918913
}
919914
TyKind::Pat(ty, pat) => {
920915
try_visit!(visitor.visit_ty(ty));
921-
try_visit!(visitor.visit_pattern_type_pattern(pat));
916+
try_visit!(visitor.visit_pat(pat));
922917
}
923918
}
924919
V::Result::output()

Diff for: compiler/rustc_hir_analysis/src/collect/resolve_bound_vars.rs

-5
Original file line numberDiff line numberDiff line change
@@ -826,11 +826,6 @@ impl<'a, 'tcx> Visitor<'tcx> for BoundVarContext<'a, 'tcx> {
826826
}
827827
}
828828

829-
#[instrument(level = "debug", skip(self))]
830-
fn visit_pattern_type_pattern(&mut self, p: &'tcx hir::Pat<'tcx>) {
831-
intravisit::walk_pat(self, p)
832-
}
833-
834829
#[instrument(level = "debug", skip(self))]
835830
fn visit_trait_item(&mut self, trait_item: &'tcx hir::TraitItem<'tcx>) {
836831
use self::hir::TraitItemKind::*;

Diff for: compiler/rustc_passes/src/hir_id_validator.rs

-4
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,4 @@ impl<'a, 'hir> intravisit::Visitor<'hir> for HirIdValidator<'a, 'hir> {
161161
let mut inner_visitor = self.new_visitor(self.tcx);
162162
inner_visitor.check(i.owner_id, |this| intravisit::walk_impl_item(this, i));
163163
}
164-
165-
fn visit_pattern_type_pattern(&mut self, p: &'hir hir::Pat<'hir>) {
166-
self.visit_pat(p)
167-
}
168164
}

Diff for: tests/ui/type/pattern_types/bad_const_generics_args_on_const_param.rs

+1
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@ type Pat<const START: u32, const END: u32> =
66
//~^ ERROR type and const arguments are not allowed on const parameter `START`
77
//~| ERROR type arguments are not allowed on const parameter `END`
88
//~| ERROR associated item constraints are not allowed here
9+
//~| ERROR the placeholder `_` is not allowed within types on item signatures
910

1011
fn main() {}

Diff for: tests/ui/type/pattern_types/bad_const_generics_args_on_const_param.stderr

+8-2
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,13 @@ error[E0229]: associated item constraints are not allowed here
3232
LL | std::pat::pattern_type!(u32 is START::<(), i32, 2>..=END::<_, Assoc = ()>);
3333
| ^^^^^^^^^^ associated item constraint not allowed here
3434

35-
error: aborting due to 3 previous errors
35+
error[E0121]: the placeholder `_` is not allowed within types on item signatures for type aliases
36+
--> $DIR/bad_const_generics_args_on_const_param.rs:5:64
37+
|
38+
LL | std::pat::pattern_type!(u32 is START::<(), i32, 2>..=END::<_, Assoc = ()>);
39+
| ^ not allowed in type signatures
40+
41+
error: aborting due to 4 previous errors
3642

37-
Some errors have detailed explanations: E0109, E0229.
43+
Some errors have detailed explanations: E0109, E0121, E0229.
3844
For more information about an error, try `rustc --explain E0109`.

0 commit comments

Comments
 (0)