Rename Session::span_diagnostic as Session::dcx.

This commit is contained in:
Nicholas Nethercote 2023-12-18 06:21:26 +11:00
parent 9df1576e1d
commit 09af8a667c
66 changed files with 176 additions and 204 deletions

View file

@ -31,7 +31,7 @@ pub fn expand(
{
(item, true, ecx.with_def_site_ctxt(fn_kind.sig.span))
} else {
ecx.sess.diagnostic().emit_err(errors::AllocErrorMustBeFn { span: item.span() });
ecx.sess.dcx().emit_err(errors::AllocErrorMustBeFn { span: item.span() });
return vec![orig_item];
};

View file

@ -34,7 +34,7 @@ pub fn expand(
{
(item, true, ecx.with_def_site_ctxt(ty.span))
} else {
ecx.sess.diagnostic().emit_err(errors::AllocMustStatics { span: item.span() });
ecx.sess.dcx().emit_err(errors::AllocMustStatics { span: item.span() });
return vec![orig_item];
};

View file

@ -389,7 +389,7 @@ pub fn expand_test_or_bench(
}
fn not_testable_error(cx: &ExtCtxt<'_>, attr_sp: Span, item: Option<&ast::Item>) {
let diag = cx.sess.diagnostic();
let diag = cx.sess.dcx();
let msg = "the `#[test]` attribute may only be used on a non-associated function";
let mut err = match item.map(|i| &i.kind) {
// 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 {
match attr::find_by_name(&i.attrs, sym::should_panic) {
Some(attr) => {
let sd = cx.sess.diagnostic();
let sd = cx.sess.dcx();
match attr.meta_item_list() {
// Handle #[should_panic(expected = "foo")]
@ -535,7 +535,7 @@ fn check_test_signature(
f: &ast::Fn,
) -> Result<(), ErrorGuaranteed> {
let has_should_panic_attr = attr::contains_name(&i.attrs, sym::should_panic);
let sd = cx.sess.diagnostic();
let sd = cx.sess.dcx();
if let ast::Unsafe::Yes(span) = f.sig.header.unsafety {
return Err(sd.emit_err(errors::TestBadFn { span: i.span, cause: span, kind: "unsafe" }));
@ -601,7 +601,7 @@ fn check_bench_signature(
// N.B., inadequate check, but we're running
// well before resolve, can't get too deep.
if f.sig.decl.inputs.len() != 1 {
return Err(cx.sess.diagnostic().emit_err(errors::BenchSig { span: i.span }));
return Err(cx.sess.dcx().emit_err(errors::BenchSig { span: i.span }));
}
Ok(())
}

View file

@ -47,7 +47,7 @@ pub fn inject(
features: &Features,
resolver: &mut dyn ResolverExpand,
) {
let span_diagnostic = sess.diagnostic();
let span_diagnostic = sess.dcx();
let panic_strategy = sess.panic_strategy();
let platform_panic_strategy = sess.target.panic_strategy;