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
|
@ -18,10 +18,10 @@ use rustc_ast::{
|
|||
use rustc_ast_pretty::pprust;
|
||||
use rustc_data_structures::fx::FxHashSet;
|
||||
use rustc_errors::{pluralize, struct_span_err, Diagnostic, EmissionGuarantee, ErrorGuaranteed};
|
||||
use rustc_errors::{Applicability, DiagnosticBuilder, Handler, PResult};
|
||||
use rustc_errors::{Applicability, DiagnosticBuilder, Handler, MultiSpan, PResult};
|
||||
use rustc_span::source_map::Spanned;
|
||||
use rustc_span::symbol::{kw, Ident};
|
||||
use rustc_span::{MultiSpan, Span, SpanSnippetError, DUMMY_SP};
|
||||
use rustc_span::{Span, SpanSnippetError, DUMMY_SP};
|
||||
use std::ops::{Deref, DerefMut};
|
||||
|
||||
use std::mem::take;
|
||||
|
@ -1752,7 +1752,7 @@ impl<'a> Parser<'a> {
|
|||
let mut primary_span: MultiSpan = primary_span.into();
|
||||
for span_label in err.span.span_labels() {
|
||||
if let Some(label) = span_label.label {
|
||||
primary_span.push_span_label(span_label.span, label);
|
||||
primary_span.push_span_message(span_label.span, label);
|
||||
}
|
||||
}
|
||||
err.set_span(primary_span);
|
||||
|
|
|
@ -33,10 +33,10 @@ use rustc_data_structures::fx::FxHashMap;
|
|||
use rustc_data_structures::sync::Lrc;
|
||||
use rustc_errors::PResult;
|
||||
use rustc_errors::{
|
||||
struct_span_err, Applicability, DiagnosticBuilder, ErrorGuaranteed, FatalError,
|
||||
struct_span_err, Applicability, DiagnosticBuilder, ErrorGuaranteed, FatalError, MultiSpan,
|
||||
};
|
||||
use rustc_session::parse::ParseSess;
|
||||
use rustc_span::source_map::{MultiSpan, Span, DUMMY_SP};
|
||||
use rustc_span::source_map::{Span, DUMMY_SP};
|
||||
use rustc_span::symbol::{kw, sym, Ident, Symbol};
|
||||
use tracing::debug;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue