rust-lang / rust-lang/rust

Static EII defaults are currently unsupported on macOS

Open
#157,649 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-linkage F-extern_item_impls needs-triage O-macos T-compiler
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

Static EII defaults currently fail to link on macOS targets.

Example:

#![feature(extern_item_impls)]

#[eii(eii1)]
pub static DECL1: u64 = 5;

fn main() {
    println!("{DECL1}");
}

This appears to be caused by LLVM's Mach-O alias emission. See https://github.com/rust-lang/rust/pull/156583#issuecomment-4496778825 for details and links to the related LLVM issue / PR.

Until the LLVM fix reaches rustc, rustc should reject static EII defaults on macOS targets with a diagnostic that points here.

This issue tracks that temporary restriction and its eventual removal.

Related
  • Tracking issue: rust-lang/rust#125418
  • PR adding static EII defaults: rust-lang/rust#156583

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the static EII defaults work in rust-lang/rust#156583 and the tracking issue rust-lang/rust#125418, then reproduce the example on a macOS target. Trace where static EII defaults are accepted and where target-specific diagnostics are emitted. Done means macOS targets reject these defaults with a diagnostic pointing to this issue while other targets retain the existing behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.