Skip to content

Commit 0c57500

Browse files
ericktjoshlf
authored andcommitted
Only use layout_for_ptr feature for zerocopy tests
This puts the use of the unstable feature `layout_for_ptr` behind `all(test, miri)`, since it is only necessary for zerocopy tests, not for downstream users. gherrit-pr-id: Gouy5nmgied3joawzp6mdecm3nuhi35jh
1 parent be6f199 commit 0c57500

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@
325325
#![cfg_attr(doc_cfg, feature(doc_cfg))]
326326
#![cfg_attr(__ZEROCOPY_INTERNAL_USE_ONLY_NIGHTLY_FEATURES_IN_TESTS, feature(coverage_attribute))]
327327
#![cfg_attr(
328-
any(__ZEROCOPY_INTERNAL_USE_ONLY_NIGHTLY_FEATURES_IN_TESTS, miri),
328+
any(__ZEROCOPY_INTERNAL_USE_ONLY_NIGHTLY_FEATURES_IN_TESTS, all(test, miri)),
329329
feature(layout_for_ptr)
330330
)]
331331
#![cfg_attr(all(test, __ZEROCOPY_INTERNAL_USE_ONLY_NIGHTLY_FEATURES_IN_TESTS), feature(test))]

src/pointer/ptr.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ mod _conversions {
233233
let raw = self.as_inner().as_non_null();
234234
// SAFETY: `self` satisfies the `Aligned` invariant, so we know that
235235
// `raw` is validly-aligned for `T`.
236-
#[cfg(miri)]
236+
#[cfg(all(test, miri))]
237237
unsafe {
238238
crate::util::miri_promise_symbolic_alignment(
239239
raw.as_ptr().cast(),
@@ -381,7 +381,7 @@ mod _conversions {
381381
let mut raw = self.as_inner().as_non_null();
382382
// SAFETY: `self` satisfies the `Aligned` invariant, so we know that
383383
// `raw` is validly-aligned for `T`.
384-
#[cfg(miri)]
384+
#[cfg(all(test, miri))]
385385
unsafe {
386386
crate::util::miri_promise_symbolic_alignment(
387387
raw.as_ptr().cast(),

0 commit comments

Comments
 (0)