@@ -7,14 +7,13 @@ use rustc_hir::def_id::{DefId, LocalDefId};
77use rustc_hir:: { self as hir, FnSig , HirId , ItemKind } ;
88use rustc_infer:: infer:: { self , InferCtxt , TyCtxtInferExt } ;
99use rustc_infer:: traits:: { ObligationCause , ObligationCauseCode } ;
10- use rustc_middle:: ty;
10+ use rustc_middle:: ty:: { self , TypingMode } ;
1111use rustc_middle:: ty:: TyCtxt ;
1212use rustc_middle:: ty:: error:: { ExpectedFound , TypeError } ;
1313use rustc_span:: { ErrorGuaranteed , Ident , Span , Symbol } ;
1414use rustc_trait_selection:: error_reporting:: InferCtxtErrorExt ;
1515use rustc_trait_selection:: regions:: InferCtxtRegionExt ;
1616use rustc_trait_selection:: traits:: ObligationCtxt ;
17- use rustc_type_ir:: TypingMode ;
1817use tracing:: { debug, instrument} ;
1918
2019use super :: potentially_plural_count;
@@ -147,7 +146,7 @@ fn compare_number_of_method_arguments<'tcx>(
147146 } )
148147 . or_else ( || tcx. hir ( ) . span_if_local ( declaration) ) ;
149148
150- let ( external_impl_sig, _, _) = & tcx. hir ( ) . expect_item ( external_impl) . expect_fn ( ) ;
149+ let ( _ , external_impl_sig, _, _) = & tcx. hir_expect_item ( external_impl) . expect_fn ( ) ;
151150 let pos = external_impl_number_args. saturating_sub ( 1 ) ;
152151 let impl_span = external_impl_sig
153152 . decl
@@ -321,7 +320,7 @@ fn report_eii_mismatch<'tcx>(
321320 if declaration_sig. inputs ( ) . len ( ) == * i {
322321 // Suggestion to change output type. We do not suggest in `async` functions
323322 // to avoid complex logic or incorrect output.
324- if let ItemKind :: Fn { sig, .. } = & tcx. hir ( ) . expect_item ( external_impl_did) . kind
323+ if let ItemKind :: Fn { sig, .. } = & tcx. hir_expect_item ( external_impl_did) . kind
325324 && !sig. header . asyncness . is_async ( )
326325 {
327326 let msg = "change the output type to match the declaration" ;
@@ -376,11 +375,11 @@ fn extract_spans_for_error_reporting<'tcx>(
376375) -> ( Span , Option < Span > , Ident ) {
377376 let tcx = infcx. tcx ;
378377 let ( mut external_impl_args, external_impl_name) = {
379- let item = tcx. hir ( ) . expect_item ( external_impl) ;
380- let ( sig, _, _) = item. expect_fn ( ) ;
378+ let item = tcx. hir_expect_item ( external_impl) ;
379+ let ( ident , sig, _, _) = item. expect_fn ( ) ;
381380 (
382381 sig. decl . inputs . iter ( ) . map ( |t| t. span ) . chain ( iter:: once ( sig. decl . output . span ( ) ) ) ,
383- item . ident ,
382+ ident,
384383 )
385384 } ;
386385
0 commit comments