File tree Expand file tree Collapse file tree 4 files changed +4
-30
lines changed
rustc_smir/src/rustc_smir Expand file tree Collapse file tree 4 files changed +4
-30
lines changed Original file line number Diff line number Diff line change @@ -233,5 +233,5 @@ pub fn provide(providers: &mut Providers) {
233233 providers. in_scope_traits_map = |tcx, id| {
234234 tcx. hir_crate ( ( ) ) . owners [ id. def_id ] . as_owner ( ) . map ( |owner_info| & owner_info. trait_map )
235235 } ;
236- providers. num_def_ids = |tcx, _| tcx. hir_crate_items ( ( ) ) . definitions ( ) . count ( ) ;
236+ providers. num_def_ids = |tcx, _| tcx. definitions_untracked ( ) . num_definitions ( ) ;
237237}
Original file line number Diff line number Diff line change @@ -1815,8 +1815,6 @@ rustc_queries! {
18151815 /// Gets the number of definitions in this crate.
18161816 ///
18171817 /// This allows external tools to iterate over all definitions in a crate.
1818- /// For completeness, this also accepts `LOCAL_CRATE` as an argument, but consider using
1819- /// `hir_crate_items(())` instead.
18201818 query num_def_ids( _: CrateNum ) -> usize {
18211819 desc { "fetching the number of definitions in a crate" }
18221820 separate_provide_extern
Original file line number Diff line number Diff line change @@ -84,34 +84,14 @@ impl<'tcx> Context for TablesWrapper<'tcx> {
8484 let mut tables = self . 0 . borrow_mut ( ) ;
8585 let tcx = tables. tcx ;
8686 let krate = crate_num. internal ( & mut * tables, tcx) ;
87- if krate == LOCAL_CRATE {
88- tcx. hir_crate_items ( ( ) )
89- . definitions ( )
90- . filter_map ( |local_id| tables. to_fn_def ( tcx, local_id. to_def_id ( ) ) )
91- . collect ( )
92- } else {
93- tables
94- . iter_external_def_id ( tcx, krate)
95- . filter_map ( |def_id| tables. to_fn_def ( tcx, def_id) )
96- . collect ( )
97- }
87+ tables. iter_def_ids ( tcx, krate) . filter_map ( |def_id| tables. to_fn_def ( tcx, def_id) ) . collect ( )
9888 }
9989
10090 fn crate_statics ( & self , crate_num : CrateNum ) -> Vec < StaticDef > {
10191 let mut tables = self . 0 . borrow_mut ( ) ;
10292 let tcx = tables. tcx ;
10393 let krate = crate_num. internal ( & mut * tables, tcx) ;
104- if krate == LOCAL_CRATE {
105- tcx. hir_crate_items ( ( ) )
106- . definitions ( )
107- . filter_map ( |local_id| tables. to_static ( tcx, local_id. to_def_id ( ) ) )
108- . collect ( )
109- } else {
110- tables
111- . iter_external_def_id ( tcx, krate)
112- . filter_map ( |def_id| tables. to_static ( tcx, def_id) )
113- . collect ( )
114- }
94+ tables. iter_def_ids ( tcx, krate) . filter_map ( |def_id| tables. to_static ( tcx, def_id) ) . collect ( )
11595 }
11696
11797 fn foreign_module (
Original file line number Diff line number Diff line change @@ -93,11 +93,7 @@ impl<'tcx> Tables<'tcx> {
9393 }
9494
9595 /// Iterate over the definitions of the given crate.
96- pub fn iter_external_def_id (
97- & self ,
98- tcx : TyCtxt < ' tcx > ,
99- krate : CrateNum ,
100- ) -> impl Iterator < Item = DefId > {
96+ pub fn iter_def_ids ( & self , tcx : TyCtxt < ' tcx > , krate : CrateNum ) -> impl Iterator < Item = DefId > {
10197 let num_definitions = tcx. num_def_ids ( krate) ;
10298 ( 0 ..num_definitions)
10399 . map ( move |i| DefId { krate, index : rustc_span:: def_id:: DefIndex :: from_usize ( i) } )
You can’t perform that action at this time.
0 commit comments