205
205
//! this is not implemented however: a mono item will be produced
206
206
//! regardless of whether it is actually needed or not.
207
207
208
- mod abi_check;
209
- mod move_check;
210
-
211
208
use std::path::PathBuf;
212
209
213
- use move_check::MoveCheckState;
214
- use rustc_abi::Size;
215
210
use rustc_data_structures::sync::{LRef, MTLock, par_for_each_in};
216
211
use rustc_data_structures::unord::{UnordMap, UnordSet};
217
212
use rustc_hir as hir;
@@ -228,15 +223,15 @@ use rustc_middle::ty::adjustment::{CustomCoerceUnsized, PointerCoercion};
228
223
use rustc_middle::ty::layout::ValidityRequirement;
229
224
use rustc_middle::ty::print::{shrunk_instance_name, with_no_trimmed_paths};
230
225
use rustc_middle::ty::{
231
- self, AssocKind, GenericArgs, GenericParamDefKind, Instance, InstanceKind, Ty, TyCtxt,
232
- TypeFoldable, TypeVisitableExt, VtblEntry,
226
+ self, GenericArgs, GenericParamDefKind, Instance, InstanceKind, Ty, TyCtxt, TypeFoldable ,
227
+ TypeVisitableExt, VtblEntry,
233
228
};
234
229
use rustc_middle::util::Providers;
235
230
use rustc_middle::{bug, span_bug};
236
231
use rustc_session::Limit;
237
232
use rustc_session::config::EntryFnType;
238
233
use rustc_span::source_map::{Spanned, dummy_spanned, respan};
239
- use rustc_span::symbol::{Ident, sym} ;
234
+ use rustc_span::symbol::sym;
240
235
use rustc_span::{DUMMY_SP, Span};
241
236
use tracing::{debug, instrument, trace};
242
237
@@ -612,8 +607,6 @@ struct MirUsedCollector<'a, 'tcx> {
612
607
/// Note that this contains *not-monomorphized* items!
613
608
used_mentioned_items: &'a mut UnordSet<MentionedItem<'tcx>>,
614
609
instance: Instance<'tcx>,
615
- visiting_call_terminator: bool,
616
- move_check: move_check::MoveCheckState,
617
610
}
618
611
619
612
impl<'a, 'tcx> MirUsedCollector<'a, 'tcx> {
@@ -760,13 +753,12 @@ impl<'a, 'tcx> MirVisitor<'tcx> for MirUsedCollector<'a, 'tcx> {
760
753
};
761
754
762
755
match terminator.kind {
763
- mir::TerminatorKind::Call { ref func, ref args, ref fn_span, .. }
764
- | mir::TerminatorKind::TailCall { ref func, ref args, ref fn_span } => {
756
+ mir::TerminatorKind::Call { ref func, .. }
757
+ | mir::TerminatorKind::TailCall { ref func, .. } => {
765
758
let callee_ty = func.ty(self.body, tcx);
766
759
// *Before* monomorphizing, record that we already handled this mention.
767
760
self.used_mentioned_items.insert(MentionedItem::Fn(callee_ty));
768
761
let callee_ty = self.monomorphize(callee_ty);
769
- self.check_fn_args_move_size(callee_ty, args, *fn_span, location);
770
762
visit_fn_use(self.tcx, callee_ty, true, source, &mut self.used_items)
771
763
}
772
764
mir::TerminatorKind::Drop { ref place, .. } => {
@@ -826,14 +818,7 @@ impl<'a, 'tcx> MirVisitor<'tcx> for MirUsedCollector<'a, 'tcx> {
826
818
push_mono_lang_item(self, reason.lang_item());
827
819
}
828
820
829
- self.visiting_call_terminator = matches!(terminator.kind, mir::TerminatorKind::Call { .. });
830
821
self.super_terminator(terminator, location);
831
- self.visiting_call_terminator = false;
832
- }
833
-
834
- fn visit_operand(&mut self, operand: &mir::Operand<'tcx>, location: Location) {
835
- self.super_operand(operand, location);
836
- self.check_operand_move_size(operand, location);
837
822
}
838
823
}
839
824
@@ -1183,20 +1168,6 @@ fn collect_alloc<'tcx>(tcx: TyCtxt<'tcx>, alloc_id: AllocId, output: &mut MonoIt
1183
1168
}
1184
1169
}
1185
1170
1186
- fn assoc_fn_of_type<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId, fn_ident: Ident) -> Option<DefId> {
1187
- for impl_def_id in tcx.inherent_impls(def_id) {
1188
- if let Some(new) = tcx.associated_items(impl_def_id).find_by_name_and_kind(
1189
- tcx,
1190
- fn_ident,
1191
- AssocKind::Fn,
1192
- def_id,
1193
- ) {
1194
- return Some(new.def_id);
1195
- }
1196
- }
1197
- None
1198
- }
1199
-
1200
1171
/// Scans the MIR in order to find function calls, closures, and drop-glue.
1201
1172
///
1202
1173
/// Anything that's found is added to `output`. Furthermore the "mentioned items" of the MIR are returned.
@@ -1208,7 +1179,8 @@ fn collect_items_of_instance<'tcx>(
1208
1179
mentioned_items: &mut MonoItems<'tcx>,
1209
1180
mode: CollectionMode,
1210
1181
) {
1211
- tcx.ensure().check_feature_dependent_abi(instance);
1182
+ // This item is getting monomorphized, do mono-time checks.
1183
+ tcx.ensure().check_mono_item(instance);
1212
1184
1213
1185
let body = tcx.instance_mir(instance.def);
1214
1186
// Naively, in "used" collection mode, all functions get added to *both* `used_items` and
@@ -1228,8 +1200,6 @@ fn collect_items_of_instance<'tcx>(
1228
1200
used_items,
1229
1201
used_mentioned_items: &mut used_mentioned_items,
1230
1202
instance,
1231
- visiting_call_terminator: false,
1232
- move_check: MoveCheckState::new(),
1233
1203
};
1234
1204
1235
1205
if mode == CollectionMode::UsedItems {
@@ -1626,5 +1596,4 @@ pub(crate) fn collect_crate_mono_items<'tcx>(
1626
1596
1627
1597
pub(crate) fn provide(providers: &mut Providers) {
1628
1598
providers.hooks.should_codegen_locally = should_codegen_locally;
1629
- abi_check::provide(providers);
1630
1599
}
0 commit comments