mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-22 02:00:00 +03:00
Rollup merge of #156502 - ferrocene:jyn/ctor-docs, r=Kivooeo
Give an example of a Ctor in the doc-comments
This commit is contained in:
@@ -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*
|
||||
|
||||
Reference in New Issue
Block a user