-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Internal compiler error when implementing local allocator and box. #90911
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.
I-ICE
Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
requires-nightly
This issue requires a nightly compiler in some way.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Comments
I realized that the compiler still panics when the #![no_std]
#![feature(allocator_api)]
#![feature(new_uninit)]
extern crate alloc;
use alloc::boxed::Box;
use core::{
alloc::{AllocError, Allocator, Layout},
ptr::NonNull,
};
pub struct Foo {}
unsafe impl Allocator for Foo {
fn allocate(&self, _layout: Layout) -> Result<NonNull<[u8]>, AllocError> {
panic!();
}
unsafe fn deallocate(&self, _ptr: NonNull<u8>, _layout: Layout) {
panic!();
}
}
impl Foo {
pub fn foo(&self) {
let _bar = Box::new_in(20, self);
}
} |
I get a different error, probably due to a newer compiler version:
Backtrace
|
this is because the value you pass as the allocator is a duplicate of #78459 |
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
Labels
C-bug
Category: This is a bug.
I-ICE
Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
requires-nightly
This issue requires a nightly compiler in some way.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Code
Meta
rustc --version --verbose
:Error output
Backtrace
The text was updated successfully, but these errors were encountered: