Skip to content

Commit

Permalink
Use LocalDefId in HIR const-checker
Browse files Browse the repository at this point in the history
  • Loading branch information
ecstatic-morse committed Jun 28, 2020
1 parent 1b28f94 commit 8509b69
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/librustc_passes/check_const.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ pub(crate) fn provide(providers: &mut Providers<'_>) {
struct CheckConstVisitor<'tcx> {
tcx: TyCtxt<'tcx>,
const_kind: Option<hir::ConstContext>,
def_id: Option<DefId>,
def_id: Option<LocalDefId>,
}

impl<'tcx> CheckConstVisitor<'tcx> {
Expand All @@ -94,7 +94,7 @@ impl<'tcx> CheckConstVisitor<'tcx> {

// If `def_id` is `None`, we don't need to consider stability attributes.
let def_id = match def_id {
Some(x) => x,
Some(x) => x.to_def_id(),
None => return true,
};

Expand Down Expand Up @@ -164,7 +164,7 @@ impl<'tcx> CheckConstVisitor<'tcx> {
fn recurse_into(
&mut self,
kind: Option<hir::ConstContext>,
def_id: Option<DefId>,
def_id: Option<LocalDefId>,
f: impl FnOnce(&mut Self),
) {
let parent_def_id = self.def_id;
Expand Down Expand Up @@ -192,7 +192,7 @@ impl<'tcx> Visitor<'tcx> for CheckConstVisitor<'tcx> {
fn visit_body(&mut self, body: &'tcx hir::Body<'tcx>) {
let owner = self.tcx.hir().body_owner_def_id(body.id());
let kind = self.tcx.hir().body_const_context(owner);
self.recurse_into(kind, Some(owner.to_def_id()), |this| intravisit::walk_body(this, body));
self.recurse_into(kind, Some(owner), |this| intravisit::walk_body(this, body));
}

fn visit_expr(&mut self, e: &'tcx hir::Expr<'tcx>) {
Expand Down

0 comments on commit 8509b69

Please sign in to comment.