Skip to content

Fix current crate reference in unsize_box. #37

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ mod unique;
#[macro_export]
#[cfg(feature = "alloc")]
macro_rules! unsize_box {( $boxed:expr $(,)? ) => ({
let (ptr, allocator) = ::allocator_api2::boxed::Box::into_raw_with_allocator($boxed);
let (ptr, allocator) = $crate::boxed::Box::into_raw_with_allocator($boxed);
// we don't want to allow casting to arbitrary type U, but we do want to allow unsize coercion to happen.
// that's exactly what's happening here -- this is *not* a pointer cast ptr as *mut _, but the compiler
// *will* allow an unsizing coercion to happen into the `ptr` place, if one is available. And we use _ so that the user can
Expand All @@ -63,7 +63,7 @@ macro_rules! unsize_box {( $boxed:expr $(,)? ) => ({
// SAFETY: see above for why ptr's type can only be something that can be safely coerced.
// also, ptr just came from a properly allocated box in the same allocator.
unsafe {
::allocator_api2::boxed::Box::from_raw_in(ptr, allocator)
$crate::boxed::Box::from_raw_in(ptr, allocator)
}
})}

Expand Down