about summary refs log tree commit diff
path: root/src/test/codegen
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2021-05-16 15:11:48 +0000
committerbors <bors@rust-lang.org>2021-05-16 15:11:48 +0000
commitf8e1e9238077a829ce1ac0cc1f2c7e0eaa4e679d (patch)
treef42214318eb2191b970f85c0c4408711213bce9b /src/test/codegen
parent747a5d2a5d6693f5e9426524b0dab34eb1587377 (diff)
parenteaddc8febd02ca0b0cbd0fa08b8b752cb347b725 (diff)
downloadrust-f8e1e9238077a829ce1ac0cc1f2c7e0eaa4e679d.tar.gz
rust-f8e1e9238077a829ce1ac0cc1f2c7e0eaa4e679d.zip
Auto merge of #84549 - tmiasko:static-initializer, r=varkor
Reachable statics have reachable initializers

Static initializer can read other statics. Initializers are evaluated at
compile time, and so their content could become inlined into another
crate. Ensure that initializers of reachable statics are also reachable.

Previously, when an item incorrectly considered to be unreachable was
reached from another crate an attempt would be made to codegen it. The
attempt could fail with an ICE (in the case MIR wasn't available to do
so) in some circumstances the attempt could also succeed resulting in
a local codegen of non-local items, including static ones.

Fixes #84455.
Diffstat (limited to 'src/test/codegen')
-rw-r--r--src/test/codegen/external-no-mangle-statics.rs4
1 files changed, 0 insertions, 4 deletions
diff --git a/src/test/codegen/external-no-mangle-statics.rs b/src/test/codegen/external-no-mangle-statics.rs
index ee61814678c..feb4af6286e 100644
--- a/src/test/codegen/external-no-mangle-statics.rs
+++ b/src/test/codegen/external-no-mangle-statics.rs
@@ -58,7 +58,6 @@ const HIDDEN: () = {
     pub static mut L: u8 = 0;
 };
 
-// The surrounding item should not accidentally become external
 fn x() {
     // CHECK: @M = local_unnamed_addr constant
     #[no_mangle]
@@ -76,6 +75,3 @@ fn x() {
     #[no_mangle]
     pub static mut P: u8 = 0;
 }
-// CHECK-LABEL: ; external_no_mangle_statics::x
-// CHECK-NEXT: ; Function Attrs:
-// CHECK-NEXT: define internal