@@ -1031,7 +1031,7 @@ fn report_trait_method_mismatch<'tcx>(
1031
1031
// When the `impl` receiver is an arbitrary self type, like `self: Box<Self>`, the
1032
1032
// span points only at the type `Box<Self`>, but we want to cover the whole
1033
1033
// argument pattern and type.
1034
- let ( sig, body) = tcx. hir ( ) . expect_impl_item ( impl_m. def_id . expect_local ( ) ) . expect_fn ( ) ;
1034
+ let ( sig, body) = tcx. hir_expect_impl_item ( impl_m. def_id . expect_local ( ) ) . expect_fn ( ) ;
1035
1035
let span = tcx
1036
1036
. hir_body_param_names ( body)
1037
1037
. zip ( sig. decl . inputs . iter ( ) )
@@ -1051,7 +1051,7 @@ fn report_trait_method_mismatch<'tcx>(
1051
1051
// Suggestion to change output type. We do not suggest in `async` functions
1052
1052
// to avoid complex logic or incorrect output.
1053
1053
if let ImplItemKind :: Fn ( sig, _) =
1054
- & tcx. hir ( ) . expect_impl_item ( impl_m. def_id . expect_local ( ) ) . kind
1054
+ & tcx. hir_expect_impl_item ( impl_m. def_id . expect_local ( ) ) . kind
1055
1055
&& !sig. header . asyncness . is_async ( )
1056
1056
{
1057
1057
let msg = "change the output type to match the trait" ;
@@ -1190,12 +1190,12 @@ fn extract_spans_for_error_reporting<'tcx>(
1190
1190
) -> ( Span , Option < Span > ) {
1191
1191
let tcx = infcx. tcx ;
1192
1192
let mut impl_args = {
1193
- let ( sig, _) = tcx. hir ( ) . expect_impl_item ( impl_m. def_id . expect_local ( ) ) . expect_fn ( ) ;
1193
+ let ( sig, _) = tcx. hir_expect_impl_item ( impl_m. def_id . expect_local ( ) ) . expect_fn ( ) ;
1194
1194
sig. decl . inputs . iter ( ) . map ( |t| t. span ) . chain ( iter:: once ( sig. decl . output . span ( ) ) )
1195
1195
} ;
1196
1196
1197
1197
let trait_args = trait_m. def_id . as_local ( ) . map ( |def_id| {
1198
- let ( sig, _) = tcx. hir ( ) . expect_trait_item ( def_id) . expect_fn ( ) ;
1198
+ let ( sig, _) = tcx. hir_expect_trait_item ( def_id) . expect_fn ( ) ;
1199
1199
sig. decl . inputs . iter ( ) . map ( |t| t. span ) . chain ( iter:: once ( sig. decl . output . span ( ) ) )
1200
1200
} ) ;
1201
1201
@@ -1371,7 +1371,7 @@ fn compare_number_of_generics<'tcx>(
1371
1371
spans
1372
1372
} ;
1373
1373
let ( trait_spans, impl_trait_spans) = if let Some ( def_id) = trait_. def_id . as_local ( ) {
1374
- let trait_item = tcx. hir ( ) . expect_trait_item ( def_id) ;
1374
+ let trait_item = tcx. hir_expect_trait_item ( def_id) ;
1375
1375
let arg_spans: Vec < Span > = arg_spans ( trait_. kind , trait_item. generics ) ;
1376
1376
let impl_trait_spans: Vec < Span > = trait_item
1377
1377
. generics
@@ -1388,7 +1388,7 @@ fn compare_number_of_generics<'tcx>(
1388
1388
( trait_span. map ( |s| vec ! [ s] ) , vec ! [ ] )
1389
1389
} ;
1390
1390
1391
- let impl_item = tcx. hir ( ) . expect_impl_item ( impl_. def_id . expect_local ( ) ) ;
1391
+ let impl_item = tcx. hir_expect_impl_item ( impl_. def_id . expect_local ( ) ) ;
1392
1392
let impl_item_impl_trait_spans: Vec < Span > = impl_item
1393
1393
. generics
1394
1394
. params
@@ -1466,7 +1466,7 @@ fn compare_number_of_method_arguments<'tcx>(
1466
1466
. def_id
1467
1467
. as_local ( )
1468
1468
. and_then ( |def_id| {
1469
- let ( trait_m_sig, _) = & tcx. hir ( ) . expect_trait_item ( def_id) . expect_fn ( ) ;
1469
+ let ( trait_m_sig, _) = & tcx. hir_expect_trait_item ( def_id) . expect_fn ( ) ;
1470
1470
let pos = trait_number_args. saturating_sub ( 1 ) ;
1471
1471
trait_m_sig. decl . inputs . get ( pos) . map ( |arg| {
1472
1472
if pos == 0 {
@@ -1478,7 +1478,7 @@ fn compare_number_of_method_arguments<'tcx>(
1478
1478
} )
1479
1479
. or_else ( || tcx. hir ( ) . span_if_local ( trait_m. def_id ) ) ;
1480
1480
1481
- let ( impl_m_sig, _) = & tcx. hir ( ) . expect_impl_item ( impl_m. def_id . expect_local ( ) ) . expect_fn ( ) ;
1481
+ let ( impl_m_sig, _) = & tcx. hir_expect_impl_item ( impl_m. def_id . expect_local ( ) ) . expect_fn ( ) ;
1482
1482
let pos = impl_number_args. saturating_sub ( 1 ) ;
1483
1483
let impl_span = impl_m_sig
1484
1484
. decl
@@ -1580,10 +1580,10 @@ fn compare_synthetic_generics<'tcx>(
1580
1580
// as another generic argument
1581
1581
let new_name = tcx. opt_item_name ( trait_def_id) ?;
1582
1582
let trait_m = trait_m. def_id . as_local ( ) ?;
1583
- let trait_m = tcx. hir ( ) . expect_trait_item ( trait_m) ;
1583
+ let trait_m = tcx. hir_expect_trait_item ( trait_m) ;
1584
1584
1585
1585
let impl_m = impl_m. def_id . as_local ( ) ?;
1586
- let impl_m = tcx. hir ( ) . expect_impl_item ( impl_m) ;
1586
+ let impl_m = tcx. hir_expect_impl_item ( impl_m) ;
1587
1587
1588
1588
// in case there are no generics, take the spot between the function name
1589
1589
// and the opening paren of the argument list
@@ -1613,7 +1613,7 @@ fn compare_synthetic_generics<'tcx>(
1613
1613
err. span_label ( impl_span, "expected `impl Trait`, found generic parameter" ) ;
1614
1614
let _: Option < _ > = try {
1615
1615
let impl_m = impl_m. def_id . as_local ( ) ?;
1616
- let impl_m = tcx. hir ( ) . expect_impl_item ( impl_m) ;
1616
+ let impl_m = tcx. hir_expect_impl_item ( impl_m) ;
1617
1617
let ( sig, _) = impl_m. expect_fn ( ) ;
1618
1618
let input_tys = sig. decl . inputs ;
1619
1619
@@ -1855,7 +1855,7 @@ fn compare_const_predicate_entailment<'tcx>(
1855
1855
debug ! ( ?impl_ty, ?trait_ty) ;
1856
1856
1857
1857
// Locate the Span containing just the type of the offending impl
1858
- let ( ty, _) = tcx. hir ( ) . expect_impl_item ( impl_ct_def_id) . expect_const ( ) ;
1858
+ let ( ty, _) = tcx. hir_expect_impl_item ( impl_ct_def_id) . expect_const ( ) ;
1859
1859
cause. span = ty. span ;
1860
1860
1861
1861
let mut diag = struct_span_code_err ! (
@@ -1868,7 +1868,7 @@ fn compare_const_predicate_entailment<'tcx>(
1868
1868
1869
1869
let trait_c_span = trait_ct. def_id . as_local ( ) . map ( |trait_ct_def_id| {
1870
1870
// Add a label to the Span containing just the type of the const
1871
- let ( ty, _) = tcx. hir ( ) . expect_trait_item ( trait_ct_def_id) . expect_const ( ) ;
1871
+ let ( ty, _) = tcx. hir_expect_trait_item ( trait_ct_def_id) . expect_const ( ) ;
1872
1872
ty. span
1873
1873
} ) ;
1874
1874
0 commit comments