Use Session::diagnostic
in more places.
This commit is contained in:
parent
6e9573936f
commit
a179a53565
@ -102,7 +102,7 @@ impl<'a> PostExpansionVisitor<'a> {
|
|||||||
}
|
}
|
||||||
Err(abi::AbiDisabled::Unrecognized) => {
|
Err(abi::AbiDisabled::Unrecognized) => {
|
||||||
if self.sess.opts.pretty.map_or(true, |ppm| ppm.needs_hir()) {
|
if self.sess.opts.pretty.map_or(true, |ppm| ppm.needs_hir()) {
|
||||||
self.sess.parse_sess.span_diagnostic.span_delayed_bug(
|
self.sess.diagnostic().span_delayed_bug(
|
||||||
span,
|
span,
|
||||||
format!(
|
format!(
|
||||||
"unrecognized ABI not caught in lowering: {}",
|
"unrecognized ABI not caught in lowering: {}",
|
||||||
@ -628,7 +628,7 @@ fn maybe_stage_features(sess: &Session, features: &Features, krate: &ast::Crate)
|
|||||||
if all_stable {
|
if all_stable {
|
||||||
err.sugg = Some(attr.span);
|
err.sugg = Some(attr.span);
|
||||||
}
|
}
|
||||||
sess.parse_sess.span_diagnostic.emit_err(err);
|
sess.diagnostic().emit_err(err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -945,7 +945,7 @@ pub fn parse_repr_attr(sess: &Session, attr: &Attribute) -> Vec<ReprAttr> {
|
|||||||
assert!(attr.has_name(sym::repr), "expected `#[repr(..)]`, found: {attr:?}");
|
assert!(attr.has_name(sym::repr), "expected `#[repr(..)]`, found: {attr:?}");
|
||||||
use ReprAttr::*;
|
use ReprAttr::*;
|
||||||
let mut acc = Vec::new();
|
let mut acc = Vec::new();
|
||||||
let diagnostic = &sess.parse_sess.span_diagnostic;
|
let diagnostic = sess.diagnostic();
|
||||||
|
|
||||||
if let Some(items) = attr.meta_item_list() {
|
if let Some(items) = attr.meta_item_list() {
|
||||||
for item in items {
|
for item in items {
|
||||||
|
@ -1135,7 +1135,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
|
|||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
issued_spans.var_subdiag(
|
issued_spans.var_subdiag(
|
||||||
Some(&self.infcx.tcx.sess.parse_sess.span_diagnostic),
|
Some(self.infcx.tcx.sess.diagnostic()),
|
||||||
&mut err,
|
&mut err,
|
||||||
Some(issued_borrow.kind),
|
Some(issued_borrow.kind),
|
||||||
|kind, var_span| {
|
|kind, var_span| {
|
||||||
@ -1152,7 +1152,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
|
|||||||
);
|
);
|
||||||
|
|
||||||
borrow_spans.var_subdiag(
|
borrow_spans.var_subdiag(
|
||||||
Some(&self.infcx.tcx.sess.parse_sess.span_diagnostic),
|
Some(self.infcx.tcx.sess.diagnostic()),
|
||||||
&mut err,
|
&mut err,
|
||||||
Some(gen_borrow_kind),
|
Some(gen_borrow_kind),
|
||||||
|kind, var_span| {
|
|kind, var_span| {
|
||||||
|
@ -124,7 +124,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
|
|||||||
let did = did.expect_local();
|
let did = did.expect_local();
|
||||||
if let Some((span, hir_place)) = self.infcx.tcx.closure_kind_origin(did) {
|
if let Some((span, hir_place)) = self.infcx.tcx.closure_kind_origin(did) {
|
||||||
diag.eager_subdiagnostic(
|
diag.eager_subdiagnostic(
|
||||||
&self.infcx.tcx.sess.parse_sess.span_diagnostic,
|
self.infcx.tcx.sess.diagnostic(),
|
||||||
OnClosureNote::InvokedTwice {
|
OnClosureNote::InvokedTwice {
|
||||||
place_name: &ty::place_to_string_for_capture(
|
place_name: &ty::place_to_string_for_capture(
|
||||||
self.infcx.tcx,
|
self.infcx.tcx,
|
||||||
@ -146,7 +146,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
|
|||||||
let did = did.expect_local();
|
let did = did.expect_local();
|
||||||
if let Some((span, hir_place)) = self.infcx.tcx.closure_kind_origin(did) {
|
if let Some((span, hir_place)) = self.infcx.tcx.closure_kind_origin(did) {
|
||||||
diag.eager_subdiagnostic(
|
diag.eager_subdiagnostic(
|
||||||
&self.infcx.tcx.sess.parse_sess.span_diagnostic,
|
self.infcx.tcx.sess.diagnostic(),
|
||||||
OnClosureNote::MovedTwice {
|
OnClosureNote::MovedTwice {
|
||||||
place_name: &ty::place_to_string_for_capture(self.infcx.tcx, hir_place),
|
place_name: &ty::place_to_string_for_capture(self.infcx.tcx, hir_place),
|
||||||
span: *span,
|
span: *span,
|
||||||
@ -1119,7 +1119,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
|
|||||||
&& self.infcx.can_eq(self.param_env, ty, self_ty)
|
&& self.infcx.can_eq(self.param_env, ty, self_ty)
|
||||||
{
|
{
|
||||||
err.eager_subdiagnostic(
|
err.eager_subdiagnostic(
|
||||||
&self.infcx.tcx.sess.parse_sess.span_diagnostic,
|
self.infcx.tcx.sess.diagnostic(),
|
||||||
CaptureReasonSuggest::FreshReborrow {
|
CaptureReasonSuggest::FreshReborrow {
|
||||||
span: move_span.shrink_to_hi(),
|
span: move_span.shrink_to_hi(),
|
||||||
},
|
},
|
||||||
|
@ -31,10 +31,7 @@ pub fn expand(
|
|||||||
{
|
{
|
||||||
(item, true, ecx.with_def_site_ctxt(fn_kind.sig.span))
|
(item, true, ecx.with_def_site_ctxt(fn_kind.sig.span))
|
||||||
} else {
|
} else {
|
||||||
ecx.sess
|
ecx.sess.diagnostic().emit_err(errors::AllocErrorMustBeFn { span: item.span() });
|
||||||
.parse_sess
|
|
||||||
.span_diagnostic
|
|
||||||
.emit_err(errors::AllocErrorMustBeFn { span: item.span() });
|
|
||||||
return vec![orig_item];
|
return vec![orig_item];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -34,10 +34,7 @@ pub fn expand(
|
|||||||
{
|
{
|
||||||
(item, true, ecx.with_def_site_ctxt(ty.span))
|
(item, true, ecx.with_def_site_ctxt(ty.span))
|
||||||
} else {
|
} else {
|
||||||
ecx.sess
|
ecx.sess.diagnostic().emit_err(errors::AllocMustStatics { span: item.span() });
|
||||||
.parse_sess
|
|
||||||
.span_diagnostic
|
|
||||||
.emit_err(errors::AllocMustStatics { span: item.span() });
|
|
||||||
return vec![orig_item];
|
return vec![orig_item];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -389,7 +389,7 @@ pub fn expand_test_or_bench(
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn not_testable_error(cx: &ExtCtxt<'_>, attr_sp: Span, item: Option<&ast::Item>) {
|
fn not_testable_error(cx: &ExtCtxt<'_>, attr_sp: Span, item: Option<&ast::Item>) {
|
||||||
let diag = &cx.sess.parse_sess.span_diagnostic;
|
let diag = cx.sess.diagnostic();
|
||||||
let msg = "the `#[test]` attribute may only be used on a non-associated function";
|
let msg = "the `#[test]` attribute may only be used on a non-associated function";
|
||||||
let mut err = match item.map(|i| &i.kind) {
|
let mut err = match item.map(|i| &i.kind) {
|
||||||
// These were a warning before #92959 and need to continue being that to avoid breaking
|
// These were a warning before #92959 and need to continue being that to avoid breaking
|
||||||
@ -466,7 +466,7 @@ fn should_ignore_message(i: &ast::Item) -> Option<Symbol> {
|
|||||||
fn should_panic(cx: &ExtCtxt<'_>, i: &ast::Item) -> ShouldPanic {
|
fn should_panic(cx: &ExtCtxt<'_>, i: &ast::Item) -> ShouldPanic {
|
||||||
match attr::find_by_name(&i.attrs, sym::should_panic) {
|
match attr::find_by_name(&i.attrs, sym::should_panic) {
|
||||||
Some(attr) => {
|
Some(attr) => {
|
||||||
let sd = &cx.sess.parse_sess.span_diagnostic;
|
let sd = cx.sess.diagnostic();
|
||||||
|
|
||||||
match attr.meta_item_list() {
|
match attr.meta_item_list() {
|
||||||
// Handle #[should_panic(expected = "foo")]
|
// Handle #[should_panic(expected = "foo")]
|
||||||
@ -535,7 +535,7 @@ fn check_test_signature(
|
|||||||
f: &ast::Fn,
|
f: &ast::Fn,
|
||||||
) -> Result<(), ErrorGuaranteed> {
|
) -> Result<(), ErrorGuaranteed> {
|
||||||
let has_should_panic_attr = attr::contains_name(&i.attrs, sym::should_panic);
|
let has_should_panic_attr = attr::contains_name(&i.attrs, sym::should_panic);
|
||||||
let sd = &cx.sess.parse_sess.span_diagnostic;
|
let sd = cx.sess.diagnostic();
|
||||||
|
|
||||||
if let ast::Unsafe::Yes(span) = f.sig.header.unsafety {
|
if let ast::Unsafe::Yes(span) = f.sig.header.unsafety {
|
||||||
return Err(sd.emit_err(errors::TestBadFn { span: i.span, cause: span, kind: "unsafe" }));
|
return Err(sd.emit_err(errors::TestBadFn { span: i.span, cause: span, kind: "unsafe" }));
|
||||||
@ -579,7 +579,7 @@ fn check_bench_signature(
|
|||||||
// N.B., inadequate check, but we're running
|
// N.B., inadequate check, but we're running
|
||||||
// well before resolve, can't get too deep.
|
// well before resolve, can't get too deep.
|
||||||
if f.sig.decl.inputs.len() != 1 {
|
if f.sig.decl.inputs.len() != 1 {
|
||||||
return Err(cx.sess.parse_sess.span_diagnostic.emit_err(errors::BenchSig { span: i.span }));
|
return Err(cx.sess.diagnostic().emit_err(errors::BenchSig { span: i.span }));
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
@ -143,7 +143,7 @@ pub fn link_binary<'a>(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if sess.opts.json_artifact_notifications {
|
if sess.opts.json_artifact_notifications {
|
||||||
sess.parse_sess.span_diagnostic.emit_artifact_notification(&out_filename, "link");
|
sess.diagnostic().emit_artifact_notification(&out_filename, "link");
|
||||||
}
|
}
|
||||||
|
|
||||||
if sess.prof.enabled() {
|
if sess.prof.enabled() {
|
||||||
|
@ -148,7 +148,7 @@ where
|
|||||||
let mut err = tcx.sess.create_err(err);
|
let mut err = tcx.sess.create_err(err);
|
||||||
|
|
||||||
let msg = error.diagnostic_message();
|
let msg = error.diagnostic_message();
|
||||||
error.add_args(&tcx.sess.parse_sess.span_diagnostic, &mut err);
|
error.add_args(tcx.sess.diagnostic(), &mut err);
|
||||||
|
|
||||||
// Use *our* span to label the interp error
|
// Use *our* span to label the interp error
|
||||||
err.span_label(our_span, msg);
|
err.span_label(our_span, msg);
|
||||||
|
@ -437,7 +437,7 @@ pub trait ReportErrorExt {
|
|||||||
{
|
{
|
||||||
ty::tls::with(move |tcx| {
|
ty::tls::with(move |tcx| {
|
||||||
let mut builder = tcx.sess.struct_allow(DiagnosticMessage::Str(String::new().into()));
|
let mut builder = tcx.sess.struct_allow(DiagnosticMessage::Str(String::new().into()));
|
||||||
let handler = &tcx.sess.parse_sess.span_diagnostic;
|
let handler = tcx.sess.diagnostic();
|
||||||
let message = self.diagnostic_message();
|
let message = self.diagnostic_message();
|
||||||
self.add_args(handler, &mut builder);
|
self.add_args(handler, &mut builder);
|
||||||
let s = handler.eagerly_translate_to_string(message, builder.args());
|
let s = handler.eagerly_translate_to_string(message, builder.args());
|
||||||
|
@ -470,7 +470,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
|
|||||||
backtrace.print_backtrace();
|
backtrace.print_backtrace();
|
||||||
// FIXME(fee1-dead), HACK: we want to use the error as title therefore we can just extract the
|
// FIXME(fee1-dead), HACK: we want to use the error as title therefore we can just extract the
|
||||||
// label and arguments from the InterpError.
|
// label and arguments from the InterpError.
|
||||||
let handler = &self.tcx.sess.parse_sess.span_diagnostic;
|
let handler = self.tcx.sess.diagnostic();
|
||||||
#[allow(rustc::untranslatable_diagnostic)]
|
#[allow(rustc::untranslatable_diagnostic)]
|
||||||
let mut diag = self.tcx.sess.struct_allow("");
|
let mut diag = self.tcx.sess.struct_allow("");
|
||||||
let msg = e.diagnostic_message();
|
let msg = e.diagnostic_message();
|
||||||
|
@ -1119,7 +1119,7 @@ impl<'a> ExtCtxt<'a> {
|
|||||||
sp: S,
|
sp: S,
|
||||||
msg: impl Into<DiagnosticMessage>,
|
msg: impl Into<DiagnosticMessage>,
|
||||||
) -> DiagnosticBuilder<'a, ErrorGuaranteed> {
|
) -> DiagnosticBuilder<'a, ErrorGuaranteed> {
|
||||||
self.sess.parse_sess.span_diagnostic.struct_span_err(sp, msg)
|
self.sess.diagnostic().struct_span_err(sp, msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[track_caller]
|
#[track_caller]
|
||||||
@ -1143,15 +1143,15 @@ impl<'a> ExtCtxt<'a> {
|
|||||||
#[rustc_lint_diagnostics]
|
#[rustc_lint_diagnostics]
|
||||||
#[track_caller]
|
#[track_caller]
|
||||||
pub fn span_err<S: Into<MultiSpan>>(&self, sp: S, msg: impl Into<DiagnosticMessage>) {
|
pub fn span_err<S: Into<MultiSpan>>(&self, sp: S, msg: impl Into<DiagnosticMessage>) {
|
||||||
self.sess.parse_sess.span_diagnostic.span_err(sp, msg);
|
self.sess.diagnostic().span_err(sp, msg);
|
||||||
}
|
}
|
||||||
#[rustc_lint_diagnostics]
|
#[rustc_lint_diagnostics]
|
||||||
#[track_caller]
|
#[track_caller]
|
||||||
pub fn span_warn<S: Into<MultiSpan>>(&self, sp: S, msg: impl Into<DiagnosticMessage>) {
|
pub fn span_warn<S: Into<MultiSpan>>(&self, sp: S, msg: impl Into<DiagnosticMessage>) {
|
||||||
self.sess.parse_sess.span_diagnostic.span_warn(sp, msg);
|
self.sess.diagnostic().span_warn(sp, msg);
|
||||||
}
|
}
|
||||||
pub fn span_bug<S: Into<MultiSpan>>(&self, sp: S, msg: impl Into<String>) -> ! {
|
pub fn span_bug<S: Into<MultiSpan>>(&self, sp: S, msg: impl Into<String>) -> ! {
|
||||||
self.sess.parse_sess.span_diagnostic.span_bug(sp, msg);
|
self.sess.diagnostic().span_bug(sp, msg);
|
||||||
}
|
}
|
||||||
pub fn trace_macros_diag(&mut self) {
|
pub fn trace_macros_diag(&mut self) {
|
||||||
for (span, notes) in self.expansions.iter() {
|
for (span, notes) in self.expansions.iter() {
|
||||||
@ -1165,7 +1165,7 @@ impl<'a> ExtCtxt<'a> {
|
|||||||
self.expansions.clear();
|
self.expansions.clear();
|
||||||
}
|
}
|
||||||
pub fn bug(&self, msg: &'static str) -> ! {
|
pub fn bug(&self, msg: &'static str) -> ! {
|
||||||
self.sess.parse_sess.span_diagnostic.bug(msg);
|
self.sess.diagnostic().bug(msg);
|
||||||
}
|
}
|
||||||
pub fn trace_macros(&self) -> bool {
|
pub fn trace_macros(&self) -> bool {
|
||||||
self.ecfg.trace_mac
|
self.ecfg.trace_mac
|
||||||
@ -1286,9 +1286,8 @@ pub fn expr_to_string(
|
|||||||
|
|
||||||
/// Non-fatally assert that `tts` is empty. Note that this function
|
/// Non-fatally assert that `tts` is empty. Note that this function
|
||||||
/// returns even when `tts` is non-empty, macros that *need* to stop
|
/// returns even when `tts` is non-empty, macros that *need* to stop
|
||||||
/// compilation should call
|
/// compilation should call `cx.diagnostic().abort_if_errors()`
|
||||||
/// `cx.parse_sess.span_diagnostic.abort_if_errors()` (this should be
|
/// (this should be done as rarely as possible).
|
||||||
/// done as rarely as possible).
|
|
||||||
pub fn check_zero_tts(cx: &ExtCtxt<'_>, span: Span, tts: TokenStream, name: &str) {
|
pub fn check_zero_tts(cx: &ExtCtxt<'_>, span: Span, tts: TokenStream, name: &str) {
|
||||||
if !tts.is_empty() {
|
if !tts.is_empty() {
|
||||||
cx.emit_err(errors::TakesNoArguments { span, name });
|
cx.emit_err(errors::TakesNoArguments { span, name });
|
||||||
|
@ -475,17 +475,14 @@ pub fn compile_declarative_macro(
|
|||||||
|
|
||||||
let s = parse_failure_msg(&token);
|
let s = parse_failure_msg(&token);
|
||||||
let sp = token.span.substitute_dummy(def.span);
|
let sp = token.span.substitute_dummy(def.span);
|
||||||
let mut err = sess.parse_sess.span_diagnostic.struct_span_err(sp, s);
|
let mut err = sess.diagnostic().struct_span_err(sp, s);
|
||||||
err.span_label(sp, msg);
|
err.span_label(sp, msg);
|
||||||
annotate_doc_comment(&mut err, sess.source_map(), sp);
|
annotate_doc_comment(&mut err, sess.source_map(), sp);
|
||||||
err.emit();
|
err.emit();
|
||||||
return dummy_syn_ext();
|
return dummy_syn_ext();
|
||||||
}
|
}
|
||||||
Error(sp, msg) => {
|
Error(sp, msg) => {
|
||||||
sess.parse_sess
|
sess.diagnostic().struct_span_err(sp.substitute_dummy(def.span), msg).emit();
|
||||||
.span_diagnostic
|
|
||||||
.struct_span_err(sp.substitute_dummy(def.span), msg)
|
|
||||||
.emit();
|
|
||||||
return dummy_syn_ext();
|
return dummy_syn_ext();
|
||||||
}
|
}
|
||||||
ErrorReported(_) => {
|
ErrorReported(_) => {
|
||||||
@ -514,10 +511,10 @@ pub fn compile_declarative_macro(
|
|||||||
valid &= check_lhs_nt_follows(&sess.parse_sess, def, &tt);
|
valid &= check_lhs_nt_follows(&sess.parse_sess, def, &tt);
|
||||||
return tt;
|
return tt;
|
||||||
}
|
}
|
||||||
sess.parse_sess.span_diagnostic.span_bug(def.span, "wrong-structured lhs")
|
sess.diagnostic().span_bug(def.span, "wrong-structured lhs")
|
||||||
})
|
})
|
||||||
.collect::<Vec<mbe::TokenTree>>(),
|
.collect::<Vec<mbe::TokenTree>>(),
|
||||||
_ => sess.parse_sess.span_diagnostic.span_bug(def.span, "wrong-structured lhs"),
|
_ => sess.diagnostic().span_bug(def.span, "wrong-structured lhs"),
|
||||||
};
|
};
|
||||||
|
|
||||||
let rhses = match &argument_map[&MacroRulesNormalizedIdent::new(rhs_nm)] {
|
let rhses = match &argument_map[&MacroRulesNormalizedIdent::new(rhs_nm)] {
|
||||||
@ -536,10 +533,10 @@ pub fn compile_declarative_macro(
|
|||||||
.pop()
|
.pop()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
}
|
}
|
||||||
sess.parse_sess.span_diagnostic.span_bug(def.span, "wrong-structured rhs")
|
sess.diagnostic().span_bug(def.span, "wrong-structured rhs")
|
||||||
})
|
})
|
||||||
.collect::<Vec<mbe::TokenTree>>(),
|
.collect::<Vec<mbe::TokenTree>>(),
|
||||||
_ => sess.parse_sess.span_diagnostic.span_bug(def.span, "wrong-structured rhs"),
|
_ => sess.diagnostic().span_bug(def.span, "wrong-structured rhs"),
|
||||||
};
|
};
|
||||||
|
|
||||||
for rhs in &rhses {
|
for rhs in &rhses {
|
||||||
@ -595,7 +592,7 @@ pub fn compile_declarative_macro(
|
|||||||
mbe::TokenTree::Delimited(_, delimited) => {
|
mbe::TokenTree::Delimited(_, delimited) => {
|
||||||
mbe::macro_parser::compute_locs(&delimited.tts)
|
mbe::macro_parser::compute_locs(&delimited.tts)
|
||||||
}
|
}
|
||||||
_ => sess.parse_sess.span_diagnostic.span_bug(def.span, "malformed macro lhs"),
|
_ => sess.diagnostic().span_bug(def.span, "malformed macro lhs"),
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.collect()
|
.collect()
|
||||||
|
@ -156,7 +156,7 @@ impl MultiItemModifier for DeriveProcMacro {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
let error_count_before = ecx.sess.parse_sess.span_diagnostic.err_count();
|
let error_count_before = ecx.sess.diagnostic().err_count();
|
||||||
let mut parser =
|
let mut parser =
|
||||||
rustc_parse::stream_to_parser(&ecx.sess.parse_sess, stream, Some("proc-macro derive"));
|
rustc_parse::stream_to_parser(&ecx.sess.parse_sess, stream, Some("proc-macro derive"));
|
||||||
let mut items = vec![];
|
let mut items = vec![];
|
||||||
@ -179,7 +179,7 @@ impl MultiItemModifier for DeriveProcMacro {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// fail if there have been errors emitted
|
// fail if there have been errors emitted
|
||||||
if ecx.sess.parse_sess.span_diagnostic.err_count() > error_count_before {
|
if ecx.sess.diagnostic().err_count() > error_count_before {
|
||||||
ecx.sess.emit_err(errors::ProcMacroDeriveTokens { span });
|
ecx.sess.emit_err(errors::ProcMacroDeriveTokens { span });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -374,7 +374,7 @@ impl<'tcx> InferCtxt<'tcx> {
|
|||||||
multi_suggestions,
|
multi_suggestions,
|
||||||
bad_label,
|
bad_label,
|
||||||
}
|
}
|
||||||
.into_diagnostic(&self.tcx.sess.parse_sess.span_diagnostic),
|
.into_diagnostic(self.tcx.sess.diagnostic()),
|
||||||
TypeAnnotationNeeded::E0283 => AmbiguousImpl {
|
TypeAnnotationNeeded::E0283 => AmbiguousImpl {
|
||||||
span,
|
span,
|
||||||
source_kind,
|
source_kind,
|
||||||
@ -384,7 +384,7 @@ impl<'tcx> InferCtxt<'tcx> {
|
|||||||
multi_suggestions,
|
multi_suggestions,
|
||||||
bad_label,
|
bad_label,
|
||||||
}
|
}
|
||||||
.into_diagnostic(&self.tcx.sess.parse_sess.span_diagnostic),
|
.into_diagnostic(self.tcx.sess.diagnostic()),
|
||||||
TypeAnnotationNeeded::E0284 => AmbiguousReturn {
|
TypeAnnotationNeeded::E0284 => AmbiguousReturn {
|
||||||
span,
|
span,
|
||||||
source_kind,
|
source_kind,
|
||||||
@ -394,7 +394,7 @@ impl<'tcx> InferCtxt<'tcx> {
|
|||||||
multi_suggestions,
|
multi_suggestions,
|
||||||
bad_label,
|
bad_label,
|
||||||
}
|
}
|
||||||
.into_diagnostic(&self.tcx.sess.parse_sess.span_diagnostic),
|
.into_diagnostic(self.tcx.sess.diagnostic()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -581,7 +581,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
|
|||||||
multi_suggestions,
|
multi_suggestions,
|
||||||
bad_label: None,
|
bad_label: None,
|
||||||
}
|
}
|
||||||
.into_diagnostic(&self.tcx.sess.parse_sess.span_diagnostic),
|
.into_diagnostic(self.tcx.sess.diagnostic()),
|
||||||
TypeAnnotationNeeded::E0283 => AmbiguousImpl {
|
TypeAnnotationNeeded::E0283 => AmbiguousImpl {
|
||||||
span,
|
span,
|
||||||
source_kind,
|
source_kind,
|
||||||
@ -591,7 +591,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
|
|||||||
multi_suggestions,
|
multi_suggestions,
|
||||||
bad_label: None,
|
bad_label: None,
|
||||||
}
|
}
|
||||||
.into_diagnostic(&self.tcx.sess.parse_sess.span_diagnostic),
|
.into_diagnostic(self.tcx.sess.diagnostic()),
|
||||||
TypeAnnotationNeeded::E0284 => AmbiguousReturn {
|
TypeAnnotationNeeded::E0284 => AmbiguousReturn {
|
||||||
span,
|
span,
|
||||||
source_kind,
|
source_kind,
|
||||||
@ -601,7 +601,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
|
|||||||
multi_suggestions,
|
multi_suggestions,
|
||||||
bad_label: None,
|
bad_label: None,
|
||||||
}
|
}
|
||||||
.into_diagnostic(&self.tcx.sess.parse_sess.span_diagnostic),
|
.into_diagnostic(self.tcx.sess.diagnostic()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -140,7 +140,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
|
|||||||
span,
|
span,
|
||||||
notes: reference_valid.into_iter().chain(content_valid).collect(),
|
notes: reference_valid.into_iter().chain(content_valid).collect(),
|
||||||
}
|
}
|
||||||
.into_diagnostic(&self.tcx.sess.parse_sess.span_diagnostic)
|
.into_diagnostic(self.tcx.sess.diagnostic())
|
||||||
}
|
}
|
||||||
infer::RelateObjectBound(span) => {
|
infer::RelateObjectBound(span) => {
|
||||||
let object_valid = note_and_explain::RegionExplanation::new(
|
let object_valid = note_and_explain::RegionExplanation::new(
|
||||||
@ -161,7 +161,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
|
|||||||
span,
|
span,
|
||||||
notes: object_valid.into_iter().chain(pointer_valid).collect(),
|
notes: object_valid.into_iter().chain(pointer_valid).collect(),
|
||||||
}
|
}
|
||||||
.into_diagnostic(&self.tcx.sess.parse_sess.span_diagnostic)
|
.into_diagnostic(self.tcx.sess.diagnostic())
|
||||||
}
|
}
|
||||||
infer::RelateParamBound(span, ty, opt_span) => {
|
infer::RelateParamBound(span, ty, opt_span) => {
|
||||||
let prefix = match *sub {
|
let prefix = match *sub {
|
||||||
@ -177,7 +177,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
|
|||||||
self.tcx, sub, opt_span, prefix, suffix,
|
self.tcx, sub, opt_span, prefix, suffix,
|
||||||
);
|
);
|
||||||
FulfillReqLifetime { span, ty: self.resolve_vars_if_possible(ty), note }
|
FulfillReqLifetime { span, ty: self.resolve_vars_if_possible(ty), note }
|
||||||
.into_diagnostic(&self.tcx.sess.parse_sess.span_diagnostic)
|
.into_diagnostic(self.tcx.sess.diagnostic())
|
||||||
}
|
}
|
||||||
infer::RelateRegionParamBound(span) => {
|
infer::RelateRegionParamBound(span) => {
|
||||||
let param_instantiated = note_and_explain::RegionExplanation::new(
|
let param_instantiated = note_and_explain::RegionExplanation::new(
|
||||||
@ -198,7 +198,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
|
|||||||
span,
|
span,
|
||||||
notes: param_instantiated.into_iter().chain(param_must_outlive).collect(),
|
notes: param_instantiated.into_iter().chain(param_must_outlive).collect(),
|
||||||
}
|
}
|
||||||
.into_diagnostic(&self.tcx.sess.parse_sess.span_diagnostic)
|
.into_diagnostic(self.tcx.sess.diagnostic())
|
||||||
}
|
}
|
||||||
infer::ReferenceOutlivesReferent(ty, span) => {
|
infer::ReferenceOutlivesReferent(ty, span) => {
|
||||||
let pointer_valid = note_and_explain::RegionExplanation::new(
|
let pointer_valid = note_and_explain::RegionExplanation::new(
|
||||||
@ -220,7 +220,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
|
|||||||
ty: self.resolve_vars_if_possible(ty),
|
ty: self.resolve_vars_if_possible(ty),
|
||||||
notes: pointer_valid.into_iter().chain(data_valid).collect(),
|
notes: pointer_valid.into_iter().chain(data_valid).collect(),
|
||||||
}
|
}
|
||||||
.into_diagnostic(&self.tcx.sess.parse_sess.span_diagnostic)
|
.into_diagnostic(self.tcx.sess.diagnostic())
|
||||||
}
|
}
|
||||||
infer::CompareImplItemObligation { span, impl_item_def_id, trait_item_def_id } => {
|
infer::CompareImplItemObligation { span, impl_item_def_id, trait_item_def_id } => {
|
||||||
let mut err = self.report_extra_impl_obligation(
|
let mut err = self.report_extra_impl_obligation(
|
||||||
@ -281,7 +281,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
|
|||||||
span,
|
span,
|
||||||
notes: instantiated.into_iter().chain(must_outlive).collect(),
|
notes: instantiated.into_iter().chain(must_outlive).collect(),
|
||||||
}
|
}
|
||||||
.into_diagnostic(&self.tcx.sess.parse_sess.span_diagnostic)
|
.into_diagnostic(self.tcx.sess.diagnostic())
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
if sub.is_error() || sup.is_error() {
|
if sub.is_error() || sup.is_error() {
|
||||||
|
@ -519,9 +519,7 @@ fn write_out_deps(tcx: TyCtxt<'_>, outputs: &OutputFilenames, out_filenames: &[P
|
|||||||
match result {
|
match result {
|
||||||
Ok(_) => {
|
Ok(_) => {
|
||||||
if sess.opts.json_artifact_notifications {
|
if sess.opts.json_artifact_notifications {
|
||||||
sess.parse_sess
|
sess.diagnostic().emit_artifact_notification(deps_filename, "dep-info");
|
||||||
.span_diagnostic
|
|
||||||
.emit_artifact_notification(deps_filename, "dep-info");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Err(error) => {
|
Err(error) => {
|
||||||
|
@ -267,7 +267,7 @@ impl CStore {
|
|||||||
let unused_externs =
|
let unused_externs =
|
||||||
self.unused_externs.iter().map(|ident| ident.to_ident_string()).collect::<Vec<_>>();
|
self.unused_externs.iter().map(|ident| ident.to_ident_string()).collect::<Vec<_>>();
|
||||||
let unused_externs = unused_externs.iter().map(String::as_str).collect::<Vec<&str>>();
|
let unused_externs = unused_externs.iter().map(String::as_str).collect::<Vec<&str>>();
|
||||||
tcx.sess.parse_sess.span_diagnostic.emit_unused_externs(
|
tcx.sess.diagnostic().emit_unused_externs(
|
||||||
level,
|
level,
|
||||||
json_unused_externs.is_loud(),
|
json_unused_externs.is_loud(),
|
||||||
&unused_externs,
|
&unused_externs,
|
||||||
|
@ -91,10 +91,7 @@ pub fn encode_and_write_metadata(tcx: TyCtxt<'_>) -> (EncodedMetadata, bool) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
if tcx.sess.opts.json_artifact_notifications {
|
if tcx.sess.opts.json_artifact_notifications {
|
||||||
tcx.sess
|
tcx.sess.diagnostic().emit_artifact_notification(out_filename.as_path(), "metadata");
|
||||||
.parse_sess
|
|
||||||
.span_diagnostic
|
|
||||||
.emit_artifact_notification(out_filename.as_path(), "metadata");
|
|
||||||
}
|
}
|
||||||
(filename, None)
|
(filename, None)
|
||||||
} else {
|
} else {
|
||||||
|
@ -605,7 +605,7 @@ pub(crate) fn report_cycle<'a>(
|
|||||||
note_span: (),
|
note_span: (),
|
||||||
};
|
};
|
||||||
|
|
||||||
cycle_diag.into_diagnostic(&sess.parse_sess.span_diagnostic)
|
cycle_diag.into_diagnostic(sess.diagnostic())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn print_query_stack<Qcx: QueryContext>(
|
pub fn print_query_stack<Qcx: QueryContext>(
|
||||||
|
@ -302,7 +302,7 @@ impl Session {
|
|||||||
if diags.is_empty() {
|
if diags.is_empty() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
self.parse_sess.span_diagnostic.emit_future_breakage_report(diags);
|
self.diagnostic().emit_future_breakage_report(diags);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns true if the crate is a testing one.
|
/// Returns true if the crate is a testing one.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user