Cross-crate EII fails to link with error: undefined symbol when opt-level >= 1.
Reproduction
Multi-crate workspace — cannot be reduced to a single file.
Repo with a test script: https://github.com/AsakuraMizu/eii-playground
decl1/src/lib.rs:
#![feature(extern_item_impls)]
#[eii]
pub fn decl1();
impl1/src/lib.rs:
#[decl1::decl1]
pub fn impl1() {
println!("Hello, world!");
}
src/main.rs:
extern crate impl1;
fn main() {
decl1::decl1();
}
$ CARGO_PROFILE_DEV_OPT_LEVEL=1 cargo run
error: linking with `cc` failed: exit status: 1
= note: rust-lld: error: undefined symbol: decl1::decl1
Works with any of:
opt-level = 0
codegen-units = 1
lto = "off"
So the EII shim function appears to be eliminated during thin-local LTO.
Meta
rustc --version --verbose:
rustc 1.96.0-nightly (2d76d9bc7 2026-03-09)
binary: rustc
commit-hash: 2d76d9bc76f27b03b4899e72ce561c7ac2c5cf6b
commit-date: 2026-03-09
host: x86_64-unknown-linux-gnu
release: 1.96.0-nightly
LLVM version: 22.1.0
Possibly related: #151271
Tracking issue: #125418
Cross-crate EII fails to link with
error: undefined symbolwhenopt-level >= 1.Reproduction
Multi-crate workspace — cannot be reduced to a single file.
Repo with a test script: https://github.com/AsakuraMizu/eii-playground
decl1/src/lib.rs:impl1/src/lib.rs:src/main.rs:Works with any of:
opt-level = 0codegen-units = 1lto = "off"So the EII shim function appears to be eliminated during thin-local LTO.
Meta
rustc --version --verbose:Possibly related: #151271
Tracking issue: #125418