Closed
Description
Code
I tried this code:
// src/main.rs
unsafe extern "C" {
unsafe static UNDEFINED: usize;
}
#[unsafe(no_mangle)]
pub fn used() {
println!("UNDEFINED = {}", unsafe { UNDEFINED });
}
pub fn marker() -> usize {
0
}
fn main() {
assert_eq!(marker(), 0_usize);
}
cargo build --target aarch64-apple-darwin
I expected to see this happen: it builds
Instead, this happened: it emits linker errors
Version it worked on
1.86.0
Version with regression
nightly-2025-02-26; bisects to #133832
Metadata
Metadata
Assignees
Labels
Area: linking into static, shared libraries and binariesCategory: This is a bug.Issue: Indicates that prioritization has been requested for this issue.Operating system: Apple (macOS, iOS, tvOS, visionOS, watchOS)Relevant to the compiler team, which will review and decide on the PR/issue.Performance or correctness regression from stable to beta.