@@ -899,14 +899,12 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
899899 let mut where_bounds = vec ! [ ] ;
900900 for bound in [ bound, bound2] . into_iter ( ) . chain ( matching_candidates) {
901901 let bound_id = bound. def_id ( ) ;
902- let assoc_item = tcx
902+ let bound_span = tcx
903903 . associated_items ( bound_id)
904- . find_by_name_and_kind ( tcx, assoc_name, assoc_kind, bound_id) ;
905- let bound_span = assoc_item . and_then ( |item| tcx. hir ( ) . span_if_local ( item. def_id ) ) ;
904+ . find_by_name_and_kind ( tcx, assoc_name, assoc_kind, bound_id)
905+ . and_then ( |item| tcx. hir ( ) . span_if_local ( item. def_id ) ) ;
906906
907- if let Some ( assoc_item) = assoc_item
908- && let Some ( bound_span) = bound_span
909- {
907+ if let Some ( bound_span) = bound_span {
910908 err. span_label (
911909 bound_span,
912910 format ! ( "ambiguous `{assoc_name}` from `{}`" , bound. print_trait_sugared( ) , ) ,
@@ -917,7 +915,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
917915 let term: ty:: Term < ' _ > = match term {
918916 hir:: Term :: Ty ( ty) => self . lower_ty ( ty) . into ( ) ,
919917 hir:: Term :: Const ( ct) => {
920- ty:: Const :: from_const_arg ( tcx, ct, assoc_item . def_id ) . into ( )
918+ ty:: Const :: from_const_arg_without_feeding ( tcx, ct) . into ( )
921919 }
922920 } ;
923921 // FIXME(#97583): This isn't syntactically well-formed!
0 commit comments