Make check_match take a LocalDefId.
This commit is contained in:
parent
1767585509
commit
fea7b59d12
3 changed files with 7 additions and 11 deletions
|
@ -765,7 +765,7 @@ fn analysis(tcx: TyCtxt<'_>, (): ()) -> Result<()> {
|
||||||
parallel!(
|
parallel!(
|
||||||
{
|
{
|
||||||
sess.time("match_checking", || {
|
sess.time("match_checking", || {
|
||||||
tcx.hir().par_body_owners(|def_id| tcx.ensure().check_match(def_id.to_def_id()))
|
tcx.hir().par_body_owners(|def_id| tcx.ensure().check_match(def_id))
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -1114,9 +1114,9 @@ rustc_queries! {
|
||||||
desc { "converting literal to mir constant" }
|
desc { "converting literal to mir constant" }
|
||||||
}
|
}
|
||||||
|
|
||||||
query check_match(key: DefId) {
|
query check_match(key: LocalDefId) {
|
||||||
desc { |tcx| "match-checking `{}`", tcx.def_path_str(key) }
|
desc { |tcx| "match-checking `{}`", tcx.def_path_str(key.to_def_id()) }
|
||||||
cache_on_disk_if { key.is_local() }
|
cache_on_disk_if { true }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Performs part of the privacy check and computes effective visibilities.
|
/// Performs part of the privacy check and computes effective visibilities.
|
||||||
|
|
|
@ -14,7 +14,7 @@ use rustc_errors::{
|
||||||
};
|
};
|
||||||
use rustc_hir as hir;
|
use rustc_hir as hir;
|
||||||
use rustc_hir::def::*;
|
use rustc_hir::def::*;
|
||||||
use rustc_hir::def_id::DefId;
|
use rustc_hir::def_id::LocalDefId;
|
||||||
use rustc_hir::intravisit::{self, Visitor};
|
use rustc_hir::intravisit::{self, Visitor};
|
||||||
use rustc_hir::{HirId, Pat};
|
use rustc_hir::{HirId, Pat};
|
||||||
use rustc_middle::ty::print::with_no_trimmed_paths;
|
use rustc_middle::ty::print::with_no_trimmed_paths;
|
||||||
|
@ -27,12 +27,8 @@ use rustc_session::Session;
|
||||||
use rustc_span::source_map::Spanned;
|
use rustc_span::source_map::Spanned;
|
||||||
use rustc_span::{BytePos, Span};
|
use rustc_span::{BytePos, Span};
|
||||||
|
|
||||||
pub(crate) fn check_match(tcx: TyCtxt<'_>, def_id: DefId) {
|
pub(crate) fn check_match(tcx: TyCtxt<'_>, def_id: LocalDefId) {
|
||||||
let body_id = match def_id.as_local() {
|
let body_id = tcx.hir().body_owned_by(def_id);
|
||||||
None => return,
|
|
||||||
Some(def_id) => tcx.hir().body_owned_by(def_id),
|
|
||||||
};
|
|
||||||
|
|
||||||
let pattern_arena = TypedArena::default();
|
let pattern_arena = TypedArena::default();
|
||||||
let mut visitor = MatchVisitor {
|
let mut visitor = MatchVisitor {
|
||||||
tcx,
|
tcx,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue