Skip to content

Commit a1d7c51

Browse files
committed
ty::layout: move trait FnAbiExt to just before its impl.
1 parent 9dd4ce8 commit a1d7c51

File tree

1 file changed

+28
-28
lines changed

1 file changed

+28
-28
lines changed

compiler/rustc_middle/src/ty/layout.rs

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2633,34 +2633,6 @@ impl<'tcx> ty::Instance<'tcx> {
26332633
}
26342634
}
26352635

2636-
pub trait FnAbiExt<'tcx, C>
2637-
where
2638-
C: LayoutOf<'tcx, LayoutOfResult = TyAndLayout<'tcx>> + HasTargetSpec,
2639-
{
2640-
/// Compute a `FnAbi` suitable for indirect calls, i.e. to `fn` pointers.
2641-
///
2642-
/// NB: this doesn't handle virtual calls - those should use `FnAbi::of_instance`
2643-
/// instead, where the instance is an `InstanceDef::Virtual`.
2644-
fn of_fn_ptr(cx: &C, sig: ty::PolyFnSig<'tcx>, extra_args: &[Ty<'tcx>]) -> Self;
2645-
2646-
/// Compute a `FnAbi` suitable for declaring/defining an `fn` instance, and for
2647-
/// direct calls to an `fn`.
2648-
///
2649-
/// NB: that includes virtual calls, which are represented by "direct calls"
2650-
/// to an `InstanceDef::Virtual` instance (of `<dyn Trait as Trait>::fn`).
2651-
fn of_instance(cx: &C, instance: ty::Instance<'tcx>, extra_args: &[Ty<'tcx>]) -> Self;
2652-
2653-
fn new_internal(
2654-
cx: &C,
2655-
sig: ty::PolyFnSig<'tcx>,
2656-
extra_args: &[Ty<'tcx>],
2657-
caller_location: Option<Ty<'tcx>>,
2658-
codegen_fn_attr_flags: CodegenFnAttrFlags,
2659-
make_self_ptr_thin: bool,
2660-
) -> Self;
2661-
fn adjust_for_abi(&mut self, cx: &C, abi: SpecAbi);
2662-
}
2663-
26642636
/// Calculates whether a function's ABI can unwind or not.
26652637
///
26662638
/// This takes two primary parameters:
@@ -2816,6 +2788,34 @@ pub fn conv_from_spec_abi(tcx: TyCtxt<'_>, abi: SpecAbi) -> Conv {
28162788
}
28172789
}
28182790

2791+
pub trait FnAbiExt<'tcx, C>
2792+
where
2793+
C: LayoutOf<'tcx, LayoutOfResult = TyAndLayout<'tcx>> + HasTargetSpec,
2794+
{
2795+
/// Compute a `FnAbi` suitable for indirect calls, i.e. to `fn` pointers.
2796+
///
2797+
/// NB: this doesn't handle virtual calls - those should use `FnAbi::of_instance`
2798+
/// instead, where the instance is an `InstanceDef::Virtual`.
2799+
fn of_fn_ptr(cx: &C, sig: ty::PolyFnSig<'tcx>, extra_args: &[Ty<'tcx>]) -> Self;
2800+
2801+
/// Compute a `FnAbi` suitable for declaring/defining an `fn` instance, and for
2802+
/// direct calls to an `fn`.
2803+
///
2804+
/// NB: that includes virtual calls, which are represented by "direct calls"
2805+
/// to an `InstanceDef::Virtual` instance (of `<dyn Trait as Trait>::fn`).
2806+
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);
2817+
}
2818+
28192819
impl<'tcx, C> FnAbiExt<'tcx, C> for call::FnAbi<'tcx, Ty<'tcx>>
28202820
where
28212821
C: LayoutOf<'tcx, LayoutOfResult = TyAndLayout<'tcx>> + HasTargetSpec,

0 commit comments

Comments
 (0)