span: move MultiSpan
`MultiSpan` contains labels, which are more complicated with the introduction of diagnostic translation and will use types from `rustc_errors` - however, `rustc_errors` depends on `rustc_span` so `rustc_span` cannot use types like `DiagnosticMessage` without dependency cycles. Introduce a new `rustc_error_messages` crate that can contain `DiagnosticMessage` and `MultiSpan`. Signed-off-by: David Wood <david.wood@huawei.com>
This commit is contained in:
parent
8c684563a5
commit
c45f29595d
66 changed files with 354 additions and 293 deletions
|
@ -15,12 +15,12 @@ use crate::emitter::{Emitter, HumanReadableErrorType};
|
|||
use crate::registry::Registry;
|
||||
use crate::DiagnosticId;
|
||||
use crate::ToolMetadata;
|
||||
use crate::{CodeSuggestion, SubDiagnostic};
|
||||
use crate::{CodeSuggestion, MultiSpan, SpanLabel, SubDiagnostic};
|
||||
use rustc_lint_defs::Applicability;
|
||||
|
||||
use rustc_data_structures::sync::Lrc;
|
||||
use rustc_span::hygiene::ExpnData;
|
||||
use rustc_span::{MultiSpan, Span, SpanLabel};
|
||||
use rustc_span::Span;
|
||||
use std::io::{self, Write};
|
||||
use std::path::Path;
|
||||
use std::sync::{Arc, Mutex};
|
||||
|
@ -423,7 +423,13 @@ impl DiagnosticSpan {
|
|||
suggestion: Option<(&String, Applicability)>,
|
||||
je: &JsonEmitter,
|
||||
) -> DiagnosticSpan {
|
||||
Self::from_span_etc(span.span, span.is_primary, span.label, suggestion, je)
|
||||
Self::from_span_etc(
|
||||
span.span,
|
||||
span.is_primary,
|
||||
span.label.map(|m| m.to_string()),
|
||||
suggestion,
|
||||
je,
|
||||
)
|
||||
}
|
||||
|
||||
fn from_span_etc(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue