Skip to content

Commit

Permalink
Rollup merge of rust-lang#63488 - RalfJung:diagnostic-docs, r=zackmdavis
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Centril authored Aug 13, 2019
2 parents 716a818 + fecf305 commit e3115be
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/librustc_errors/diagnostic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@ impl Diagnostic {
}

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

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

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

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

0 comments on commit e3115be

Please sign in to comment.