about summary refs log tree commit diff
path: root/compiler/rustc_errors
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2020-11-17 09:19:55 +0000
committerbors <bors@rust-lang.org>2020-11-17 09:19:55 +0000
commitefcb3b39203a0d54269ca274601b8f73207fe10d (patch)
tree22535819e0a1e5ca7ef6aba831622a54dbbf1371 /compiler/rustc_errors
parent54508a26eb0595eb8417a4643f2ee572d6ca33d3 (diff)
parentd6c5c5217f907d6361a07380ddf7c6a49b46c815 (diff)
downloadrust-efcb3b39203a0d54269ca274601b8f73207fe10d.tar.gz
rust-efcb3b39203a0d54269ca274601b8f73207fe10d.zip
Auto merge of #79128 - m-ou-se:rollup-lzz1dym, r=m-ou-se
Rollup of 9 pull requests

Successful merges:

 - #77939 (Ensure that the source code display is working with DOS backline)
 - #78138 (Upgrade dlmalloc to version 0.2)
 - #78967 (Make codegen tests compatible with extra inlining)
 - #79027 (Limit storage duration of inlined always live locals)
 - #79077 (document that __rust_alloc is also magic to our LLVM fork)
 - #79088 (clarify `span_label` documentation)
 - #79097 (Code block invalid html tag lint)
 - #79105 (std: Fix test `symlink_hard_link` on Windows)
 - #79107 (build-manifest: strip newline from rustc version)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_errors')
-rw-r--r--compiler/rustc_errors/src/diagnostic_builder.rs18
1 files changed, 10 insertions, 8 deletions
diff --git a/compiler/rustc_errors/src/diagnostic_builder.rs b/compiler/rustc_errors/src/diagnostic_builder.rs
index 56acdf699ef..c9259a1502c 100644
--- a/compiler/rustc_errors/src/diagnostic_builder.rs
+++ b/compiler/rustc_errors/src/diagnostic_builder.rs
@@ -184,16 +184,18 @@ impl<'a> DiagnosticBuilder<'a> {
         self.cancel();
     }
 
-    /// Adds a span/label to be included in the resulting snippet.
+    /// Appends a labeled span to the diagnostic.
     ///
-    /// This is pushed onto the [`MultiSpan`] that was created when the diagnostic
-    /// was first built. That means it will be shown together with the original
-    /// span/label, *not* a span added by one of the `span_{note,warn,help,suggestions}` methods.
+    /// Labels are used to convey additional context for the diagnostic's primary span. They will
+    /// be shown together with the original diagnostic's span, *not* with spans added by
+    /// `span_note`, `span_help`, etc. Therefore, if the primary span is not displayable (because
+    /// the span is `DUMMY_SP` or the source code isn't found), labels will not be displayed
+    /// either.
     ///
-    /// This span is *not* considered a ["primary span"][`MultiSpan`]; only
-    /// the `Span` supplied when creating the diagnostic is primary.
-    ///
-    /// [`MultiSpan`]: ../rustc_span/struct.MultiSpan.html
+    /// Implementation-wise, the label span is pushed onto the [`MultiSpan`] that was created when
+    /// the diagnostic was constructed. However, the label span is *not* considered a
+    /// ["primary span"][`MultiSpan`]; only the `Span` supplied when creating the diagnostic is
+    /// primary.
     pub fn span_label(&mut self, span: Span, label: impl Into<String>) -> &mut Self {
         self.0.diagnostic.span_label(span, label);
         self