diff --git a/compiler/rustc_hir/src/hir.rs b/compiler/rustc_hir/src/hir.rs index 21089b0208d..4ef3a699d3d 100644 --- a/compiler/rustc_hir/src/hir.rs +++ b/compiler/rustc_hir/src/hir.rs @@ -671,7 +671,7 @@ pub struct Crate<'hir> { pub attrs: BTreeMap, } -impl<'hir> Crate<'hir> { +impl Crate<'hir> { pub fn module(&self) -> &'hir Mod<'hir> { if let Some(OwnerNode::Crate(m)) = self.owners[CRATE_DEF_ID] { m } else { panic!() } } diff --git a/compiler/rustc_middle/src/hir/map/mod.rs b/compiler/rustc_middle/src/hir/map/mod.rs index 3989a94a47c..e6f56b0be93 100644 --- a/compiler/rustc_middle/src/hir/map/mod.rs +++ b/compiler/rustc_middle/src/hir/map/mod.rs @@ -160,7 +160,7 @@ pub fn krate(&self) -> &'hir Crate<'hir> { pub fn root_module(&self) -> &'hir Mod<'hir> { match self.tcx.hir_owner(CRATE_DEF_ID).map(|o| o.node) { Some(OwnerNode::Crate(item)) => item, - _ => panic!(), + _ => bug!(), } }