diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2024-06-17 20:34:51 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-06-17 20:34:51 +0200 |
| commit | 940ff24ec00122e7a0c9099fcd5ea7db41555d3a (patch) | |
| tree | fe9b608bfaf09dddb0e4443aa2fd87890c58ff21 /compiler/rustc_monomorphize/src/polymorphize.rs | |
| parent | 3c5ff6efd3e8f97fe2c5946111efd28830dc2626 (diff) | |
| parent | 342c1b03d6d0f9aa1e8119a2556d819af024faaf (diff) | |
| download | rust-940ff24ec00122e7a0c9099fcd5ea7db41555d3a.tar.gz rust-940ff24ec00122e7a0c9099fcd5ea7db41555d3a.zip | |
Rollup merge of #126567 - compiler-errors:instance-kind, r=oli-obk,lcnr
Rename `InstanceDef` -> `InstanceKind` Renames `InstanceDef` to `InstanceKind`. The `Def` here is confusing, and makes it hard to distinguish `Instance` and `InstanceDef`. `InstanceKind` makes this more obvious, since it's really just describing what *kind* of instance we have. Not sure if this is large enough to warrant a types team MCP -- it's only 53 files. I don't personally think it does, but happy to write one if anyone disagrees. cc ``@rust-lang/types`` r? types
Diffstat (limited to 'compiler/rustc_monomorphize/src/polymorphize.rs')
| -rw-r--r-- | compiler/rustc_monomorphize/src/polymorphize.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/compiler/rustc_monomorphize/src/polymorphize.rs b/compiler/rustc_monomorphize/src/polymorphize.rs index c187cb63ee1..2d69bfa4da8 100644 --- a/compiler/rustc_monomorphize/src/polymorphize.rs +++ b/compiler/rustc_monomorphize/src/polymorphize.rs @@ -33,7 +33,7 @@ pub fn provide(providers: &mut Providers) { /// parameters are used). fn unused_generic_params<'tcx>( tcx: TyCtxt<'tcx>, - instance: ty::InstanceDef<'tcx>, + instance: ty::InstanceKind<'tcx>, ) -> UnusedGenericParams { assert!(instance.def_id().is_local()); @@ -88,7 +88,7 @@ fn unused_generic_params<'tcx>( fn should_polymorphize<'tcx>( tcx: TyCtxt<'tcx>, def_id: DefId, - instance: ty::InstanceDef<'tcx>, + instance: ty::InstanceKind<'tcx>, ) -> bool { // If an instance's MIR body is not polymorphic then the modified generic parameters that are // derived from polymorphization's result won't make any difference. @@ -97,7 +97,7 @@ fn should_polymorphize<'tcx>( } // Don't polymorphize intrinsics or virtual calls - calling `instance_mir` will panic. - if matches!(instance, ty::InstanceDef::Intrinsic(..) | ty::InstanceDef::Virtual(..)) { + if matches!(instance, ty::InstanceKind::Intrinsic(..) | ty::InstanceKind::Virtual(..)) { return false; } @@ -230,7 +230,7 @@ impl<'a, 'tcx> MarkUsedGenericParams<'a, 'tcx> { /// a closure, coroutine or constant). #[instrument(level = "debug", skip(self, def_id, args))] fn visit_child_body(&mut self, def_id: DefId, args: GenericArgsRef<'tcx>) { - let instance = ty::InstanceDef::Item(def_id); + let instance = ty::InstanceKind::Item(def_id); let unused = self.tcx.unused_generic_params(instance); debug!(?self.unused_parameters, ?unused); for (i, arg) in args.iter().enumerate() { |
