Skip to content

Commit 5f80bb7

Browse files
committed
no_std fixes
1 parent 0b72c94 commit 5f80bb7

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

src/traits/fat.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ pub mod test {
197197
loop {
198198
let unaligned_mask = align.as_usize() - 1;
199199
let alloc = Layout::from_size_align(size, align.as_usize()).ok().and_then(|layout| FTB::try_new_uninit(&allocator, layout).ok());
200-
std::println!("attempted to allocate size={size} align={align:?} ... {}", if alloc.is_some() { "ok" } else { "FAILED" });
200+
#[cfg(feature = "std")] std::println!("attempted to allocate size={size} align={align:?} ... {}", if alloc.is_some() { "ok" } else { "FAILED" });
201201
if let Some(alloc) = alloc {
202202
let alloc = alloc.as_ptr();
203203
let addr = alloc as usize;
@@ -224,7 +224,7 @@ pub mod test {
224224
for offset in -64_isize .. 64_isize {
225225
let Some(size) = boundary.checked_add_signed(offset) else { continue };
226226
let Ok(layout) = Layout::from_size_align(size, 1) else { continue };
227-
std::dbg!(size);
227+
#[cfg(feature = "std")] std::dbg!(size);
228228
let Ok(alloc) = FTB::try_new_uninit(&allocator, layout) else { continue };
229229
if let Some(last_byte_index) = size.checked_sub(1) {
230230
let last_byte_index = last_byte_index.min(isize::MAX as usize);

src/traits/thin.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ pub mod test {
296296

297297
// Something a little more stress testy
298298
for size in [1, 2, 4, 8, 16, 32, 64, 128, 256] {
299-
std::dbg!(size);
299+
#[cfg(feature = "std")] std::dbg!(size);
300300
let mut addr_bits = 0;
301301
for _ in 0 .. 100 {
302302
if let Ok(alloc) = TTB::try_new_uninit(&allocator, size) {
@@ -320,7 +320,7 @@ pub mod test {
320320
for boundary in boundaries.iter().copied() {
321321
for offset in -64_isize .. 64_isize {
322322
let Some(size) = boundary.checked_add_signed(offset) else { continue };
323-
std::dbg!(size);
323+
#[cfg(feature = "std")] std::dbg!(size);
324324
let Ok(alloc) = TTB::try_new_uninit(&allocator, size) else { continue };
325325
if let Some(last_byte_index) = size.checked_sub(1) {
326326
let last_byte_index = last_byte_index.min(isize::MAX as usize);

src/vec/avec.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ impl<T, A: Free> AVec<T, A> {
162162

163163
// decompose without Drop
164164
let v = ManuallyDrop::new(v);
165-
let data = unsafe { std::ptr::read(&v.data) };
165+
let data = unsafe { core::ptr::read(&v.data) };
166166
core::mem::forget(v);
167167

168168
//let (raw, allocator) = data.into_raw_with_allocator();
@@ -191,7 +191,7 @@ impl<T, A: Free> AVec<T, A> {
191191
pub fn into_raw_parts_with_allocator(self) -> (NonNull<T>, usize, usize, A) {
192192
let this = ManuallyDrop::new(self);
193193
let len = this.len;
194-
let data = unsafe { std::ptr::read(&this.data) };
194+
let data = unsafe { core::ptr::read(&this.data) };
195195
let _ = this;
196196
let (data, alloc) = ABox::into_raw_with_allocator(data);
197197
let cap = data.len();

0 commit comments

Comments
 (0)