mirror of https://github.com/rust-lang/rust.git
Remove unnecessary functions and the last mention of TMPDIR from `run-make-support`
This commit is contained in:
parent
c9cb3280f3
commit
5844b679f3
|
@ -65,12 +65,6 @@ pub fn is_darwin() -> bool {
|
|||
target().contains("darwin")
|
||||
}
|
||||
|
||||
/// Construct a path to a static library under `$TMPDIR` given the library name. This will return a
|
||||
/// path with `$TMPDIR` joined with platform-and-compiler-specific library name.
|
||||
pub fn static_lib(name: &str) -> PathBuf {
|
||||
PathBuf::from(static_lib_name(name))
|
||||
}
|
||||
|
||||
pub fn python_command() -> Command {
|
||||
let python_path = env_var("PYTHON");
|
||||
Command::new(python_path)
|
||||
|
@ -111,12 +105,6 @@ pub fn static_lib_name(name: &str) -> String {
|
|||
if is_msvc() { format!("{name}.lib") } else { format!("lib{name}.a") }
|
||||
}
|
||||
|
||||
/// Construct a path to a dynamic library under `$TMPDIR` given the library name. This will return a
|
||||
/// path with `$TMPDIR` joined with platform-and-compiler-specific library name.
|
||||
pub fn dynamic_lib(name: &str) -> PathBuf {
|
||||
PathBuf::from(dynamic_lib_name(name))
|
||||
}
|
||||
|
||||
/// Construct the dynamic library name based on the platform.
|
||||
pub fn dynamic_lib_name(name: &str) -> String {
|
||||
// See tools.mk (irrelevant lines omitted):
|
||||
|
@ -154,14 +142,7 @@ pub fn dynamic_lib_extension() -> &'static str {
|
|||
}
|
||||
}
|
||||
|
||||
/// Construct a path to a rust library (rlib) under `$TMPDIR` given the library name. This will return a
|
||||
/// path with `$TMPDIR` joined with the library name.
|
||||
pub fn rust_lib(name: &str) -> PathBuf {
|
||||
PathBuf::from(rust_lib_name(name))
|
||||
}
|
||||
|
||||
/// Generate the name a rust library (rlib) would have. If you want the complete path, use
|
||||
/// [`rust_lib`] instead.
|
||||
/// Construct a rust library (rlib) name.
|
||||
pub fn rust_lib_name(name: &str) -> String {
|
||||
format!("lib{name}.rlib")
|
||||
}
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
//! Check that non-trivial `repr(C)` enum in Rust has valid C layout.
|
||||
//@ ignore-cross-compile
|
||||
|
||||
use run_make_support::{cc, extra_c_flags, extra_cxx_flags, run, rustc, static_lib};
|
||||
use run_make_support::{cc, extra_c_flags, extra_cxx_flags, run, rustc, static_lib_name};
|
||||
|
||||
pub fn main() {
|
||||
use std::path::Path;
|
||||
|
||||
rustc().input("nonclike.rs").crate_type("staticlib").run();
|
||||
cc().input("test.c")
|
||||
.input(static_lib("nonclike"))
|
||||
.input(static_lib_name("nonclike"))
|
||||
.out_exe("test")
|
||||
.args(&extra_c_flags())
|
||||
.args(&extra_cxx_flags())
|
||||
|
|
|
@ -3,13 +3,13 @@
|
|||
|
||||
//@ ignore-cross-compile
|
||||
|
||||
use run_make_support::{cc, extra_c_flags, run, rustc, static_lib};
|
||||
use run_make_support::{cc, extra_c_flags, run, rustc, static_lib_name};
|
||||
use std::fs;
|
||||
|
||||
fn main() {
|
||||
rustc().input("foo.rs").run();
|
||||
cc().input("bar.c").input(static_lib("foo")).out_exe("bar").args(&extra_c_flags()).run();
|
||||
cc().input("bar.c").input(static_lib_name("foo")).out_exe("bar").args(&extra_c_flags()).run();
|
||||
run("bar");
|
||||
fs::remove_file(static_lib("foo"));
|
||||
fs::remove_file(static_lib_name("foo"));
|
||||
run("bar");
|
||||
}
|
||||
|
|
|
@ -5,12 +5,12 @@
|
|||
|
||||
//@ ignore-cross-compile
|
||||
|
||||
use run_make_support::{cc, extra_c_flags, run, rustc, static_lib};
|
||||
use run_make_support::{cc, extra_c_flags, run, rustc, static_lib_name};
|
||||
|
||||
fn main() {
|
||||
rustc().input("checkrust.rs").run();
|
||||
cc().input("test.c")
|
||||
.input(static_lib("checkrust"))
|
||||
.input(static_lib_name("checkrust"))
|
||||
.out_exe("test")
|
||||
.args(&extra_c_flags())
|
||||
.run();
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
use std::fs::remove_file;
|
||||
|
||||
use run_make_support::{cc, cwd, dynamic_lib, is_msvc, run, rustc};
|
||||
use run_make_support::{cc, cwd, dynamic_lib_name, is_msvc, run, rustc};
|
||||
|
||||
fn main() {
|
||||
rustc().input("bar.rs").run();
|
||||
|
@ -25,7 +25,7 @@ fn main() {
|
|||
}
|
||||
|
||||
run("foo");
|
||||
remove_file(dynamic_lib("foo")).unwrap();
|
||||
remove_file(dynamic_lib_name("foo")).unwrap();
|
||||
|
||||
rustc().input("foo.rs").arg("-Clto").run();
|
||||
run("foo");
|
||||
|
|
|
@ -9,10 +9,10 @@
|
|||
|
||||
//@ ignore-cross-compile
|
||||
|
||||
use run_make_support::{cc, extra_c_flags, run, rustc, static_lib};
|
||||
use run_make_support::{cc, extra_c_flags, run, rustc, static_lib_name};
|
||||
|
||||
fn main() {
|
||||
let libbar_path = static_lib("bar");
|
||||
let libbar_path = static_lib_name("bar");
|
||||
rustc().input("foo.rs").crate_type("rlib").run();
|
||||
rustc()
|
||||
.input("bar.rs")
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
//@ ignore-cross-compile
|
||||
|
||||
use run_make_support::{htmldocck, rustc, rustdoc, rust_lib_name};
|
||||
use run_make_support::{htmldocck, rust_lib_name, rustc, rustdoc};
|
||||
|
||||
fn main() {
|
||||
let out_dir = "rustdoc";
|
||||
|
|
|
@ -3,12 +3,12 @@
|
|||
|
||||
//@ ignore-cross-compile
|
||||
|
||||
use run_make_support::{dynamic_lib, rustc};
|
||||
use run_make_support::{dynamic_lib_name, rustc};
|
||||
use std::fs::File;
|
||||
|
||||
fn main() {
|
||||
rustc().input("foo.rs").arg("-Cprefer-dynamic").run();
|
||||
File::create(dynamic_lib("foo-something-special")).unwrap();
|
||||
File::create(dynamic_lib("foo-something-special2")).unwrap();
|
||||
File::create(dynamic_lib_name("foo-something-special")).unwrap();
|
||||
File::create(dynamic_lib_name("foo-something-special2")).unwrap();
|
||||
rustc().input("bar.rs").run();
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ use std::process::Command;
|
|||
fn main() {
|
||||
rustc().input("foo.rs").target("wasm32-wasip1").run();
|
||||
|
||||
let file = PathBuf::from("foo.wasm");
|
||||
let file = Path::new("foo.wasm");
|
||||
|
||||
run(&file, "return_two_i32", "1\n2\n");
|
||||
run(&file, "return_two_i64", "3\n4\n");
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
use run_make_support::{rustc, wasmparser};
|
||||
use std::collections::{HashMap, HashSet};
|
||||
use std::path::Path;
|
||||
|
||||
fn main() {
|
||||
test_file("foo.rs", &[("a", &["foo"]), ("b", &["foo"])]);
|
||||
|
|
Loading…
Reference in New Issue