Skip to content

Commit 9304b84

Browse files
author
Lukas Markeffsky
committed
fix tests
1 parent d20431f commit 9304b84

File tree

4 files changed

+8
-1
lines changed

4 files changed

+8
-1
lines changed

library/core/src/ptr/const_ptr.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1384,6 +1384,7 @@ impl<T: ?Sized> *const T {
13841384
pub const fn is_aligned_to(self, align: usize) -> bool {
13851385
assert!(align.is_power_of_two(), "is_aligned_to: align is not a power-of-two");
13861386

1387+
#[inline]
13871388
fn runtime(ptr: *const u8, align: usize) -> bool {
13881389
ptr.addr() & (align - 1) == 0
13891390
}

library/core/src/ptr/mut_ptr.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1655,6 +1655,7 @@ impl<T: ?Sized> *mut T {
16551655
pub const fn is_aligned_to(self, align: usize) -> bool {
16561656
assert!(align.is_power_of_two(), "is_aligned_to: align is not a power-of-two");
16571657

1658+
#[inline]
16581659
fn runtime(ptr: *mut u8, align: usize) -> bool {
16591660
ptr.addr() & (align - 1) == 0
16601661
}

library/core/tests/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#![feature(const_nonnull_new)]
1818
#![feature(const_num_from_num)]
1919
#![feature(const_pointer_byte_offsets)]
20-
#![feature(const_pointer_is_aligned)]
20+
#![cfg_attr(not(bootstrap), feature(const_pointer_is_aligned))]
2121
#![feature(const_ptr_as_ref)]
2222
#![feature(const_ptr_read)]
2323
#![feature(const_ptr_write)]

library/core/tests/ptr.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,7 @@ fn align_offset_zst() {
359359
}
360360

361361
#[test]
362+
#[cfg(not(bootstrap))]
362363
fn align_offset_zst_const() {
363364
const {
364365
// For pointers of stride = 0, the pointer is already aligned or it cannot be aligned at
@@ -396,6 +397,7 @@ fn align_offset_stride_one() {
396397
}
397398

398399
#[test]
400+
#[cfg(not(bootstrap))]
399401
fn align_offset_stride_one_const() {
400402
const {
401403
// For pointers of stride = 1, the pointer can always be aligned. The offset is equal to
@@ -491,6 +493,7 @@ fn align_offset_various_strides() {
491493
}
492494

493495
#[test]
496+
#[cfg(not(bootstrap))]
494497
fn align_offset_various_strides_const() {
495498
const unsafe fn test_stride<T>(ptr: *const T, numptr: usize, align: usize) {
496499
let mut expected = usize::MAX;
@@ -554,6 +557,7 @@ fn align_offset_various_strides_const() {
554557
}
555558

556559
#[test]
560+
#[cfg(not(bootstrap))]
557561
fn align_offset_with_provenance_const() {
558562
const {
559563
let data = 42;
@@ -633,6 +637,7 @@ fn is_aligned() {
633637
}
634638

635639
#[test]
640+
#[cfg(not(bootstrap))]
636641
fn is_aligned_const() {
637642
const {
638643
let data = 42;

0 commit comments

Comments
 (0)