Avoid accessing HIR from MIR queries.
This commit is contained in:
parent
341883d051
commit
db03a2deb0
10 changed files with 35 additions and 41 deletions
|
@ -71,8 +71,9 @@ impl<'tcx> MirPass<'tcx> for ConstProp {
|
|||
}
|
||||
|
||||
let def_id = body.source.def_id().expect_local();
|
||||
let is_fn_like = tcx.hir().get_by_def_id(def_id).fn_kind().is_some();
|
||||
let is_assoc_const = tcx.def_kind(def_id) == DefKind::AssocConst;
|
||||
let def_kind = tcx.def_kind(def_id);
|
||||
let is_fn_like = def_kind.is_fn_like();
|
||||
let is_assoc_const = def_kind == DefKind::AssocConst;
|
||||
|
||||
// Only run const prop on functions, methods, closures and associated constants
|
||||
if !is_fn_like && !is_assoc_const {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue