File tree Expand file tree Collapse file tree 3 files changed +12
-28
lines changed Expand file tree Collapse file tree 3 files changed +12
-28
lines changed Original file line number Diff line number Diff line change @@ -59,12 +59,19 @@ impl<'tcx> MonoItem<'tcx> {
5959 pub fn size_estimate ( & self , tcx : TyCtxt < ' tcx > ) -> usize {
6060 match * self {
6161 MonoItem :: Fn ( instance) => {
62- // Estimate the size of a function based on how many statements
63- // it contains.
64- tcx. instance_def_size_estimate ( instance. def )
62+ match instance. def {
63+ // "Normal" functions size estimate: the number of
64+ // statements, plus one for the terminator.
65+ InstanceDef :: Item ( ..) | InstanceDef :: DropGlue ( ..) => {
66+ let mir = tcx. instance_mir ( instance. def ) ;
67+ mir. basic_blocks . iter ( ) . map ( |bb| bb. statements . len ( ) + 1 ) . sum ( )
68+ }
69+ // Other compiler-generated shims size estimate: 1
70+ _ => 1 ,
71+ }
6572 }
66- // Conservatively estimate the size of a static declaration
67- // or assembly to be 1.
73+ // Conservatively estimate the size of a static declaration or
74+ // assembly item to be 1.
6875 MonoItem :: Static ( _) | MonoItem :: GlobalAsm ( _) => 1 ,
6976 }
7077 }
Original file line number Diff line number Diff line change @@ -2080,12 +2080,6 @@ rustc_queries! {
20802080 desc { "looking up supported target features" }
20812081 }
20822082
2083- /// Get an estimate of the size of an InstanceDef based on its MIR for CGU partitioning.
2084- query instance_def_size_estimate( def: ty:: InstanceDef <' tcx>)
2085- -> usize {
2086- desc { |tcx| "estimating size for `{}`" , tcx. def_path_str( def. def_id( ) ) }
2087- }
2088-
20892083 query features_query( _: ( ) ) -> & ' tcx rustc_feature:: Features {
20902084 feedable
20912085 desc { "looking up enabled feature gates" }
Original file line number Diff line number Diff line change @@ -317,22 +317,6 @@ fn param_env_reveal_all_normalized(tcx: TyCtxt<'_>, def_id: DefId) -> ty::ParamE
317317 tcx. param_env ( def_id) . with_reveal_all_normalized ( tcx)
318318}
319319
320- fn instance_def_size_estimate < ' tcx > (
321- tcx : TyCtxt < ' tcx > ,
322- instance_def : ty:: InstanceDef < ' tcx > ,
323- ) -> usize {
324- use ty:: InstanceDef ;
325-
326- match instance_def {
327- InstanceDef :: Item ( ..) | InstanceDef :: DropGlue ( ..) => {
328- let mir = tcx. instance_mir ( instance_def) ;
329- mir. basic_blocks . iter ( ) . map ( |bb| bb. statements . len ( ) + 1 ) . sum ( )
330- }
331- // Estimate the size of other compiler-generated shims to be 1.
332- _ => 1 ,
333- }
334- }
335-
336320/// If `def_id` is an issue 33140 hack impl, returns its self type; otherwise, returns `None`.
337321///
338322/// See [`ty::ImplOverlapKind::Issue33140`] for more details.
@@ -440,7 +424,6 @@ pub fn provide(providers: &mut Providers) {
440424 adt_sized_constraint,
441425 param_env,
442426 param_env_reveal_all_normalized,
443- instance_def_size_estimate,
444427 issue33140_self_ty,
445428 defaultness,
446429 unsizing_params_for_adt,
You can’t perform that action at this time.
0 commit comments