abi: Display bound on TyAbiInterface
The `fmt::Debug` impl for `TyAndLayout<'a, Ty>'` requires `fmt::Display` on the `Ty` parameter. In `ArgAbi`, `TyAndLayout`'s Ty` is instantiated with a parameter that implements `TyAbiInterface`. `TyAbiInterface` only required `fmt::Debug` be implemented on `Self`, not `fmt::Display`, which meant that it wasn't actually possible to debug print `ArgAbi`.
This commit is contained in:
parent
5f27abdbc8
commit
f0dfeab43d
3 changed files with 6 additions and 2 deletions
|
|
@ -60,6 +60,7 @@ impl<'a, Ty> TyAndLayout<'a, Ty> {
|
|||
/// This is public so that it can be used in unit tests, but
|
||||
/// should generally only be relevant to the ABI details of
|
||||
/// specific targets.
|
||||
#[tracing::instrument(skip(cx), level = "debug")]
|
||||
pub fn homogeneous_aggregate<C>(&self, cx: &C) -> Result<HomogeneousAggregate, Heterogeneous>
|
||||
where
|
||||
Ty: TyAbiInterface<'a, C> + Copy,
|
||||
|
|
|
|||
|
|
@ -155,7 +155,7 @@ impl<'a, Ty> AsRef<LayoutData<FieldIdx, VariantIdx>> for TyAndLayout<'a, Ty> {
|
|||
|
||||
/// Trait that needs to be implemented by the higher-level type representation
|
||||
/// (e.g. `rustc_middle::ty::Ty`), to provide `rustc_target::abi` functionality.
|
||||
pub trait TyAbiInterface<'a, C>: Sized + std::fmt::Debug {
|
||||
pub trait TyAbiInterface<'a, C>: Sized + std::fmt::Debug + std::fmt::Display {
|
||||
fn ty_and_layout_for_variant(
|
||||
this: TyAndLayout<'a, Self>,
|
||||
cx: &C,
|
||||
|
|
|
|||
|
|
@ -9,13 +9,14 @@ use crate::spec::{Abi, HasTargetSpec, Target};
|
|||
/// Used to accommodate Apple and Microsoft's deviations from the usual AAPCS ABI.
|
||||
///
|
||||
/// Corresponds to Clang's `AArch64ABIInfo::ABIKind`.
|
||||
#[derive(Copy, Clone, PartialEq)]
|
||||
#[derive(Copy, Clone, Debug, PartialEq)]
|
||||
pub(crate) enum AbiKind {
|
||||
AAPCS,
|
||||
DarwinPCS,
|
||||
Win64,
|
||||
}
|
||||
|
||||
#[tracing::instrument(skip(cx), level = "debug")]
|
||||
fn is_homogeneous_aggregate<'a, Ty, C>(cx: &C, arg: &mut ArgAbi<'a, Ty>) -> Option<Uniform>
|
||||
where
|
||||
Ty: TyAbiInterface<'a, C> + Copy,
|
||||
|
|
@ -73,6 +74,7 @@ fn softfloat_float_abi<Ty>(target: &Target, arg: &mut ArgAbi<'_, Ty>) {
|
|||
}
|
||||
}
|
||||
|
||||
#[tracing::instrument(skip(cx), level = "debug")]
|
||||
fn classify_ret<'a, Ty, C>(cx: &C, ret: &mut ArgAbi<'a, Ty>, kind: AbiKind)
|
||||
where
|
||||
Ty: TyAbiInterface<'a, C> + Copy,
|
||||
|
|
@ -105,6 +107,7 @@ where
|
|||
ret.make_indirect();
|
||||
}
|
||||
|
||||
#[tracing::instrument(skip(cx), level = "debug")]
|
||||
fn classify_arg<'a, Ty, C>(cx: &C, arg: &mut ArgAbi<'a, Ty>, kind: AbiKind)
|
||||
where
|
||||
Ty: TyAbiInterface<'a, C> + Copy,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue