Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upAssociate an allocator to boxes #55139
Conversation
rust-highfive
assigned
joshtriplett
Oct 17, 2018
This comment has been minimized.
This comment has been minimized.
|
(rust_highfive has picked a reviewer for you, use r? to override) |
rust-highfive
added
the
S-waiting-on-review
label
Oct 17, 2018
glandium
force-pushed the
glandium:box
branch
from
f03e1c5
to
aa19e43
Oct 17, 2018
This comment has been minimized.
This comment has been minimized.
|
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
This comment has been minimized.
This comment has been minimized.
|
As expected #52694 is still a problem. There is no way around it, short of requiring LLVM 7 for system LLVM builds. One problem here being that there isn't even a llvm-7-tools package for any version of Ubuntu (and travis builds are using 16.04, which doesn't even have LLVM 6) |
This comment has been minimized.
This comment has been minimized.
|
This PR introduces some new |
SimonSapin
reviewed
Oct 17, 2018
| let ptr = ptr.as_ptr(); | ||
| let size = size_of_val(&*ptr); | ||
| let align = min_align_of_val(&*ptr); | ||
| // We do not allocate for Box<T> when T is ZST, so deallocation is also not necessary. | ||
| if size != 0 { | ||
| let layout = Layout::from_size_align_unchecked(size, align); | ||
| dealloc(ptr as *mut u8, layout); | ||
| a.dealloc(NonNull::new_unchecked(ptr).cast(), layout); |
This comment has been minimized.
This comment has been minimized.
SimonSapin
Oct 17, 2018
Contributor
impl<T> From<Unique<T>> for NonNull<T> is safe and can be used here.
This comment has been minimized.
This comment has been minimized.
|
Ping from triage! Is there a way to work around the LLVM issues, short of requiring at least LLVM 7.0? Raising the minimum LLVM version would probably involve some kind of team RFC, but I'm not sure which team would be most appropriate. |
This comment has been minimized.
This comment has been minimized.
|
|
glandium commentedOct 17, 2018
•
edited
This turns
Box<T>intoBox<T, A: Alloc = Global>. This is aminimalist change to achieve this, not touching anything that could have
backwards incompatible consequences like requiring type annotations in
places where they currently aren't required,
per #50822 (comment)
This is a rebased version of #50882, meant primarily to get CI results and see if #52694 is still a problem.
Cc: @SimonSapin