Skip to content

Commit 7349fe0

Browse files
authored
Clean up some code for new MSRV (#1888)
Also clean up some code for 0.9.
1 parent 1788f44 commit 7349fe0

File tree

3 files changed

+1
-27
lines changed

3 files changed

+1
-27
lines changed

src/lib.rs

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -395,27 +395,6 @@ const _: () = {
395395
_WARNING
396396
};
397397

398-
// These exist so that code which was written against the old names will get
399-
// less confusing error messages when they upgrade to a more recent version of
400-
// zerocopy. On our MSRV toolchain, the error messages read, for example:
401-
//
402-
// error[E0603]: trait `FromZeroes` is private
403-
// --> examples/deprecated.rs:1:15
404-
// |
405-
// 1 | use zerocopy::FromZeroes;
406-
// | ^^^^^^^^^^ private trait
407-
// |
408-
// note: the trait `FromZeroes` is defined here
409-
// --> /Users/josh/workspace/zerocopy/src/lib.rs:1845:5
410-
// |
411-
// 1845 | use FromZeros as FromZeroes;
412-
// | ^^^^^^^^^^^^^^^^^^^^^^^
413-
//
414-
// The "note" provides enough context to make it easy to figure out how to fix
415-
// the error.
416-
#[allow(unused)]
417-
use {FromZeros as FromZeroes, IntoBytes as AsBytes, Ref as LayoutVerified};
418-
419398
/// Implements [`KnownLayout`].
420399
///
421400
/// This derive analyzes various aspects of a type's layout that are needed for

src/pointer/ptr.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,6 @@ mod def {
120120
}
121121
}
122122

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

126125
/// Used to define the system of [invariants][invariant] of `Ptr`.

src/wrappers.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -239,11 +239,7 @@ impl<T> Unalign<T> {
239239
// but the caller has promised that `self` is properly aligned, so we
240240
// know that it is sound to create a reference to `T` at this memory
241241
// location.
242-
//
243-
// We use `mem::transmute` instead of `&*self.get_ptr()` because
244-
// dereferencing pointers is not stable in `const` on our current MSRV
245-
// (1.56 as of this writing).
246-
unsafe { mem::transmute(self) }
242+
unsafe { &*self.get_ptr() }
247243
}
248244

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

0 commit comments

Comments
 (0)