Skip to content

Commit 2efbc94

Browse files
committed
rewrite no-alloc-shim to rmake
1 parent c9d378c commit 2efbc94

File tree

4 files changed

+37
-26
lines changed

4 files changed

+37
-26
lines changed

src/tools/tidy/src/allowed_run_make_makefiles.txt

-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ run-make/long-linker-command-lines/Makefile
3131
run-make/macos-deployment-target/Makefile
3232
run-make/native-link-modifier-bundle/Makefile
3333
run-make/native-link-modifier-whole-archive/Makefile
34-
run-make/no-alloc-shim/Makefile
3534
run-make/no-builtins-attribute/Makefile
3635
run-make/pdb-buildinfo-cl-cmd/Makefile
3736
run-make/pgo-gen-lto/Makefile

tests/run-make/min-global-align/rmake.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// This tests ensure that global variables respect the target minimum alignment.
1+
// This test checks that global variables respect the target minimum alignment.
22
// The three bools `STATIC_BOOL`, `STATIC_MUT_BOOL`, and `CONST_BOOL` all have
33
// type-alignment of 1, but some targets require greater global alignment.
44
// See https://github.com/rust-lang/rust/pull/44440

tests/run-make/no-alloc-shim/Makefile

-24
This file was deleted.

tests/run-make/no-alloc-shim/rmake.rs

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// This test checks the compatibility of the interaction between `--emit obj` and
2+
// `#[global_allocator]`, as it is now possible to invoke the latter without the
3+
// allocator shim since #86844. As this feature is unstable, it should fail if
4+
// --cfg check_feature_gate is passed.
5+
// See https://github.com/rust-lang/rust/pull/86844
6+
7+
//@ ignore-cross-compile
8+
// Reason: the compiled binary is executed
9+
10+
//FIXME(Oneirical): ignore-msvc FIXME(bjorn3) can't figure out how to link with the MSVC toolchain
11+
12+
use run_make_support::{cc, cwd, has_extension, has_prefix, run, rustc, shallow_find_files};
13+
14+
fn main() {
15+
rustc().input("foo.rs").crate_type("bin").emit("obj").panic("abort").run();
16+
let libdir = rustc().print("target-libdir").run().stdout_utf8();
17+
let libdir = libdir.trim();
18+
let alloc_libs = shallow_find_files(&libdir, |path| {
19+
has_prefix(path, "liballoc-") && has_extension(path, "rlib")
20+
});
21+
let core_libs = shallow_find_files(libdir, |path| {
22+
has_prefix(path, "libcore-") && has_extension(path, "rlib")
23+
});
24+
cc().input("foo.o").out_exe("foo").args(&alloc_libs).args(&core_libs).run();
25+
run("foo");
26+
27+
// Check that linking without __rust_no_alloc_shim_is_unstable defined fails
28+
rustc()
29+
.input("foo.rs")
30+
.crate_type("bin")
31+
.emit("obj")
32+
.panic("abort")
33+
.cfg("check_feature_gate")
34+
.run();
35+
cc().input("foo.o").out_exe("foo").args(&alloc_libs).args(&core_libs).run_fail();
36+
}

0 commit comments

Comments
 (0)