Skip to content

Commit 03bb9d1

Browse files
Rollup merge of #156502 - ferrocene:jyn/ctor-docs, r=Kivooeo
Give an example of a Ctor in the doc-comments
2 parents 63322d0 + c37d020 commit 03bb9d1

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

compiler/rustc_hir/src/def.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,11 @@ pub enum DefKind {
134134
},
135135
/// Refers to the struct or enum variant's constructor.
136136
///
137+
/// ```
138+
/// struct S;
139+
/// let x = S; // S in the value namespace is a Ctor
140+
/// ```
141+
///
137142
/// The reason `Ctor` exists in addition to [`DefKind::Struct`] and
138143
/// [`DefKind::Variant`] is because structs and enum variants exist
139144
/// in the *type* namespace, whereas struct and enum variant *constructors*

0 commit comments

Comments
 (0)