Skip to content

Commit ab0c005

Browse files
committed
Remove dependency on Cargo from apple-c-available-links test
1 parent 19cccaf commit ab0c005

File tree

5 files changed

+11
-15
lines changed

5 files changed

+11
-15
lines changed

tests/run-make/apple-c-available-links/Cargo.toml

Lines changed: 0 additions & 7 deletions
This file was deleted.

tests/run-make/apple-c-available-links/build.rs

Lines changed: 0 additions & 4 deletions
This file was deleted.

tests/run-make/apple-c-available-links/foo.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
int foo(void) {
2-
// Use some API that's a lot newer than the host
2+
// Use some API that's a lot newer than the deployment target.
3+
// This forces Clang to insert a call to __isPlatformVersionAtLeast.
34
if (__builtin_available(
45
macos 1000.0,
56
ios 1000.0,

tests/run-make/apple-c-available-links/rmake.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,15 @@
33
44
//@ only-apple __builtin_available is (mostly) specific to Apple platforms.
55

6-
use run_make_support::{cargo, path, target};
6+
use run_make_support::{cc, rustc, target};
77

88
fn main() {
9-
let target_dir = path("target");
10-
cargo().args(&["build", "--target", &target()]).env("CARGO_TARGET_DIR", &target_dir).run();
9+
// Invoke the C compiler to generate an object file.
10+
//
11+
// (We cheat a bit here, and use the `rustc` target tuple directly as the
12+
// Clang tuple, though that might not work for older Clang versions).
13+
cc().arg("-target").arg(target()).arg("-c").input("foo.c").output("foo.o").run();
14+
15+
// Link the object file together with a Rust program.
16+
rustc().target(target()).input("main.rs").link_arg("foo.o").run();
1117
}

0 commit comments

Comments
 (0)