Skip to content

Commit

Permalink
Clean up some code for new MSRV (#1888)
Browse files Browse the repository at this point in the history
Also clean up some code for 0.9.
  • Loading branch information
joshlf authored Oct 12, 2024
1 parent 1788f44 commit 7349fe0
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 27 deletions.
21 changes: 0 additions & 21 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -395,27 +395,6 @@ const _: () = {
_WARNING
};

// These exist so that code which was written against the old names will get
// less confusing error messages when they upgrade to a more recent version of
// zerocopy. On our MSRV toolchain, the error messages read, for example:
//
// error[E0603]: trait `FromZeroes` is private
// --> examples/deprecated.rs:1:15
// |
// 1 | use zerocopy::FromZeroes;
// | ^^^^^^^^^^ private trait
// |
// note: the trait `FromZeroes` is defined here
// --> /Users/josh/workspace/zerocopy/src/lib.rs:1845:5
// |
// 1845 | use FromZeros as FromZeroes;
// | ^^^^^^^^^^^^^^^^^^^^^^^
//
// The "note" provides enough context to make it easy to figure out how to fix
// the error.
#[allow(unused)]
use {FromZeros as FromZeroes, IntoBytes as AsBytes, Ref as LayoutVerified};

/// Implements [`KnownLayout`].
///
/// This derive analyzes various aspects of a type's layout that are needed for
Expand Down
1 change: 0 additions & 1 deletion src/pointer/ptr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ mod def {
}
}

#[allow(unreachable_pub)] // This is a false positive on our MSRV toolchain.
pub use def::Ptr;

/// Used to define the system of [invariants][invariant] of `Ptr`.
Expand Down
6 changes: 1 addition & 5 deletions src/wrappers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -239,11 +239,7 @@ impl<T> Unalign<T> {
// but the caller has promised that `self` is properly aligned, so we
// know that it is sound to create a reference to `T` at this memory
// location.
//
// We use `mem::transmute` instead of `&*self.get_ptr()` because
// dereferencing pointers is not stable in `const` on our current MSRV
// (1.56 as of this writing).
unsafe { mem::transmute(self) }
unsafe { &*self.get_ptr() }
}

/// Returns a mutable reference to the wrapped `T` without checking
Expand Down

0 comments on commit 7349fe0

Please sign in to comment.