From b9f3db6adb77cce9ec5a5476003a5cf1803b6262 Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Mon, 12 Aug 2024 15:51:04 +1000 Subject: [PATCH] Give the field in `FnSigTys` a name. --- compiler/rustc_type_ir/src/fast_reject.rs | 4 ++-- compiler/rustc_type_ir/src/ty_kind.rs | 14 ++++++++------ 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/compiler/rustc_type_ir/src/fast_reject.rs b/compiler/rustc_type_ir/src/fast_reject.rs index 718e13ffe94..fab4a099117 100644 --- a/compiler/rustc_type_ir/src/fast_reject.rs +++ b/compiler/rustc_type_ir/src/fast_reject.rs @@ -311,8 +311,8 @@ impl DeepRejectCtxt { } ty::FnPtr(obl_sig_tys, obl_hdr) => match k { ty::FnPtr(impl_sig_tys, impl_hdr) => { - let obl_sig_tys = obl_sig_tys.skip_binder().0; - let impl_sig_tys = impl_sig_tys.skip_binder().0; + let obl_sig_tys = obl_sig_tys.skip_binder().inputs_and_output; + let impl_sig_tys = impl_sig_tys.skip_binder().inputs_and_output; obl_hdr == impl_hdr && obl_sig_tys.len() == impl_sig_tys.len() diff --git a/compiler/rustc_type_ir/src/ty_kind.rs b/compiler/rustc_type_ir/src/ty_kind.rs index 8640a601980..328b6739d97 100644 --- a/compiler/rustc_type_ir/src/ty_kind.rs +++ b/compiler/rustc_type_ir/src/ty_kind.rs @@ -928,7 +928,7 @@ impl ty::Binder> { pub fn split(self) -> (ty::Binder>, FnHeader) { let hdr = FnHeader { c_variadic: self.c_variadic(), safety: self.safety(), abi: self.abi() }; - (self.map_bound(|sig| FnSigTys(sig.inputs_and_output)), hdr) + (self.map_bound(|sig| FnSigTys { inputs_and_output: sig.inputs_and_output }), hdr) } } @@ -971,15 +971,17 @@ impl fmt::Debug for FnSig { #[derive_where(Clone, Copy, Debug, PartialEq, Eq, Hash; I: Interner)] #[cfg_attr(feature = "nightly", derive(TyEncodable, TyDecodable, HashStable_NoContext))] #[derive(TypeVisitable_Generic, TypeFoldable_Generic, Lift_Generic)] -pub struct FnSigTys(pub I::Tys); +pub struct FnSigTys { + pub inputs_and_output: I::Tys, +} impl FnSigTys { pub fn inputs(self) -> I::FnInputTys { - self.0.inputs() + self.inputs_and_output.inputs() } pub fn output(self) -> I::Ty { - self.0.output() + self.inputs_and_output.output() } } @@ -987,7 +989,7 @@ impl ty::Binder> { // Used to combine the two fields in `TyKind::FnPtr` into a single value. pub fn with(self, hdr: FnHeader) -> ty::Binder> { self.map_bound(|sig_tys| FnSig { - inputs_and_output: sig_tys.0, + inputs_and_output: sig_tys.inputs_and_output, c_variadic: hdr.c_variadic, safety: hdr.safety, abi: hdr.abi, @@ -1006,7 +1008,7 @@ impl ty::Binder> { } pub fn inputs_and_output(self) -> ty::Binder { - self.map_bound(|sig_tys| sig_tys.0) + self.map_bound(|sig_tys| sig_tys.inputs_and_output) } #[inline]