@@ -98,7 +98,7 @@ impl error::Error for ExplicitBug {
98
98
}
99
99
}
100
100
101
- // Used for emitting structured error messages and other diagnostic information.
101
+ /// Used for emitting structured error messages and other diagnostic information.
102
102
#[ must_use]
103
103
pub struct DiagnosticBuilder < ' a > {
104
104
emitter : & ' a RefCell < Box < Emitter > > ,
@@ -109,7 +109,7 @@ pub struct DiagnosticBuilder<'a> {
109
109
children : Vec < SubDiagnostic > ,
110
110
}
111
111
112
- // For example a note attached to an error.
112
+ /// For example a note attached to an error.
113
113
struct SubDiagnostic {
114
114
level : Level ,
115
115
message : String ,
@@ -118,7 +118,7 @@ struct SubDiagnostic {
118
118
}
119
119
120
120
impl < ' a > DiagnosticBuilder < ' a > {
121
- // Emit the diagnostic.
121
+ /// Emit the diagnostic.
122
122
pub fn emit ( & mut self ) {
123
123
if self . cancelled ( ) {
124
124
return ;
@@ -132,11 +132,11 @@ impl<'a> DiagnosticBuilder<'a> {
132
132
// }
133
133
}
134
134
135
- // Cancel the diagnostic (a structured diagnostic must either be emitted or
136
- // cancelled or it will panic when dropped).
137
- // BEWARE: if this DiagnosticBuilder is an error, then creating it will
138
- // bump the error count on the Handler and cancelling it won't undo that.
139
- // If you want to decrement the error count you should use `Handler::cancel`.
135
+ /// Cancel the diagnostic (a structured diagnostic must either be emitted or
136
+ /// cancelled or it will panic when dropped).
137
+ /// BEWARE: if this DiagnosticBuilder is an error, then creating it will
138
+ /// bump the error count on the Handler and cancelling it won't undo that.
139
+ /// If you want to decrement the error count you should use `Handler::cancel`.
140
140
pub fn cancel ( & mut self ) {
141
141
self . level = Level :: Cancelled ;
142
142
}
@@ -160,12 +160,6 @@ impl<'a> DiagnosticBuilder<'a> {
160
160
self . sub ( Level :: Note , msg, Some ( sp) , None ) ;
161
161
self
162
162
}
163
- pub fn note_rfc_1214 ( & mut self , span : Span ) -> & mut DiagnosticBuilder < ' a > {
164
- self . span_note ( span,
165
- "this warning results from recent bug fixes and clarifications; \
166
- it will become a HARD ERROR in the next release. \
167
- See RFC 1214 for details.")
168
- }
169
163
pub fn help ( & mut self , msg : & str ) -> & mut DiagnosticBuilder < ' a > {
170
164
self . sub ( Level :: Help , msg, None , None ) ;
171
165
self
@@ -220,8 +214,8 @@ impl<'a> DiagnosticBuilder<'a> {
220
214
self
221
215
}
222
216
223
- // Convenience function for internal use, clients should use one of the
224
- // struct_* methods on Handler.
217
+ /// Convenience function for internal use, clients should use one of the
218
+ /// struct_* methods on Handler.
225
219
fn new ( emitter : & ' a RefCell < Box < Emitter > > ,
226
220
level : Level ,
227
221
message : & str ) -> DiagnosticBuilder < ' a > {
@@ -235,8 +229,8 @@ impl<'a> DiagnosticBuilder<'a> {
235
229
}
236
230
}
237
231
238
- // Convenience function for internal use, clients should use one of the
239
- // public methods above.
232
+ /// Convenience function for internal use, clients should use one of the
233
+ /// public methods above.
240
234
fn sub ( & mut self ,
241
235
level : Level ,
242
236
message : & str ,
@@ -258,8 +252,8 @@ impl<'a> fmt::Debug for DiagnosticBuilder<'a> {
258
252
}
259
253
}
260
254
261
- // Destructor bomb - a DiagnosticBuilder must be either emitted or cancelled or
262
- // we emit a bug.
255
+ /// Destructor bomb - a DiagnosticBuilder must be either emitted or cancelled or
256
+ /// we emit a bug.
263
257
impl < ' a > Drop for DiagnosticBuilder < ' a > {
264
258
fn drop ( & mut self ) {
265
259
if !self . cancelled ( ) {
0 commit comments