diff options
| author | Jorge Aparicio <jorge@japaric.io> | 2018-04-04 19:24:57 +0200 |
|---|---|---|
| committer | Jorge Aparicio <jorge@japaric.io> | 2018-04-04 19:24:57 +0200 |
| commit | 14768f9b636ef345320ded41da5e9f3da7af3a81 (patch) | |
| tree | 8ac8ad28fa7d3a0607ede928ebd7eb76b5068dac | |
| parent | 862c839fb9e0ad5615443b7e8fa21b421e2e74eb (diff) | |
create a nostd crate
the goal is to build, in a single Cargo invocation, several no-std crates that we want to put in the rust-std component of no-std targets. The nostd crate builds these crates: - core - compiler-builtin (with the "c" and "mem" features enabled) - alloc - std_unicode
| -rw-r--r-- | src/Cargo.lock | 10 | ||||
| -rw-r--r-- | src/Cargo.toml | 1 | ||||
| -rw-r--r-- | src/bootstrap/compile.rs | 8 | ||||
| -rw-r--r-- | src/libnostd/Cargo.toml | 17 | ||||
| -rw-r--r-- | src/libnostd/lib.rs | 3 |
5 files changed, 35 insertions, 4 deletions
diff --git a/src/Cargo.lock b/src/Cargo.lock index 1f7cf84cedb..42ac9b3c49d 100644 --- a/src/Cargo.lock +++ b/src/Cargo.lock @@ -1082,6 +1082,16 @@ version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] +name = "nostd" +version = "0.0.0" +dependencies = [ + "alloc 0.0.0", + "compiler_builtins 0.0.0", + "core 0.0.0", + "std_unicode 0.0.0", +] + +[[package]] name = "num" version = "0.1.42" source = "registry+https://github.com/rust-lang/crates.io-index" diff --git a/src/Cargo.toml b/src/Cargo.toml index 814c054c51e..babf35d570b 100644 --- a/src/Cargo.toml +++ b/src/Cargo.toml @@ -2,6 +2,7 @@ members = [ "bootstrap", "rustc", + "libnostd", "libstd", "libtest", "librustc_trans", diff --git a/src/bootstrap/compile.rs b/src/bootstrap/compile.rs index eaf4ab272c6..a93b26ac2ba 100644 --- a/src/bootstrap/compile.rs +++ b/src/bootstrap/compile.rs @@ -145,10 +145,10 @@ pub fn std_cargo(build: &Builder, } if build.no_std(target) == Some(true) { - // for no-std targets we only compile core and compiler-builtins - cargo.arg("--features").arg("c mem") - .arg("--manifest-path") - .arg(build.src.join("src/rustc/compiler_builtins_shim/Cargo.toml")); + // for no-std targets we compile a minimal nostd crate that only depends on crates that work + // without an OS + cargo.arg("--manifest-path") + .arg(build.src.join("src/libnostd/Cargo.toml")); } else { let mut features = build.std_features(); diff --git a/src/libnostd/Cargo.toml b/src/libnostd/Cargo.toml new file mode 100644 index 00000000000..6919390d3e2 --- /dev/null +++ b/src/libnostd/Cargo.toml @@ -0,0 +1,17 @@ +[package] +authors = ["The Rust Project Developers"] +name = "nostd" +version = "0.0.0" +license = "MIT/Apache-2.0" +repository = "https://github.com/rust-lang/rust.git" +description = "(not) The Rust Standard Library" + +[lib] +name = "nostd" +path = "lib.rs" + +[dependencies] +alloc = { path = "../liballoc" } +compiler_builtins = { path = "../rustc/compiler_builtins_shim", features = ["c", "mem"] } +core = { path = "../libcore" } +std_unicode = { path = "../libstd_unicode" } \ No newline at end of file diff --git a/src/libnostd/lib.rs b/src/libnostd/lib.rs new file mode 100644 index 00000000000..d28afe2838e --- /dev/null +++ b/src/libnostd/lib.rs @@ -0,0 +1,3 @@ +#![feature(staged_api)] +#![no_std] +#![unstable(feature = "nostd", issue = "0")] |
