@@ -184,16 +184,18 @@ impl<'a> DiagnosticBuilder<'a> {
184184 self . cancel ( ) ;
185185 }
186186
187- /// Adds a span/label to be included in the resulting snippet .
187+ /// Appends a labeled span to the diagnostic .
188188 ///
189- /// This is pushed onto the [`MultiSpan`] that was created when the diagnostic
190- /// was first built. That means it will be shown together with the original
191- /// span/label, *not* a span added by one of the `span_{note,warn,help,suggestions}` methods.
189+ /// Labels are used to convey additional context for the diagnostic's primary span. They will
190+ /// be shown together with the original diagnostic's span, *not* with spans added by
191+ /// `span_note`, `span_help`, etc. Therefore, if the primary span is not displayable (because
192+ /// the span is `DUMMY_SP` or the source code isn't found), labels will not be displayed
193+ /// either.
192194 ///
193- /// This span is *not* considered a ["primary span"][ `MultiSpan`]; only
194- /// the `Span` supplied when creating the diagnostic is primary.
195- ///
196- /// [`MultiSpan`]: ../rustc_span/struct.MultiSpan.html
195+ /// Implementation-wise, the label span is pushed onto the [ `MultiSpan`] that was created when
196+ /// the diagnostic was constructed. However, the label span is *not* considered a
197+ /// ["primary span"][`MultiSpan`]; only the `Span` supplied when creating the diagnostic is
198+ /// primary.
197199 pub fn span_label ( & mut self , span : Span , label : impl Into < String > ) -> & mut Self {
198200 self . 0 . diagnostic . span_label ( span, label) ;
199201 self
0 commit comments