File tree 3 files changed +12
-28
lines changed
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> {
59
59
pub fn size_estimate ( & self , tcx : TyCtxt < ' tcx > ) -> usize {
60
60
match * self {
61
61
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
+ }
65
72
}
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.
68
75
MonoItem :: Static ( _) | MonoItem :: GlobalAsm ( _) => 1 ,
69
76
}
70
77
}
Original file line number Diff line number Diff line change @@ -2080,12 +2080,6 @@ rustc_queries! {
2080
2080
desc { "looking up supported target features" }
2081
2081
}
2082
2082
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
-
2089
2083
query features_query( _: ( ) ) -> & ' tcx rustc_feature:: Features {
2090
2084
feedable
2091
2085
desc { "looking up enabled feature gates" }
Original file line number Diff line number Diff line change @@ -311,22 +311,6 @@ fn param_env_reveal_all_normalized(tcx: TyCtxt<'_>, def_id: DefId) -> ty::ParamE
311
311
tcx. param_env ( def_id) . with_reveal_all_normalized ( tcx)
312
312
}
313
313
314
- fn instance_def_size_estimate < ' tcx > (
315
- tcx : TyCtxt < ' tcx > ,
316
- instance_def : ty:: InstanceDef < ' tcx > ,
317
- ) -> usize {
318
- use ty:: InstanceDef ;
319
-
320
- match instance_def {
321
- InstanceDef :: Item ( ..) | InstanceDef :: DropGlue ( ..) => {
322
- let mir = tcx. instance_mir ( instance_def) ;
323
- mir. basic_blocks . iter ( ) . map ( |bb| bb. statements . len ( ) + 1 ) . sum ( )
324
- }
325
- // Estimate the size of other compiler-generated shims to be 1.
326
- _ => 1 ,
327
- }
328
- }
329
-
330
314
/// If `def_id` is an issue 33140 hack impl, returns its self type; otherwise, returns `None`.
331
315
///
332
316
/// See [`ty::ImplOverlapKind::Issue33140`] for more details.
@@ -432,7 +416,6 @@ pub fn provide(providers: &mut Providers) {
432
416
adt_sized_constraint,
433
417
param_env,
434
418
param_env_reveal_all_normalized,
435
- instance_def_size_estimate,
436
419
issue33140_self_ty,
437
420
defaultness,
438
421
unsizing_params_for_adt,
You can’t perform that action at this time.
0 commit comments