@@ -389,7 +389,7 @@ pub fn expand_test_or_bench(
389389}
390390
391391fn 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 ( ) ;
393393 let msg = "the `#[test]` attribute may only be used on a non-associated function" ;
394394 let mut err = match item. map ( |i| & i. kind ) {
395395 // 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> {
466466fn should_panic ( cx : & ExtCtxt < ' _ > , i : & ast:: Item ) -> ShouldPanic {
467467 match attr:: find_by_name ( & i. attrs , sym:: should_panic) {
468468 Some ( attr) => {
469- let sd = & cx. sess . parse_sess . span_diagnostic ;
469+ let sd = cx. sess . diagnostic ( ) ;
470470
471471 match attr. meta_item_list ( ) {
472472 // Handle #[should_panic(expected = "foo")]
@@ -535,7 +535,7 @@ fn check_test_signature(
535535 f : & ast:: Fn ,
536536) -> Result < ( ) , ErrorGuaranteed > {
537537 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 ( ) ;
539539
540540 if let ast:: Unsafe :: Yes ( span) = f. sig . header . unsafety {
541541 return Err ( sd. emit_err ( errors:: TestBadFn { span : i. span , cause : span, kind : "unsafe" } ) ) ;
@@ -579,7 +579,7 @@ fn check_bench_signature(
579579 // N.B., inadequate check, but we're running
580580 // well before resolve, can't get too deep.
581581 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 } ) ) ;
583583 }
584584 Ok ( ( ) )
585585}
0 commit comments