Skip to content

Commit 8509b69

Browse files
Use LocalDefId in HIR const-checker
1 parent 1b28f94 commit 8509b69

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/librustc_passes/check_const.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ pub(crate) fn provide(providers: &mut Providers<'_>) {
7070
struct CheckConstVisitor<'tcx> {
7171
tcx: TyCtxt<'tcx>,
7272
const_kind: Option<hir::ConstContext>,
73-
def_id: Option<DefId>,
73+
def_id: Option<LocalDefId>,
7474
}
7575

7676
impl<'tcx> CheckConstVisitor<'tcx> {
@@ -94,7 +94,7 @@ impl<'tcx> CheckConstVisitor<'tcx> {
9494

9595
// If `def_id` is `None`, we don't need to consider stability attributes.
9696
let def_id = match def_id {
97-
Some(x) => x,
97+
Some(x) => x.to_def_id(),
9898
None => return true,
9999
};
100100

@@ -164,7 +164,7 @@ impl<'tcx> CheckConstVisitor<'tcx> {
164164
fn recurse_into(
165165
&mut self,
166166
kind: Option<hir::ConstContext>,
167-
def_id: Option<DefId>,
167+
def_id: Option<LocalDefId>,
168168
f: impl FnOnce(&mut Self),
169169
) {
170170
let parent_def_id = self.def_id;
@@ -192,7 +192,7 @@ impl<'tcx> Visitor<'tcx> for CheckConstVisitor<'tcx> {
192192
fn visit_body(&mut self, body: &'tcx hir::Body<'tcx>) {
193193
let owner = self.tcx.hir().body_owner_def_id(body.id());
194194
let kind = self.tcx.hir().body_const_context(owner);
195-
self.recurse_into(kind, Some(owner.to_def_id()), |this| intravisit::walk_body(this, body));
195+
self.recurse_into(kind, Some(owner), |this| intravisit::walk_body(this, body));
196196
}
197197

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

0 commit comments

Comments
 (0)