Skip to content

Commit

Permalink
create a nostd crate
Browse files Browse the repository at this point in the history
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
  • Loading branch information
japaric committed Apr 4, 2018
1 parent 862c839 commit 14768f9
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 4 deletions.
10 changes: 10 additions & 0 deletions src/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
members = [
"bootstrap",
"rustc",
"libnostd",
"libstd",
"libtest",
"librustc_trans",
Expand Down
8 changes: 4 additions & 4 deletions src/bootstrap/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
17 changes: 17 additions & 0 deletions src/libnostd/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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 changes: 3 additions & 0 deletions src/libnostd/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#![feature(staged_api)]
#![no_std]
#![unstable(feature = "nostd", issue = "0")]

0 comments on commit 14768f9

Please sign in to comment.