Skip to content

Commit 73b8f1d

Browse files
committed
Optimize match checking
1 parent 0c2bf6f commit 73b8f1d

File tree

1 file changed

+3
-15
lines changed

1 file changed

+3
-15
lines changed

src/librustc_mir/hair/pattern/check_match.rs

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -28,22 +28,10 @@ use syntax::ast;
2828
use syntax::ptr::P;
2929
use syntax_pos::{Span, DUMMY_SP, MultiSpan};
3030

31-
struct OuterVisitor<'a, 'tcx: 'a> { tcx: TyCtxt<'a, 'tcx, 'tcx> }
32-
33-
impl<'a, 'tcx> Visitor<'tcx> for OuterVisitor<'a, 'tcx> {
34-
fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> {
35-
NestedVisitorMap::OnlyBodies(&self.tcx.hir())
36-
}
37-
38-
fn visit_body(&mut self, body: &'tcx hir::Body) {
39-
intravisit::walk_body(self, body);
40-
let def_id = self.tcx.hir().body_owner_def_id(body.id());
41-
let _ = self.tcx.check_match(def_id);
42-
}
43-
}
44-
4531
pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {
46-
tcx.hir().krate().visit_all_item_likes(&mut OuterVisitor { tcx }.as_deep_visitor());
32+
for def_id in tcx.body_owners() {
33+
tcx.ensure().check_match(def_id);
34+
}
4735
tcx.sess.abort_if_errors();
4836
}
4937

0 commit comments

Comments
 (0)