Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 18 pull requests #40361

Closed
wants to merge 46 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
3aa6f18
add unstable book to the bookshelf
steveklabnik Feb 28, 2017
ae2c9d2
fix link
steveklabnik Mar 2, 2017
b55f1e5
Fix description of closure coercion feature
est31 Mar 4, 2017
5a644f4
remove nomicon
steveklabnik Mar 3, 2017
4369aee
import nomicon submodule
steveklabnik Mar 3, 2017
202d8da
rustbuild: expose LLVM_PARALLEL_LINK_JOBS
Mar 5, 2017
03b83a0
clarify docs for Args and ArgsOs
oconnor663 Mar 5, 2017
ff35b11
Introduce crt_static target option in config.toml
smaeul Feb 26, 2017
91fe8c5
Factor out helper for getting C runtime linkage
smaeul Feb 26, 2017
e6dbe3b
Factor out special casing of MSVC crt
smaeul Mar 5, 2017
b66c4ed
Only use pre/post_link_objects for static linking
smaeul Feb 26, 2017
3a14de5
Link libgcc_s over libunwind on dynamic musl
smaeul Feb 26, 2017
8edfb35
Support dynamic linking for musl-based targets
smaeul Feb 26, 2017
470b62f
C library usage is not conditional upon architecture
smaeul Feb 26, 2017
5eba141
Presence of libraries does not depend on architecture
smaeul Feb 26, 2017
706fc55
Infer a default musl_root for native builds
smaeul Feb 26, 2017
86bad49
Issue #39688 - Help people find String::as_bytes() for UTF-8 r? @stev…
jdhorwitz Mar 3, 2017
f121e61
Fix text formatting in README
mmatyas Mar 6, 2017
2e5b380
Remove extra space in test description (of a mod test)
malbarbo Mar 6, 2017
2bb2a29
Improve the style of the sidebar in rustdoc output
wesleywiser Feb 16, 2017
acd8fe8
Fix a typo in the docs
oli-obk Mar 7, 2017
f283141
README formatting in configure/make section
joelgallant Mar 7, 2017
b5533d2
Update link to COMPILER_TESTS.md in CONTRIBUTING.md
crazymerlyn Mar 7, 2017
df61719
Added remove_from to vec.rs
madseagames Dec 3, 2016
65ac1e9
Add missing urls in some macros doc
GuillaumeGomez Mar 7, 2017
025bf95
Clarify handling of `src` in `ptr::write`
tbu- Mar 7, 2017
f3a2f90
Document why `str.to_{lower,upper}case` return `String`
tbu- Mar 7, 2017
e412af2
rustbuild: Assert directory creation succeeds
alexcrichton Mar 7, 2017
d9f633f
Rollup merge of #40113 - smaeul:native-musl, r=alexcrichton
frewsxcv Mar 8, 2017
0decbbf
Rollup merge of #40154 - steveklabnik:link-unstable-book, r=frewsxcv
frewsxcv Mar 8, 2017
86ee06b
Rollup merge of #40222 - steveklabnik:extract-nomicon, r=alexcrichton
frewsxcv Mar 8, 2017
3052932
Rollup merge of #40226 - jdhorwitz:master, r=frewsxcv
frewsxcv Mar 8, 2017
3ac1eaa
Rollup merge of #40258 - est31:master, r=nikomatsakis
frewsxcv Mar 8, 2017
1aa32bc
Rollup merge of #40265 - wesleywiser:rustdoc_style, r=GuillaumeGomez
frewsxcv Mar 8, 2017
95ab30f
Rollup merge of #40277 - rkruppe:llvm-parallel-link-jobs, r=alexcrichton
frewsxcv Mar 8, 2017
206a9d4
Rollup merge of #40283 - oconnor663:args_docs, r=alexcrichton
frewsxcv Mar 8, 2017
17ce186
Rollup merge of #40292 - mmatyas:readme_fix, r=alexcrichton
frewsxcv Mar 8, 2017
9895294
Rollup merge of #40293 - malbarbo:rustdoctest, r=alexcrichton
frewsxcv Mar 8, 2017
3a3cbc6
Rollup merge of #40316 - oli-obk:patch-4, r=GuillaumeGomez
frewsxcv Mar 8, 2017
a75fe45
Rollup merge of #40321 - joelgallant:joelgallant-readme, r=aturon
frewsxcv Mar 8, 2017
74229a8
Rollup merge of #40325 - eddyb:pr38143, r=alexcrichton
frewsxcv Mar 8, 2017
ad9968b
Rollup merge of #40326 - crazymerlyn:fix-doc-link, r=alexcrichton
frewsxcv Mar 8, 2017
1c47e16
Rollup merge of #40327 - GuillaumeGomez:macros-urls, r=frewsxcv
frewsxcv Mar 8, 2017
c4cb6bf
Rollup merge of #40333 - tbu-:pr_doc_ptr_write, r=alexcrichton
frewsxcv Mar 8, 2017
7c8b337
Rollup merge of #40335 - tbu-:pr_doc_str_to_somecase, r=steveklabnik
frewsxcv Mar 8, 2017
bfcee7b
Rollup merge of #40337 - alexcrichton:racy-dirs, r=brson
frewsxcv Mar 8, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
[submodule "src/liblibc"]
path = src/liblibc
url = https://github.com/rust-lang/libc.git
[submodule "src/doc/nomicon"]
path = src/doc/nomicon
url = https://github.com/rust-lang-nursery/nomicon
[submodule "src/tools/cargo"]
path = src/tools/cargo
url = https://github.com/rust-lang/cargo
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -406,5 +406,5 @@ are:
[rr]: https://doc.rust-lang.org/book/README.html
[tlgba]: http://tomlee.co/2014/04/a-more-detailed-tour-of-the-rust-compiler/
[ro]: http://www.rustaceans.org/
[rctd]: ./COMPILER_TESTS.md
[rctd]: ./src/test/COMPILER_TESTS.md
[cheatsheet]: https://buildbot.rust-lang.org/homu/
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ $ ./configure
$ make && sudo make install
```

When using the configure script, the generated config.mk` file may override the
When using the configure script, the generated `config.mk` file may override the
`config.toml` file. To go back to the `config.toml` file, delete the generated
`config.mk` file.

Expand Down
12 changes: 9 additions & 3 deletions src/bootstrap/bin/rustc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,9 +207,15 @@ fn main() {
}
}

if target.contains("pc-windows-msvc") {
cmd.arg("-Z").arg("unstable-options");
cmd.arg("-C").arg("target-feature=+crt-static");
if let Ok(s) = env::var("RUST_CRT_STATIC") {
if s == "true" {
cmd.arg("-Z").arg("unstable-options");
cmd.arg("-C").arg("target-feature=+crt-static");
}
if s == "false" {
cmd.arg("-Z").arg("unstable-options");
cmd.arg("-C").arg("target-feature=-crt-static");
}
}
}

Expand Down
7 changes: 5 additions & 2 deletions src/bootstrap/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,17 @@ pub fn std_link(build: &Build,
t!(fs::create_dir_all(&libdir));
add_to_sysroot(&out_dir, &libdir);

if target.contains("musl") && !target.contains("mips") {
if target.contains("musl") {
copy_musl_third_party_objects(build, target, &libdir);
}
}

/// Copies the crt(1,i,n).o startup objects
///
/// Only required for musl targets that statically link to libc
/// Since musl supports fully static linking, we can cross link for it even
/// with a glibc-targeting toolchain, given we have the appropriate startup
/// files. As those shipped with glibc won't work, copy the ones provided by
/// musl so we have them on linux-gnu hosts.
fn copy_musl_third_party_objects(build: &Build, target: &str, into: &Path) {
for &obj in &["crt1.o", "crti.o", "crtn.o"] {
copy(&build.musl_root(target).unwrap().join("lib").join(obj), &into.join(obj));
Expand Down
6 changes: 6 additions & 0 deletions src/bootstrap/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ pub struct Config {
pub llvm_static_stdcpp: bool,
pub llvm_link_shared: bool,
pub llvm_targets: Option<String>,
pub llvm_link_jobs: Option<u32>,

// rust codegen options
pub rust_optimize: bool,
Expand Down Expand Up @@ -117,6 +118,7 @@ pub struct Target {
pub cc: Option<PathBuf>,
pub cxx: Option<PathBuf>,
pub ndk: Option<PathBuf>,
pub crt_static: Option<bool>,
pub musl_root: Option<PathBuf>,
pub qemu_rootfs: Option<PathBuf>,
}
Expand Down Expand Up @@ -179,6 +181,7 @@ struct Llvm {
version_check: Option<bool>,
static_libstdcpp: Option<bool>,
targets: Option<String>,
link_jobs: Option<u32>,
}

#[derive(RustcDecodable, Default, Clone)]
Expand Down Expand Up @@ -231,6 +234,7 @@ struct TomlTarget {
cc: Option<String>,
cxx: Option<String>,
android_ndk: Option<String>,
crt_static: Option<bool>,
musl_root: Option<String>,
qemu_rootfs: Option<String>,
}
Expand Down Expand Up @@ -333,6 +337,7 @@ impl Config {
set(&mut config.llvm_version_check, llvm.version_check);
set(&mut config.llvm_static_stdcpp, llvm.static_libstdcpp);
config.llvm_targets = llvm.targets.clone();
config.llvm_link_jobs = llvm.link_jobs;
}

if let Some(ref rust) = toml.rust {
Expand Down Expand Up @@ -375,6 +380,7 @@ impl Config {
}
target.cxx = cfg.cxx.clone().map(PathBuf::from);
target.cc = cfg.cc.clone().map(PathBuf::from);
target.crt_static = cfg.crt_static.clone();
target.musl_root = cfg.musl_root.clone().map(PathBuf::from);
target.qemu_rootfs = cfg.qemu_rootfs.clone().map(PathBuf::from);

Expand Down
8 changes: 8 additions & 0 deletions src/bootstrap/config.toml.example
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,14 @@
# Rust team and file an issue if you need assistance in porting!
#targets = "X86;ARM;AArch64;Mips;PowerPC;SystemZ;JSBackend;MSP430;Sparc;NVPTX"

# Cap the number of parallel linker invocations when compiling LLVM.
# This can be useful when building LLVM with debug info, which significantly
# increases the size of binaries and consequently the memory required by
# each linker process.
# If absent or 0, linker invocations are treated like any other job and
# controlled by rustbuild's -j parameter.
#link-jobs = 0

# =============================================================================
# General build configuration options
# =============================================================================
Expand Down
14 changes: 14 additions & 0 deletions src/bootstrap/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,10 @@ impl Build {
.env("RUSTDOC_REAL", self.rustdoc(compiler))
.env("RUSTC_FLAGS", self.rustc_flags(target).join(" "));

if let Some(x) = self.crt_static(target) {
cargo.env("RUST_CRT_STATIC", x.to_string());
}

// Enable usage of unstable features
cargo.env("RUSTC_BOOTSTRAP", "1");
self.add_rust_test_threads(&mut cargo);
Expand Down Expand Up @@ -880,6 +884,16 @@ impl Build {
return base
}

/// Returns if this target should statically link the C runtime, if specified
fn crt_static(&self, target: &str) -> Option<bool> {
if target.contains("pc-windows-msvc") {
Some(true)
} else {
self.config.target_config.get(target)
.and_then(|t| t.crt_static)
}
}

/// Returns the "musl root" for this `target`, if defined
fn musl_root(&self, target: &str) -> Option<&Path> {
self.config.target_config.get(target)
Expand Down
6 changes: 6 additions & 0 deletions src/bootstrap/native.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,12 @@ pub fn llvm(build: &Build, target: &str) {
cfg.define("LLVM_BUILD_32_BITS", "ON");
}

if let Some(num_linkers) = build.config.llvm_link_jobs {
if num_linkers > 0 {
cfg.define("LLVM_PARALLEL_LINK_JOBS", num_linkers.to_string());
}
}

// http://llvm.org/docs/HowToCrossCompileLLVM.html
if target != build.config.build {
// FIXME: if the llvm root for the build triple is overridden then we
Expand Down
11 changes: 9 additions & 2 deletions src/bootstrap/sanity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,15 @@ pub fn check(build: &mut Build) {
panic!("the iOS target is only supported on OSX");
}

// Make sure musl-root is valid if specified
if target.contains("musl") && !target.contains("mips") {
// Make sure musl-root is valid
if target.contains("musl") {
// If this is a native target (host is also musl) and no musl-root is given,
// fall back to the system toolchain in /usr before giving up
if build.musl_root(target).is_none() && build.config.build == *target {
let target = build.config.target_config.entry(target.clone())
.or_insert(Default::default());
target.musl_root = Some("/usr".into());
}
match build.musl_root(target) {
Some(root) => {
if fs::metadata(root.join("lib/libc.a")).is_err() {
Expand Down
25 changes: 22 additions & 3 deletions src/build_helper/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@

extern crate filetime;

use std::{fs, env};
use std::fs::File;
use std::process::{Command, Stdio};
use std::io;
use std::path::{Path, PathBuf};
use std::process::{Command, Stdio};
use std::{fs, env};

use filetime::FileTime;

Expand Down Expand Up @@ -196,7 +197,7 @@ pub fn native_lib_boilerplate(src_name: &str,

let out_dir = env::var_os("RUSTBUILD_NATIVE_DIR").unwrap_or(env::var_os("OUT_DIR").unwrap());
let out_dir = PathBuf::from(out_dir).join(out_name);
let _ = fs::create_dir_all(&out_dir);
t!(create_dir_racy(&out_dir));
println!("cargo:rustc-link-lib=static={}", link_name);
println!("cargo:rustc-link-search=native={}", out_dir.join(search_subdir).display());

Expand All @@ -223,3 +224,21 @@ fn fail(s: &str) -> ! {
println!("\n\n{}\n\n", s);
std::process::exit(1);
}

fn create_dir_racy(path: &Path) -> io::Result<()> {
match fs::create_dir(path) {
Ok(()) => return Ok(()),
Err(ref e) if e.kind() == io::ErrorKind::AlreadyExists => return Ok(()),
Err(ref e) if e.kind() == io::ErrorKind::NotFound => {}
Err(e) => return Err(e),
}
match path.parent() {
Some(p) => try!(create_dir_racy(p)),
None => return Err(io::Error::new(io::ErrorKind::Other, "failed to create whole tree")),
}
match fs::create_dir(path) {
Ok(()) => Ok(()),
Err(ref e) if e.kind() == io::ErrorKind::AlreadyExists => Ok(()),
Err(e) => Err(e),
}
}
2 changes: 2 additions & 0 deletions src/doc/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ Rust provides a number of book-length sets of documentation, collectively
nicknamed 'The Rust Bookshelf.'

* [The Rust Programming Language][book] teaches you how to program in Rust.
* [The Unstable Book][unstable-book] has documentation for unstable features.
* [The Rustonomicon][nomicon] is your guidebook to the dark arts of unsafe Rust.
* [The Reference][ref] is not a formal spec, but is more detailed and comprehensive than the book.

Expand All @@ -44,4 +45,5 @@ landed before then. That work is being tracked [here][38643].
[err]: error-index.html
[book]: book/index.html
[nomicon]: nomicon/index.html
[unstable-book]: unstable-book/index.html

1 change: 1 addition & 0 deletions src/doc/nomicon
Submodule nomicon added at d08fe9
38 changes: 0 additions & 38 deletions src/doc/nomicon/src/README.md

This file was deleted.

55 changes: 0 additions & 55 deletions src/doc/nomicon/src/SUMMARY.md

This file was deleted.

7 changes: 0 additions & 7 deletions src/doc/nomicon/src/arc-and-mutex.md

This file was deleted.

Loading