File tree Expand file tree Collapse file tree 2 files changed +19
-23
lines changed
rustc_hir_analysis/src/hir_ty_lowering Expand file tree Collapse file tree 2 files changed +19
-23
lines changed Original file line number Diff line number Diff line change @@ -1730,25 +1730,23 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
17301730 . is_accessible_from ( self . item_def_id ( ) , tcx)
17311731 && tcx. all_impls ( * trait_def_id)
17321732 . any ( |impl_def_id| {
1733- let impl_header = tcx. impl_trait_header ( impl_def_id) ;
1734- impl_header. is_some_and ( |header| {
1735- let trait_ref = header. trait_ref . instantiate (
1736- tcx,
1737- infcx. fresh_args_for_item ( DUMMY_SP , impl_def_id) ,
1738- ) ;
1739-
1740- let value = fold_regions ( tcx, qself_ty, |_, _| tcx. lifetimes . re_erased ) ;
1741- // FIXME: Don't bother dealing with non-lifetime binders here...
1742- if value. has_escaping_bound_vars ( ) {
1743- return false ;
1744- }
1745- infcx
1746- . can_eq (
1747- ty:: ParamEnv :: empty ( ) ,
1748- trait_ref. self_ty ( ) ,
1749- value,
1750- ) && header. polarity != ty:: ImplPolarity :: Negative
1751- } )
1733+ let header = tcx. impl_trait_header ( impl_def_id) . unwrap ( ) ;
1734+ let trait_ref = header. trait_ref . instantiate (
1735+ tcx,
1736+ infcx. fresh_args_for_item ( DUMMY_SP , impl_def_id) ,
1737+ ) ;
1738+
1739+ let value = fold_regions ( tcx, qself_ty, |_, _| tcx. lifetimes . re_erased ) ;
1740+ // FIXME: Don't bother dealing with non-lifetime binders here...
1741+ if value. has_escaping_bound_vars ( ) {
1742+ return false ;
1743+ }
1744+ infcx
1745+ . can_eq (
1746+ ty:: ParamEnv :: empty ( ) ,
1747+ trait_ref. self_ty ( ) ,
1748+ value,
1749+ ) && header. polarity != ty:: ImplPolarity :: Negative
17521750 } )
17531751 } )
17541752 . map ( |trait_def_id| tcx. def_path_str ( trait_def_id) )
Original file line number Diff line number Diff line change @@ -421,10 +421,8 @@ impl<'tcx> MarkSymbolVisitor<'tcx> {
421421 }
422422 hir:: ItemKind :: ForeignMod { .. } => { }
423423 hir:: ItemKind :: Trait ( ..) => {
424- for impl_def_id in self . tcx . all_impls ( item. owner_id . to_def_id ( ) ) {
425- if let Some ( local_def_id) = impl_def_id. as_local ( )
426- && let ItemKind :: Impl ( impl_ref) =
427- self . tcx . hir_expect_item ( local_def_id) . kind
424+ for & impl_def_id in self . tcx . local_trait_impls ( item. owner_id . def_id ) {
425+ if let ItemKind :: Impl ( impl_ref) = self . tcx . hir_expect_item ( impl_def_id) . kind
428426 {
429427 // skip items
430428 // mark dependent traits live
You can’t perform that action at this time.
0 commit comments