-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Error when passing reference to Allocator impl to Box::new_in #92054
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Labels
C-bug
Category: This is a bug.
glacier
ICE tracked in rust-lang/glacier.
I-ICE
Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Comments
CodeI think this is the same bug. Playground repro. #![feature(allocator_api)]
use std::alloc::{Allocator, Global, Layout};
fn main() {
let layout: Layout = None.unwrap();
let ptr: *mut u8 = Global.allocate(layout).unwrap().as_ptr() as _;
// let box_ = unsafe { Box::from_raw_in(ptr, &Global) }; // ICE 1
let slice: &mut [u8] = unsafe { std::slice::from_raw_parts_mut(ptr, 0) };
let box_ = unsafe { Box::from_raw_in(slice, &Global) }; // ICE 2
box_.len();
} Meta
Error output
Backtrace
|
BGR360
added a commit
to BGR360/glacier
that referenced
this issue
Dec 27, 2021
rust-lang/rust#92054 Kudos to @mwerschy for reducing.
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this issue
Feb 17, 2022
Fix ICE when using Box<T, A> with pointer sized A Fixes rust-lang#78459 Note that using `Box<T, A>` with a more than pointer sized `A` or using a pointer sized `A` with a Box of a DST will produce a different ICE (rust-lang#92054) which is not fixed by this PR.
This is a duplicate of #81270 |
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this issue
Feb 28, 2022
Fix ICE when using Box<T, A> with large A A sequel to rust-lang#94043 that fixes rust-lang#81270 and rust-lang#92054 (duplicate).
This was not closed by #94414 @jonas-schievink can you please close this? :) |
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
Labels
C-bug
Category: This is a bug.
glacier
ICE tracked in rust-lang/glacier.
I-ICE
Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Uh oh!
There was an error while loading. Please reload this page.
Code
Could not isolate, but I think it was caused by passing a reference to a custom impl of Allocator to Box::new_zeroed_slice_in.
Meta
rustc --version --verbose
:Error output
Backtrace
The text was updated successfully, but these errors were encountered: