@@ -389,7 +389,7 @@ pub fn expand_test_or_bench(
389
389
}
390
390
391
391
fn not_testable_error ( cx : & ExtCtxt < ' _ > , attr_sp : Span , item : Option < & ast:: Item > ) {
392
- let diag = & cx. sess . parse_sess . span_diagnostic ;
392
+ let diag = cx. sess . diagnostic ( ) ;
393
393
let msg = "the `#[test]` attribute may only be used on a non-associated function" ;
394
394
let mut err = match item. map ( |i| & i. kind ) {
395
395
// 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> {
466
466
fn should_panic ( cx : & ExtCtxt < ' _ > , i : & ast:: Item ) -> ShouldPanic {
467
467
match attr:: find_by_name ( & i. attrs , sym:: should_panic) {
468
468
Some ( attr) => {
469
- let sd = & cx. sess . parse_sess . span_diagnostic ;
469
+ let sd = cx. sess . diagnostic ( ) ;
470
470
471
471
match attr. meta_item_list ( ) {
472
472
// Handle #[should_panic(expected = "foo")]
@@ -535,7 +535,7 @@ fn check_test_signature(
535
535
f : & ast:: Fn ,
536
536
) -> Result < ( ) , ErrorGuaranteed > {
537
537
let has_should_panic_attr = attr:: contains_name ( & i. attrs , sym:: should_panic) ;
538
- let sd = & cx. sess . parse_sess . span_diagnostic ;
538
+ let sd = cx. sess . diagnostic ( ) ;
539
539
540
540
if let ast:: Unsafe :: Yes ( span) = f. sig . header . unsafety {
541
541
return Err ( sd. emit_err ( errors:: TestBadFn { span : i. span , cause : span, kind : "unsafe" } ) ) ;
@@ -579,7 +579,7 @@ fn check_bench_signature(
579
579
// N.B., inadequate check, but we're running
580
580
// well before resolve, can't get too deep.
581
581
if f. sig . decl . inputs . len ( ) != 1 {
582
- return Err ( cx. sess . parse_sess . span_diagnostic . emit_err ( errors:: BenchSig { span : i. span } ) ) ;
582
+ return Err ( cx. sess . diagnostic ( ) . emit_err ( errors:: BenchSig { span : i. span } ) ) ;
583
583
}
584
584
Ok ( ( ) )
585
585
}
0 commit comments