Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit feca7d0

Browse files
committed
ty::layout: split out a private trait from FnAbiExt.
1 parent a1d7c51 commit feca7d0

File tree

1 file changed

+21
-10
lines changed

1 file changed

+21
-10
lines changed

compiler/rustc_middle/src/ty/layout.rs

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2804,16 +2804,6 @@ where
28042804
/// NB: that includes virtual calls, which are represented by "direct calls"
28052805
/// to an `InstanceDef::Virtual` instance (of `<dyn Trait as Trait>::fn`).
28062806
fn of_instance(cx: &C, instance: ty::Instance<'tcx>, extra_args: &[Ty<'tcx>]) -> Self;
2807-
2808-
fn new_internal(
2809-
cx: &C,
2810-
sig: ty::PolyFnSig<'tcx>,
2811-
extra_args: &[Ty<'tcx>],
2812-
caller_location: Option<Ty<'tcx>>,
2813-
codegen_fn_attr_flags: CodegenFnAttrFlags,
2814-
make_self_ptr_thin: bool,
2815-
) -> Self;
2816-
fn adjust_for_abi(&mut self, cx: &C, abi: SpecAbi);
28172807
}
28182808

28192809
impl<'tcx, C> FnAbiExt<'tcx, C> for call::FnAbi<'tcx, Ty<'tcx>>
@@ -2844,7 +2834,28 @@ where
28442834
matches!(instance.def, ty::InstanceDef::Virtual(..)),
28452835
)
28462836
}
2837+
}
2838+
2839+
/// Implementation detail of computing `FnAbi`s, shouldn't be exported.
2840+
trait FnAbiInternalExt<'tcx, C>
2841+
where
2842+
C: LayoutOf<'tcx, LayoutOfResult = TyAndLayout<'tcx>> + HasTargetSpec,
2843+
{
2844+
fn new_internal(
2845+
cx: &C,
2846+
sig: ty::PolyFnSig<'tcx>,
2847+
extra_args: &[Ty<'tcx>],
2848+
caller_location: Option<Ty<'tcx>>,
2849+
codegen_fn_attr_flags: CodegenFnAttrFlags,
2850+
make_self_ptr_thin: bool,
2851+
) -> Self;
2852+
fn adjust_for_abi(&mut self, cx: &C, abi: SpecAbi);
2853+
}
28472854

2855+
impl<'tcx, C> FnAbiInternalExt<'tcx, C> for call::FnAbi<'tcx, Ty<'tcx>>
2856+
where
2857+
C: LayoutOf<'tcx, LayoutOfResult = TyAndLayout<'tcx>> + HasTargetSpec,
2858+
{
28482859
fn new_internal(
28492860
cx: &C,
28502861
sig: ty::PolyFnSig<'tcx>,

0 commit comments

Comments
 (0)