Skip to content

Commit fb3613f

Browse files
committed
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`.
1 parent 0e89d82 commit fb3613f

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

compiler/rustc_abi/src/callconv.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ impl<'a, Ty> TyAndLayout<'a, Ty> {
6060
/// This is public so that it can be used in unit tests, but
6161
/// should generally only be relevant to the ABI details of
6262
/// specific targets.
63+
#[tracing::instrument(skip(cx), level = "debug")]
6364
pub fn homogeneous_aggregate<C>(&self, cx: &C) -> Result<HomogeneousAggregate, Heterogeneous>
6465
where
6566
Ty: TyAbiInterface<'a, C> + Copy,

compiler/rustc_abi/src/layout/ty.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ impl<'a, Ty> AsRef<LayoutData<FieldIdx, VariantIdx>> for TyAndLayout<'a, Ty> {
155155

156156
/// Trait that needs to be implemented by the higher-level type representation
157157
/// (e.g. `rustc_middle::ty::Ty`), to provide `rustc_target::abi` functionality.
158-
pub trait TyAbiInterface<'a, C>: Sized + std::fmt::Debug {
158+
pub trait TyAbiInterface<'a, C>: Sized + std::fmt::Debug + std::fmt::Display {
159159
fn ty_and_layout_for_variant(
160160
this: TyAndLayout<'a, Self>,
161161
cx: &C,

compiler/rustc_target/src/callconv/aarch64.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,14 @@ use crate::spec::{Abi, HasTargetSpec, Target};
99
/// Used to accommodate Apple and Microsoft's deviations from the usual AAPCS ABI.
1010
///
1111
/// Corresponds to Clang's `AArch64ABIInfo::ABIKind`.
12-
#[derive(Copy, Clone, PartialEq)]
12+
#[derive(Copy, Clone, Debug, PartialEq)]
1313
pub(crate) enum AbiKind {
1414
AAPCS,
1515
DarwinPCS,
1616
Win64,
1717
}
1818

19+
#[tracing::instrument(skip(cx), level = "debug")]
1920
fn is_homogeneous_aggregate<'a, Ty, C>(cx: &C, arg: &mut ArgAbi<'a, Ty>) -> Option<Uniform>
2021
where
2122
Ty: TyAbiInterface<'a, C> + Copy,
@@ -73,6 +74,7 @@ fn softfloat_float_abi<Ty>(target: &Target, arg: &mut ArgAbi<'_, Ty>) {
7374
}
7475
}
7576

77+
#[tracing::instrument(skip(cx), level = "debug")]
7678
fn classify_ret<'a, Ty, C>(cx: &C, ret: &mut ArgAbi<'a, Ty>, kind: AbiKind)
7779
where
7880
Ty: TyAbiInterface<'a, C> + Copy,
@@ -105,6 +107,7 @@ where
105107
ret.make_indirect();
106108
}
107109

110+
#[tracing::instrument(skip(cx), level = "debug")]
108111
fn classify_arg<'a, Ty, C>(cx: &C, arg: &mut ArgAbi<'a, Ty>, kind: AbiKind)
109112
where
110113
Ty: TyAbiInterface<'a, C> + Copy,

0 commit comments

Comments
 (0)