about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorMazdak Farrokhzad <twingoow@gmail.com>2019-08-14 04:18:45 +0200
committerGitHub <noreply@github.com>2019-08-14 04:18:45 +0200
commitf47226e0c4c0b60273387c5985946968b3e46cc2 (patch)
treeaffb4d81aeff759064a375827b708e384f7265c3 /src
parent4e1b86595590e2f78f8b4820a7f51687b31d38df (diff)
parentfecf30586786e21f381a8056b08ad1c2c5183736 (diff)
downloadrust-f47226e0c4c0b60273387c5985946968b3e46cc2.tar.gz
rust-f47226e0c4c0b60273387c5985946968b3e46cc2.zip
Rollup merge of #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.
Diffstat (limited to 'src')
-rw-r--r--src/librustc_errors/diagnostic.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/librustc_errors/diagnostic.rs b/src/librustc_errors/diagnostic.rs
index 424d7c00383..e11ba75da98 100644
--- a/src/librustc_errors/diagnostic.rs
+++ b/src/librustc_errors/diagnostic.rs
@@ -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,
@@ -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)
@@ -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)
@@ -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)