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
This commit is contained in:
Jorge Aparicio 2018-04-04 19:24:57 +02:00
parent 862c839fb9
commit 14768f9b63
5 changed files with 35 additions and 4 deletions

10
src/Cargo.lock generated
View File

@ -1081,6 +1081,16 @@ name = "nodrop"
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"

View File

@ -2,6 +2,7 @@
members = [
"bootstrap",
"rustc",
"libnostd",
"libstd",
"libtest",
"librustc_trans",

View File

@ -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();

17
src/libnostd/Cargo.toml Normal file
View File

@ -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" }

3
src/libnostd/lib.rs Normal file
View File

@ -0,0 +1,3 @@
#![feature(staged_api)]
#![no_std]
#![unstable(feature = "nostd", issue = "0")]