Skip to content

Commit fea7b59

Browse files
committed
Make check_match take a LocalDefId.
1 parent 1767585 commit fea7b59

File tree

3 files changed

+7
-11
lines changed

3 files changed

+7
-11
lines changed

compiler/rustc_interface/src/passes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -765,7 +765,7 @@ fn analysis(tcx: TyCtxt<'_>, (): ()) -> Result<()> {
765765
parallel!(
766766
{
767767
sess.time("match_checking", || {
768-
tcx.hir().par_body_owners(|def_id| tcx.ensure().check_match(def_id.to_def_id()))
768+
tcx.hir().par_body_owners(|def_id| tcx.ensure().check_match(def_id))
769769
});
770770
},
771771
{

compiler/rustc_middle/src/query/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1114,9 +1114,9 @@ rustc_queries! {
11141114
desc { "converting literal to mir constant" }
11151115
}
11161116

1117-
query check_match(key: DefId) {
1118-
desc { |tcx| "match-checking `{}`", tcx.def_path_str(key) }
1119-
cache_on_disk_if { key.is_local() }
1117+
query check_match(key: LocalDefId) {
1118+
desc { |tcx| "match-checking `{}`", tcx.def_path_str(key.to_def_id()) }
1119+
cache_on_disk_if { true }
11201120
}
11211121

11221122
/// Performs part of the privacy check and computes effective visibilities.

compiler/rustc_mir_build/src/thir/pattern/check_match.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use rustc_errors::{
1414
};
1515
use rustc_hir as hir;
1616
use rustc_hir::def::*;
17-
use rustc_hir::def_id::DefId;
17+
use rustc_hir::def_id::LocalDefId;
1818
use rustc_hir::intravisit::{self, Visitor};
1919
use rustc_hir::{HirId, Pat};
2020
use rustc_middle::ty::print::with_no_trimmed_paths;
@@ -27,12 +27,8 @@ use rustc_session::Session;
2727
use rustc_span::source_map::Spanned;
2828
use rustc_span::{BytePos, Span};
2929

30-
pub(crate) fn check_match(tcx: TyCtxt<'_>, def_id: DefId) {
31-
let body_id = match def_id.as_local() {
32-
None => return,
33-
Some(def_id) => tcx.hir().body_owned_by(def_id),
34-
};
35-
30+
pub(crate) fn check_match(tcx: TyCtxt<'_>, def_id: LocalDefId) {
31+
let body_id = tcx.hir().body_owned_by(def_id);
3632
let pattern_arena = TypedArena::default();
3733
let mut visitor = MatchVisitor {
3834
tcx,

0 commit comments

Comments
 (0)