Skip to content

Commit e3115be

Browse files
authored
Rollup merge of rust-lang#63488 - RalfJung:diagnostic-docs, r=zackmdavis
improve DiagnosticBuilder docs Cc @estebank @oli-obk Is there any way to do something like `span_note` but with a label attached to the span? I thought `.span_note().span_label()` would do it, but no, that does not work.
2 parents 716a818 + fecf305 commit e3115be

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/librustc_errors/diagnostic.rs

+6
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,9 @@ impl Diagnostic {
120120
}
121121

122122
/// Adds a span/label to be included in the resulting snippet.
123+
/// This label will be shown together with the original span/label used when creating the
124+
/// diagnostic, *not* a span added by one of the `span_*` methods.
125+
///
123126
/// This is pushed onto the `MultiSpan` that was created when the
124127
/// diagnostic was first built. If you don't call this function at
125128
/// all, and you just supplied a `Span` to create the diagnostic,
@@ -196,6 +199,7 @@ impl Diagnostic {
196199
self
197200
}
198201

202+
/// Prints the span with a note above it.
199203
pub fn span_note<S: Into<MultiSpan>>(&mut self,
200204
sp: S,
201205
msg: &str)
@@ -209,6 +213,7 @@ impl Diagnostic {
209213
self
210214
}
211215

216+
/// Prints the span with a warn above it.
212217
pub fn span_warn<S: Into<MultiSpan>>(&mut self,
213218
sp: S,
214219
msg: &str)
@@ -222,6 +227,7 @@ impl Diagnostic {
222227
self
223228
}
224229

230+
/// Prints the span with some help above it.
225231
pub fn span_help<S: Into<MultiSpan>>(&mut self,
226232
sp: S,
227233
msg: &str)

0 commit comments

Comments
 (0)