Skip to content

Commit 8fbfac9

Browse files
authored
Remove Deref bound on Display and Error for ValidityError (#2579)
These impls should not (and do not) reflect on the address of the source. Even if they were to display the source value, they should do so by debug/display-printing the source, not by explicitly dereferencing the pointer. Fixes #2535
1 parent 71bc399 commit 8fbfac9

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

src/error.rs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -607,7 +607,6 @@ impl<Src, Dst: ?Sized + TryFromBytes> ValidityError<Src, Dst> {
607607
/// This formatting may include potentially sensitive information.
608608
fn display_verbose_extras(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result
609609
where
610-
Src: Deref,
611610
Dst: KnownLayout,
612611
{
613612
f.write_str("Destination type: ")?;
@@ -630,7 +629,6 @@ impl<Src, Dst: ?Sized + TryFromBytes> fmt::Debug for ValidityError<Src, Dst> {
630629
/// potentially sensitive information.
631630
impl<Src, Dst: ?Sized> fmt::Display for ValidityError<Src, Dst>
632631
where
633-
Src: Deref,
634632
Dst: KnownLayout + TryFromBytes,
635633
{
636634
#[inline]
@@ -646,12 +644,7 @@ where
646644

647645
#[cfg(any(zerocopy_core_error_1_81_0, feature = "std", test))]
648646
#[cfg_attr(doc_cfg, doc(cfg(all(rust = "1.81.0", feature = "std"))))]
649-
impl<Src, Dst: ?Sized> Error for ValidityError<Src, Dst>
650-
where
651-
Src: Deref,
652-
Dst: KnownLayout + TryFromBytes,
653-
{
654-
}
647+
impl<Src, Dst: ?Sized> Error for ValidityError<Src, Dst> where Dst: KnownLayout + TryFromBytes {}
655648

656649
impl<Src, Dst: ?Sized + TryFromBytes, A, S> From<ValidityError<Src, Dst>>
657650
for ConvertError<A, S, ValidityError<Src, Dst>>

0 commit comments

Comments
 (0)