Remove ExtCtxt
methods that duplicate DiagCtxt
methods.
This commit is contained in:
parent
5eccfc388e
commit
d86a48278f
33 changed files with 155 additions and 180 deletions
|
@ -43,7 +43,7 @@ pub fn expand_test_case(
|
|||
}
|
||||
}
|
||||
_ => {
|
||||
ecx.emit_err(errors::TestCaseNonItem { span: anno_item.span() });
|
||||
ecx.dcx().emit_err(errors::TestCaseNonItem { span: anno_item.span() });
|
||||
return vec![];
|
||||
}
|
||||
};
|
||||
|
@ -389,7 +389,7 @@ pub fn expand_test_or_bench(
|
|||
}
|
||||
|
||||
fn not_testable_error(cx: &ExtCtxt<'_>, attr_sp: Span, item: Option<&ast::Item>) {
|
||||
let dcx = cx.sess.dcx();
|
||||
let dcx = cx.dcx();
|
||||
let msg = "the `#[test]` attribute may only be used on a non-associated function";
|
||||
let level = match item.map(|i| &i.kind) {
|
||||
// These were a warning before #92959 and need to continue being that to avoid breaking
|
||||
|
@ -465,8 +465,6 @@ 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 dcx = cx.sess.dcx();
|
||||
|
||||
match attr.meta_item_list() {
|
||||
// Handle #[should_panic(expected = "foo")]
|
||||
Some(list) => {
|
||||
|
@ -476,17 +474,18 @@ fn should_panic(cx: &ExtCtxt<'_>, i: &ast::Item) -> ShouldPanic {
|
|||
.and_then(|mi| mi.meta_item())
|
||||
.and_then(|mi| mi.value_str());
|
||||
if list.len() != 1 || msg.is_none() {
|
||||
dcx.struct_span_warn(
|
||||
attr.span,
|
||||
"argument must be of the form: \
|
||||
cx.dcx()
|
||||
.struct_span_warn(
|
||||
attr.span,
|
||||
"argument must be of the form: \
|
||||
`expected = \"error message\"`",
|
||||
)
|
||||
.note(
|
||||
"errors in this attribute were erroneously \
|
||||
)
|
||||
.note(
|
||||
"errors in this attribute were erroneously \
|
||||
allowed and will become a hard error in a \
|
||||
future release",
|
||||
)
|
||||
.emit();
|
||||
)
|
||||
.emit();
|
||||
ShouldPanic::Yes(None)
|
||||
} else {
|
||||
ShouldPanic::Yes(msg)
|
||||
|
@ -534,7 +533,7 @@ fn check_test_signature(
|
|||
f: &ast::Fn,
|
||||
) -> Result<(), ErrorGuaranteed> {
|
||||
let has_should_panic_attr = attr::contains_name(&i.attrs, sym::should_panic);
|
||||
let dcx = cx.sess.dcx();
|
||||
let dcx = cx.dcx();
|
||||
|
||||
if let ast::Unsafe::Yes(span) = f.sig.header.unsafety {
|
||||
return Err(dcx.emit_err(errors::TestBadFn { span: i.span, cause: span, kind: "unsafe" }));
|
||||
|
@ -600,7 +599,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.dcx().emit_err(errors::BenchSig { span: i.span }));
|
||||
return Err(cx.dcx().emit_err(errors::BenchSig { span: i.span }));
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue