@@ -667,31 +667,31 @@ pub struct TraitImpls {
667667
668668#[ salsa:: tracked]
669669impl TraitImpls {
670- #[ salsa:: tracked( returns( ref ) ) ]
671- pub fn for_crate ( db : & dyn HirDatabase , krate : Crate ) -> Arc < Self > {
670+ #[ salsa:: tracked( returns( deref ) ) ]
671+ pub fn for_crate ( db : & dyn HirDatabase , krate : Crate ) -> Box < Self > {
672672 let _p = tracing:: info_span!( "inherent_impls_in_crate_query" , ?krate) . entered ( ) ;
673673
674674 let crate_def_map = crate_def_map ( db, krate) ;
675675 let result = Self :: collect_def_map ( db, crate_def_map) ;
676- Arc :: new ( result)
676+ Box :: new ( result)
677677 }
678678
679679 #[ salsa:: tracked( returns( ref) ) ]
680+ // #[salsa::tracked(returns(as_deref))] // FIXME this does not compile
680681 pub fn for_block ( db : & dyn HirDatabase , block : BlockId ) -> Option < Box < Self > > {
681682 let _p = tracing:: info_span!( "inherent_impls_in_block_query" ) . entered ( ) ;
682683
683684 let block_def_map = block_def_map ( db, block) ;
684685 let result = Self :: collect_def_map ( db, block_def_map) ;
685686 if result. map . is_empty ( ) { None } else { Some ( Box :: new ( result) ) }
686687 }
687-
688- #[ salsa:: tracked( returns( ref) ) ]
689- pub fn for_crate_and_deps ( db : & dyn HirDatabase , krate : Crate ) -> Box < [ Arc < Self > ] > {
690- db. transitive_deps ( krate) . iter ( ) . map ( |& dep| Self :: for_crate ( db, dep) . clone ( ) ) . collect ( )
691- }
692688}
693689
694690impl TraitImpls {
691+ pub fn for_crate_and_deps ( db : & dyn HirDatabase , krate : Crate ) -> impl Iterator < Item = & Self > {
692+ krate. transitive_deps ( db) . iter ( ) . map ( |& dep| Self :: for_crate ( db, dep) )
693+ }
694+
695695 fn collect_def_map ( db : & dyn HirDatabase , def_map : & DefMap ) -> Self {
696696 let mut map = FxHashMap :: default ( ) ;
697697 collect ( db, def_map, & mut map) ;
@@ -794,7 +794,7 @@ impl TraitImpls {
794794 ) {
795795 let blocks = std:: iter:: successors ( block, |block| block. loc ( db) . module . containing_block ( ) ) ;
796796 blocks. filter_map ( |block| Self :: for_block ( db, block) . as_deref ( ) ) . for_each ( & mut * for_each) ;
797- Self :: for_crate_and_deps ( db, krate) . iter ( ) . map ( |it| & * * it ) . for_each ( for_each) ;
797+ Self :: for_crate_and_deps ( db, krate) . for_each ( for_each) ;
798798 }
799799
800800 /// Like [`Self::for_each_crate_and_block()`], but takes in account two blocks, one for a trait and one for a self type.
@@ -806,7 +806,7 @@ impl TraitImpls {
806806 for_each : & mut dyn FnMut ( & TraitImpls ) ,
807807 ) {
808808 let in_self_and_deps = TraitImpls :: for_crate_and_deps ( db, krate) ;
809- in_self_and_deps. iter ( ) . for_each ( |impls| for_each ( impls) ) ;
809+ in_self_and_deps. for_each ( |impls| for_each ( impls) ) ;
810810
811811 // We must not provide duplicate impls to the solver. Therefore we work with the following strategy:
812812 // start from each block, and walk ancestors until you meet the other block. If they never meet,
0 commit comments