X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=compiler%2Frustc_hir%2Fsrc%2Fdef.rs;h=ac33a963027f91f10e227d222cb71d25588eab4b;hb=7907385999b4a83d37ed31d334f3ed9ca02983a1;hp=53d60d280c001dcf3179d0488facd869e828a5dc;hpb=491f619f564a4ff9ae4cc837e27bb919d04c31be;p=rust.git diff --git a/compiler/rustc_hir/src/def.rs b/compiler/rustc_hir/src/def.rs index 53d60d280c0..ac33a963027 100644 --- a/compiler/rustc_hir/src/def.rs +++ b/compiler/rustc_hir/src/def.rs @@ -1,4 +1,4 @@ -use crate::def_id::{DefId, CRATE_DEF_INDEX, LOCAL_CRATE}; +use crate::def_id::DefId; use crate::hir; use rustc_ast as ast; @@ -124,9 +124,7 @@ impl DefKind { pub fn descr(self, def_id: DefId) -> &'static str { match self { DefKind::Fn => "function", - DefKind::Mod if def_id.index == CRATE_DEF_INDEX && def_id.krate != LOCAL_CRATE => { - "crate" - } + DefKind::Mod if def_id.is_crate_root() && !def_id.is_local() => "crate", DefKind::Mod => "module", DefKind::Static(..) => "static", DefKind::Enum => "enum", @@ -314,6 +312,7 @@ pub enum Res { /// HACK(min_const_generics): self types also have an optional requirement to **not** mention /// any generic parameters to allow the following with `min_const_generics`: /// ``` + /// # struct Foo; /// impl Foo { fn test() -> [u8; std::mem::size_of::()] { todo!() } } /// /// struct Bar([u8; baz::()]);