@@ -24,8 +24,8 @@ use crate::{
2424 primitive:: { FloatTy , IntTy , UintTy } ,
2525 static_lifetime, to_chalk_trait_id,
2626 utils:: all_super_traits,
27- AdtId , Canonical , CanonicalVarKinds , DebruijnIndex , ForeignDefId , InEnvironment , Interner ,
28- Scalar , Substitution , TraitEnvironment , TraitRef , TraitRefExt , Ty , TyBuilder , TyExt ,
27+ AdtId , Canonical , CanonicalVarKinds , DebruijnIndex , DynTyExt , ForeignDefId , InEnvironment ,
28+ Interner , Scalar , Substitution , TraitEnvironment , TraitRef , TraitRefExt , Ty , TyBuilder , TyExt ,
2929} ;
3030
3131/// This is used as a key for indexing impls.
@@ -805,20 +805,9 @@ fn is_inherent_impl_coherent(
805805 | TyKind :: Scalar ( _) => def_map. is_rustc_coherence_is_core ( ) ,
806806
807807 & TyKind :: Adt ( AdtId ( adt) , _) => adt. module ( db. upcast ( ) ) . krate ( ) == def_map. krate ( ) ,
808- // FIXME: Factor out the principal trait fetching into a function
809- TyKind :: Dyn ( it) => it
810- . bounds
811- . skip_binders ( )
812- . interned ( )
813- . get ( 0 )
814- . and_then ( |b| match b. skip_binders ( ) {
815- crate :: WhereClause :: Implemented ( trait_ref) => Some ( trait_ref) ,
816- _ => None ,
817- } )
818- . map_or ( false , |trait_ref| {
819- from_chalk_trait_id ( trait_ref. trait_id ) . module ( db. upcast ( ) ) . krate ( )
820- == def_map. krate ( )
821- } ) ,
808+ TyKind :: Dyn ( it) => it. principal ( ) . map_or ( false , |trait_ref| {
809+ from_chalk_trait_id ( trait_ref. trait_id ) . module ( db. upcast ( ) ) . krate ( ) == def_map. krate ( )
810+ } ) ,
822811
823812 _ => true ,
824813 } ;
@@ -843,20 +832,10 @@ fn is_inherent_impl_coherent(
843832 }
844833 hir_def:: AdtId :: EnumId ( it) => db. enum_data ( it) . rustc_has_incoherent_inherent_impls ,
845834 } ,
846- // FIXME: Factor out the principal trait fetching into a function
847- TyKind :: Dyn ( it) => it
848- . bounds
849- . skip_binders ( )
850- . interned ( )
851- . get ( 0 )
852- . and_then ( |b| match b. skip_binders ( ) {
853- crate :: WhereClause :: Implemented ( trait_ref) => Some ( trait_ref) ,
854- _ => None ,
855- } )
856- . map_or ( false , |trait_ref| {
857- db. trait_data ( from_chalk_trait_id ( trait_ref. trait_id ) )
858- . rustc_has_incoherent_inherent_impls
859- } ) ,
835+ TyKind :: Dyn ( it) => it. principal ( ) . map_or ( false , |trait_ref| {
836+ db. trait_data ( from_chalk_trait_id ( trait_ref. trait_id ) )
837+ . rustc_has_incoherent_inherent_impls
838+ } ) ,
860839
861840 _ => false ,
862841 } ;
0 commit comments