about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEduard-Mihai Burtescu <eddyb@lyken.rs>2021-08-24 20:45:37 +0300
committerEduard-Mihai Burtescu <eddyb@lyken.rs>2021-09-18 01:42:43 +0300
commitfeca7d0a03ffe1c786f6fe00330b6d2df59bcfef (patch)
tree771f7368b87fb9e0369801b3f4abcefab348da3e
parenta1d7c51d27734f5af98e96d26a50357d6e145009 (diff)
downloadrust-feca7d0a03ffe1c786f6fe00330b6d2df59bcfef.tar.gz
rust-feca7d0a03ffe1c786f6fe00330b6d2df59bcfef.zip
ty::layout: split out a private trait from `FnAbiExt`.
-rw-r--r--compiler/rustc_middle/src/ty/layout.rs31
1 files changed, 21 insertions, 10 deletions
diff --git a/compiler/rustc_middle/src/ty/layout.rs b/compiler/rustc_middle/src/ty/layout.rs
index 83bb6b15262..793dda5c928 100644
--- a/compiler/rustc_middle/src/ty/layout.rs
+++ b/compiler/rustc_middle/src/ty/layout.rs
@@ -2804,16 +2804,6 @@ where
     /// NB: that includes virtual calls, which are represented by "direct calls"
     /// to an `InstanceDef::Virtual` instance (of `<dyn Trait as Trait>::fn`).
     fn of_instance(cx: &C, instance: ty::Instance<'tcx>, extra_args: &[Ty<'tcx>]) -> Self;
-
-    fn new_internal(
-        cx: &C,
-        sig: ty::PolyFnSig<'tcx>,
-        extra_args: &[Ty<'tcx>],
-        caller_location: Option<Ty<'tcx>>,
-        codegen_fn_attr_flags: CodegenFnAttrFlags,
-        make_self_ptr_thin: bool,
-    ) -> Self;
-    fn adjust_for_abi(&mut self, cx: &C, abi: SpecAbi);
 }
 
 impl<'tcx, C> FnAbiExt<'tcx, C> for call::FnAbi<'tcx, Ty<'tcx>>
@@ -2844,7 +2834,28 @@ where
             matches!(instance.def, ty::InstanceDef::Virtual(..)),
         )
     }
+}
+
+/// Implementation detail of computing `FnAbi`s, shouldn't be exported.
+trait FnAbiInternalExt<'tcx, C>
+where
+    C: LayoutOf<'tcx, LayoutOfResult = TyAndLayout<'tcx>> + HasTargetSpec,
+{
+    fn new_internal(
+        cx: &C,
+        sig: ty::PolyFnSig<'tcx>,
+        extra_args: &[Ty<'tcx>],
+        caller_location: Option<Ty<'tcx>>,
+        codegen_fn_attr_flags: CodegenFnAttrFlags,
+        make_self_ptr_thin: bool,
+    ) -> Self;
+    fn adjust_for_abi(&mut self, cx: &C, abi: SpecAbi);
+}
 
+impl<'tcx, C> FnAbiInternalExt<'tcx, C> for call::FnAbi<'tcx, Ty<'tcx>>
+where
+    C: LayoutOf<'tcx, LayoutOfResult = TyAndLayout<'tcx>> + HasTargetSpec,
+{
     fn new_internal(
         cx: &C,
         sig: ty::PolyFnSig<'tcx>,