From c37d020c3bfa46bcef7c559dec1e0a7649db2200 Mon Sep 17 00:00:00 2001 From: jyn Date: Tue, 12 May 2026 12:27:31 +0200 Subject: [PATCH] give an example of a Ctor in the doc-comments --- compiler/rustc_hir/src/def.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/compiler/rustc_hir/src/def.rs b/compiler/rustc_hir/src/def.rs index 917b685958da..ad5d6b1509df 100644 --- a/compiler/rustc_hir/src/def.rs +++ b/compiler/rustc_hir/src/def.rs @@ -134,6 +134,11 @@ pub enum DefKind { }, /// Refers to the struct or enum variant's constructor. /// + /// ``` + /// struct S; + /// let x = S; // S in the value namespace is a Ctor + /// ``` + /// /// The reason `Ctor` exists in addition to [`DefKind::Struct`] and /// [`DefKind::Variant`] is because structs and enum variants exist /// in the *type* namespace, whereas struct and enum variant *constructors*