]> git.lizzy.rs Git - rust.git/blobdiff - compiler/rustc_hir_analysis/src/collect.rs
Store a LocalDefId in hir::AnonConst.
[rust.git] / compiler / rustc_hir_analysis / src / collect.rs
index c269855af089614da02b186bbfed486738b28e5b..a9b2ea1d894bf17df8df979e624752709a22552b 100644 (file)
@@ -297,9 +297,8 @@ fn visit_generics(&mut self, generics: &'tcx hir::Generics<'tcx>) {
                 hir::GenericParamKind::Const { default, .. } => {
                     self.tcx.ensure().type_of(param.def_id);
                     if let Some(default) = default {
-                        let default_def_id = self.tcx.hir().local_def_id(default.hir_id);
                         // need to store default and type of default
-                        self.tcx.ensure().type_of(default_def_id);
+                        self.tcx.ensure().type_of(default.def_id);
                         self.tcx.ensure().const_param_default(param.def_id);
                     }
                 }
@@ -877,7 +876,7 @@ fn adt_def<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> ty::AdtDef<'tcx> {
 
                     let discr = if let Some(ref e) = v.disr_expr {
                         distance_from_explicit = 0;
-                        ty::VariantDiscr::Explicit(tcx.hir().local_def_id(e.hir_id).to_def_id())
+                        ty::VariantDiscr::Explicit(e.def_id.to_def_id())
                     } else {
                         ty::VariantDiscr::Relative(distance_from_explicit)
                     };