Skip to content

Commit

Permalink
Remove now-obsolete visit_pattern_type_pattern
Browse files Browse the repository at this point in the history
  • Loading branch information
oli-obk committed Dec 13, 2024
1 parent e0effc0 commit a29a302
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 21 deletions.
4 changes: 0 additions & 4 deletions compiler/rustc_ast_lowering/src/index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -393,10 +393,6 @@ impl<'a, 'hir> Visitor<'hir> for NodeCollector<'a, 'hir> {
});
}

fn visit_pattern_type_pattern(&mut self, p: &'hir hir::Pat<'hir>) {
self.visit_pat(p)
}

fn visit_precise_capturing_arg(
&mut self,
arg: &'hir PreciseCapturingArg<'hir>,
Expand Down
7 changes: 1 addition & 6 deletions compiler/rustc_hir/src/intravisit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -364,11 +364,6 @@ pub trait Visitor<'v>: Sized {
fn visit_ty(&mut self, t: &'v Ty<'v>) -> Self::Result {
walk_ty(self, t)
}
fn visit_pattern_type_pattern(&mut self, _p: &'v Pat<'v>) {
// Do nothing. Only a few visitors need to know the details of the pattern type,
// and they opt into it. All other visitors will just choke on our fake patterns
// because they aren't in a body.
}
fn visit_generic_param(&mut self, p: &'v GenericParam<'v>) -> Self::Result {
walk_generic_param(self, p)
}
Expand Down Expand Up @@ -918,7 +913,7 @@ pub fn walk_ty<'v, V: Visitor<'v>>(visitor: &mut V, typ: &'v Ty<'v>) -> V::Resul
}
TyKind::Pat(ty, pat) => {
try_visit!(visitor.visit_ty(ty));
try_visit!(visitor.visit_pattern_type_pattern(pat));
try_visit!(visitor.visit_pat(pat));
}
}
V::Result::output()
Expand Down
5 changes: 0 additions & 5 deletions compiler/rustc_hir_analysis/src/collect/resolve_bound_vars.rs
Original file line number Diff line number Diff line change
Expand Up @@ -826,11 +826,6 @@ impl<'a, 'tcx> Visitor<'tcx> for BoundVarContext<'a, 'tcx> {
}
}

#[instrument(level = "debug", skip(self))]
fn visit_pattern_type_pattern(&mut self, p: &'tcx hir::Pat<'tcx>) {
intravisit::walk_pat(self, p)
}

#[instrument(level = "debug", skip(self))]
fn visit_trait_item(&mut self, trait_item: &'tcx hir::TraitItem<'tcx>) {
use self::hir::TraitItemKind::*;
Expand Down
4 changes: 0 additions & 4 deletions compiler/rustc_passes/src/hir_id_validator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,4 @@ impl<'a, 'hir> intravisit::Visitor<'hir> for HirIdValidator<'a, 'hir> {
let mut inner_visitor = self.new_visitor(self.tcx);
inner_visitor.check(i.owner_id, |this| intravisit::walk_impl_item(this, i));
}

fn visit_pattern_type_pattern(&mut self, p: &'hir hir::Pat<'hir>) {
self.visit_pat(p)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ type Pat<const START: u32, const END: u32> =
//~^ ERROR type and const arguments are not allowed on const parameter `START`
//~| ERROR type arguments are not allowed on const parameter `END`
//~| ERROR associated item constraints are not allowed here
//~| ERROR the placeholder `_` is not allowed within types on item signatures

fn main() {}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,13 @@ error[E0229]: associated item constraints are not allowed here
LL | std::pat::pattern_type!(u32 is START::<(), i32, 2>..=END::<_, Assoc = ()>);
| ^^^^^^^^^^ associated item constraint not allowed here

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

error: aborting due to 4 previous errors

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

0 comments on commit a29a302

Please sign in to comment.