-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Open
Labels
-Cprefer-dynamicCodegen option: Prefer dynamic linking to static linking.Codegen option: Prefer dynamic linking to static linking.A-allocatorsArea: Custom and system allocatorsArea: Custom and system allocatorsA-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-linkageArea: linking into static, shared libraries and binariesArea: linking into static, shared libraries and binariesC-bugCategory: This is a bug.Category: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
Could not find anything related to this online. Using RUSTFLAGS="-C prefer-dynamic" cargo run
on this does not panic.
use std::alloc::{GlobalAlloc, Layout};
#[global_allocator]
static ALLOC: Alloc = Alloc;
pub struct Alloc;
unsafe impl GlobalAlloc for Alloc {
unsafe fn alloc(&self, layout: Layout) -> *mut u8 {
panic!()
}
unsafe fn alloc_zeroed(&self, layout: Layout) -> *mut u8 {
panic!()
}
unsafe fn realloc(&self, ptr: *mut u8, layout: Layout, new_size: usize) -> *mut u8 {
panic!()
}
unsafe fn dealloc(&self, ptr: *mut u8, layout: Layout) {
panic!()
}
}
fn main() {
let _ = Box::new(1);
}
Meta
rustc --version --verbose
:
rustc 1.65.0-nightly (29e4a9ee0 2022-08-10)
binary: rustc
commit-hash: 29e4a9ee0253cd39e552a77f51f11f9a5f1c41e6
commit-date: 2022-08-10
host: x86_64-unknown-linux-gnu
release: 1.65.0-nightly
LLVM version: 14.0.6
Metadata
Metadata
Assignees
Labels
-Cprefer-dynamicCodegen option: Prefer dynamic linking to static linking.Codegen option: Prefer dynamic linking to static linking.A-allocatorsArea: Custom and system allocatorsArea: Custom and system allocatorsA-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-linkageArea: linking into static, shared libraries and binariesArea: linking into static, shared libraries and binariesC-bugCategory: This is a bug.Category: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.