rust/tests/run-make/used/rmake.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

14 lines
498 B
Rust
Raw Normal View History

2024-06-16 17:23:28 -05:00
// This test ensures that the compiler is keeping static variables, even if not referenced
// by another part of the program, in the output object file.
//
// It comes from #39987 which implements this RFC for the #[used] attribute:
// https://rust-lang.github.io/rfcs/2386-used.html
use run_make_support::rustc;
use run_make_support::symbols::any_symbol_contains;
2024-06-16 17:23:28 -05:00
fn main() {
rustc().opt_level("3").emit("obj").input("used.rs").run();
assert!(any_symbol_contains("used.o", &["FOO"]));
2024-06-16 17:23:28 -05:00
}