提交 edb39c0d 编写于 作者: R Ralf Jung

attempt to improve span_label docs

上级 a9025c57
......@@ -127,14 +127,15 @@ pub fn set_sort_span(&mut self, sp: Span) {
}
/// 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,
/// then the snippet will just include that `Span`, which is
/// called the primary span.
/// 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.
///
/// 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
pub fn span_label<T: Into<String>>(&mut self, span: Span, label: T) -> &mut Self {
self.span.push_span_label(span, label.into());
self
......
......@@ -184,11 +184,15 @@ pub fn delay_as_bug(&mut self) {
}
/// Adds a span/label to be included in the resulting snippet.
/// 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,
/// then the snippet will just include that `Span`, which is
/// called the primary span.
///
/// 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.
///
/// 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
pub fn span_label(&mut self, span: Span, label: impl Into<String>) -> &mut Self {
self.0.diagnostic.span_label(span, label);
self
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册