about summary refs log tree commit diff
path: root/compiler/rustc_hir/src/def.rs
diff options
context:
space:
mode:
authorlcnr <rust@lcnr.de>2024-11-25 18:50:20 +0100
committerBoxy <rust@boxyuwu.dev>2024-11-28 12:22:02 +0000
commitd401a078e7839745c8e7d172527111134ad206dd (patch)
treeeffa9dca2ab3458cece313c3034c7318d948350c /compiler/rustc_hir/src/def.rs
parent23ba2d11944a2eb538dca4583ff2465ca8da37a3 (diff)
downloadrust-d401a078e7839745c8e7d172527111134ad206dd.tar.gz
rust-d401a078e7839745c8e7d172527111134ad206dd.zip
update comment
Diffstat (limited to 'compiler/rustc_hir/src/def.rs')
-rw-r--r--compiler/rustc_hir/src/def.rs11
1 files changed, 10 insertions, 1 deletions
diff --git a/compiler/rustc_hir/src/def.rs b/compiler/rustc_hir/src/def.rs
index 3276f516a52..0b7ffc4af45 100644
--- a/compiler/rustc_hir/src/def.rs
+++ b/compiler/rustc_hir/src/def.rs
@@ -109,7 +109,16 @@ pub enum DefKind {
     Use,
     /// An `extern` block.
     ForeignMod,
-    /// Anonymous constant, e.g. the `1 + 2` in `[u8; 1 + 2]`
+    /// Anonymous constant, e.g. the `1 + 2` in `[u8; 1 + 2]`.
+    ///
+    /// Not all anon-consts are actually still relevant in the HIR. We lower
+    /// trivial const-arguments directly to `hir::ConstArgKind::Path`, at which
+    /// point the definition for the anon-const ends up unused and incomplete.
+    ///
+    /// We do not provide any a `Span` for the definition and pretty much all other
+    /// queries also ICE when using this `DefId`. Given that the `DefId` of such
+    /// constants should only be reachable by iterating all definitions of a
+    /// given crate, you should not have to worry about this.
     AnonConst,
     /// An inline constant, e.g. `const { 1 + 2 }`
     InlineConst,