@@ -16,6 +16,8 @@ use std::str::FromStr;
16
16
use syn:: { spanned:: Spanned , Meta , MetaList , MetaNameValue } ;
17
17
use synstructure:: { BindingInfo , Structure , VariantInfo } ;
18
18
19
+ /// `Applicability` of a suggestion - mirrors `rustc_errors::Applicability` - and used to represent
20
+ /// the user's selection of applicability if specified in an attribute.
19
21
enum Applicability {
20
22
MachineApplicable ,
21
23
MaybeIncorrect ,
@@ -56,6 +58,7 @@ impl quote::ToTokens for Applicability {
56
58
}
57
59
}
58
60
61
+ /// Which kind of suggestion is being created?
59
62
#[ derive( Clone , Copy ) ]
60
63
enum SubdiagnosticSuggestionKind {
61
64
/// `#[suggestion]`
@@ -68,6 +71,7 @@ enum SubdiagnosticSuggestionKind {
68
71
Verbose ,
69
72
}
70
73
74
+ /// Which kind of subdiagnostic is being created from a variant?
71
75
#[ derive( Clone , Copy ) ]
72
76
enum SubdiagnosticKind {
73
77
/// `#[label(...)]`
@@ -129,6 +133,7 @@ impl quote::IdentFragment for SubdiagnosticKind {
129
133
}
130
134
}
131
135
136
+ /// The central struct for constructing the `add_to_diagnostic` method from an annotated struct.
132
137
pub ( crate ) struct SessionSubdiagnosticDerive < ' a > {
133
138
structure : Structure < ' a > ,
134
139
diag : syn:: Ident ,
@@ -210,6 +215,10 @@ impl<'a> SessionSubdiagnosticDerive<'a> {
210
215
}
211
216
}
212
217
218
+ /// Tracks persistent information required for building up the call to add to the diagnostic
219
+ /// for the final generated method. This is a separate struct to `SessionSubdiagnosticDerive`
220
+ /// only to be able to destructure and split `self.builder` and the `self.structure` up to avoid a
221
+ /// double mut borrow later on.
213
222
struct SessionSubdiagnosticDeriveBuilder < ' a > {
214
223
/// The identifier to use for the generated `DiagnosticBuilder` instance.
215
224
diag : & ' a syn:: Ident ,
0 commit comments