Skip to content

Fix EII - #962

Merged
antoyo merged 2 commits into
rust-lang:masterfrom
AsakuraMizu:eii
Aug 24, 2026
Merged

Fix EII#962
antoyo merged 2 commits into
rust-lang:masterfrom
AsakuraMizu:eii

Conversation

@AsakuraMizu

Copy link
Copy Markdown
Contributor

Fix support for EII functions with defaults and EII statics. Now all tests/ui/eii tests pass.

@antoyo

antoyo commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

It seems there's some interactions with the inline attribute that should be handled as well.
For instance:

#![crate_type = "rlib"]
#![feature(extern_item_impls)]
#[eii(eii1)]
#[inline]
pub fn decl1(x: u64) {
    println!("default {x}");
}

panics with this warning:

libgccjit.so: warning: : inline function ‘_RNvCslJaV4vr0Uxj_9test_rust5decl1’ declared weak [-Wattributes]

Please add this as a test in tests/run and fix this issue.

@AsakuraMizu

Copy link
Copy Markdown
Contributor Author

It seems there's some interactions with the inline attribute that should be handled as well.

Hi, thanks for your review.

I investigated this further and found that this isn't only a attribute interaction issue with cg_gcc; it could also lead to unexpected behavior on cg_llvm. I've reported this upstream: rust-lang/rust#161650.

bjorn3 suggested denying #[inline] on EII declarations altogether: rust-lang/rust#161650 (comment)

Therefore if we add this check in rustc, the given example will produce a compile error before reaching cg_gcc instead of triggering an ICE.

Would you prefer to wait for the upstream fix for now?

@antoyo

antoyo commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

I'm OK with merging this PR now.
Is this ready to merge?

@AsakuraMizu

Copy link
Copy Markdown
Contributor Author

Is this ready to merge?

Yes it's ready. Thanks! 😃

@antoyo
antoyo merged commit 6331144 into rust-lang:master Aug 24, 2026
39 checks passed
@antoyo

antoyo commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Thanks for your contribution!

@AsakuraMizu
AsakuraMizu deleted the eii branch August 24, 2026 18:09
@antoyo antoyo mentioned this pull request Aug 24, 2026
@GuillaumeGomez

Copy link
Copy Markdown
Member

Nice work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants