ICE: Can't combine functions in the same CGU that reference both a static and an extern static with the same name #66464
Labels
A-codegen
Area: Code generation
A-linkage
Area: linking into static, shared libraries and binaries
C-bug
Category: This is a bug.
I-ICE
Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
P-high
High priority
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
The following code, when compiled in release mode with
-C codegen-units=2
ICEs with the error below (I initially found this with the default 16 CGUs on a much larger codebase). I'm not entirely sure that the check at https://github.com/rust-lang/rust/blob/master/src/librustc_codegen_llvm/consts.rs#L236 is needed. However, if we're moving a reference to a static to a different CGU, we shouldn't define the static at all, but only declare it. Can we get rid of the match acrossItem
orForeignItem
and treat all references to a static in a different CGU as if it were foreign, regardless of whether it was foreign in HIR?The text was updated successfully, but these errors were encountered: