Closed
Description
Added in PR #39987.
RFC for stabilization: rust-lang/rfcs#2386 (merged)
This is an experimental feature and requires an RFC before it goes through the stabilization process.
Usage
Preserves static
variables up to the object file level. This feature doesn't affect link time garbage collections of unused symbols / sections.
// foo.rs
#![crate_type = "lib"]
#![feature(used)]
#[used]
static FOO: u32 = 0;
$ rustc -C opt-level=3 --emit=obj foo.rs
$ nm -C foo.o
0000000000000000 r foo::FOO::h367266b77811307c
Metadata
Metadata
Assignees
Labels
Blocker: Implemented in the nightly compiler and unstable.Category: An issue tracking the progress of sth. like the implementation of an RFCRelevant to the language team, which will review and decide on the PR/issue.This issue / PR is in PFCP or FCP with a disposition to merge it.The final comment period is finished for this PR / Issue.