Skip to content

Commit 0e35e4e

Browse files
committed
Set correct linkage for statics
1 parent edbb573 commit 0e35e4e

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/constant.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -268,8 +268,11 @@ fn define_all_allocs(
268268
_ => bug!("static const eval returned {:#?}", const_),
269269
};
270270

271-
// FIXME set correct linkage
272-
let data_id = data_id_for_static(tcx, module, def_id, Linkage::Export);
271+
let data_id = data_id_for_static(tcx, module, def_id, if tcx.is_reachable_non_generic(def_id) {
272+
Linkage::Export
273+
} else {
274+
Linkage::Local
275+
});
273276
(data_id, alloc)
274277
}
275278
};

0 commit comments

Comments
 (0)