Skip to content

Rollup of 4 pull requests #41451

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

Closed
wants to merge 25 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
9b12732
Introduce crt_static target option in config.toml
smaeul Feb 26, 2017
e00e7dc
Factor out helper for getting C runtime linkage
smaeul Feb 26, 2017
099ef8a
Factor out special casing of MSVC crt
smaeul Mar 5, 2017
3218c77
Only use pre/post_link_objects for static linking
smaeul Feb 26, 2017
d39c8e7
Link libgcc_s over libunwind on dynamic musl
smaeul Feb 26, 2017
2a93336
Support dynamic linking for musl-based targets
smaeul Feb 26, 2017
eda72c5
C library usage is not conditional upon architecture
smaeul Feb 26, 2017
6a456f6
Presence of libraries does not depend on architecture
smaeul Feb 26, 2017
dab47a0
Infer a default musl_root for native builds
smaeul Feb 26, 2017
d985de1
add musl-root support for mips targets
smaeul Apr 11, 2017
903bdfc
Add test for issue 33884
estebank Apr 21, 2017
a76274e
Remove EnumSet
cuviper Apr 20, 2017
a724ff9
Remove BinaryHeap::{push_pop,replace}
cuviper Apr 20, 2017
df86cec
Remove OccupiedEntry::remove_pair
cuviper Apr 20, 2017
f4aaae9
Remove Rc::would_wrap
cuviper Apr 20, 2017
f0c5e8b
Privatize Rc::is_unique
cuviper Apr 20, 2017
cc605c8
Remove {Cell,RefCell}::as_unsafe_cell
cuviper Apr 20, 2017
313aab8
Remove RefCell::borrow_state
cuviper Apr 20, 2017
c903ac6
Remove num::{Zero,One}
cuviper Apr 20, 2017
c1aaa60
Remove float_extras
cuviper Apr 20, 2017
1a5c01c
Update cargo.
rillian Apr 21, 2017
324a29b
Rollup merge of #40113 - smaeul:native-musl, r=alexcrichton
frewsxcv Apr 21, 2017
674f728
Rollup merge of #41435 - estebank:issue-33884, r=nikomatsakis
frewsxcv Apr 21, 2017
3a65b06
Rollup merge of #41437 - cuviper:remove-unstable-deprecated, r=alexcr…
frewsxcv Apr 21, 2017
8876278
Rollup merge of #41450 - rillian:rustc-wrapper, r=alexcrichton
frewsxcv Apr 21, 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
2 changes: 2 additions & 0 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,8 @@ valopt musl-root-i686 "" "i686-unknown-linux-musl install directory"
valopt musl-root-arm "" "arm-unknown-linux-musleabi install directory"
valopt musl-root-armhf "" "arm-unknown-linux-musleabihf install directory"
valopt musl-root-armv7 "" "armv7-unknown-linux-musleabihf install directory"
valopt musl-root-mips "" "mips-unknown-linux-musl install directory"
valopt musl-root-mipsel "" "mipsel-unknown-linux-musl install directory"
valopt extra-filename "" "Additional data that is hashed and passed to the -C extra-filename flag"
valopt qemu-armhf-rootfs "" "rootfs in qemu testing, you probably don't want to use this"

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 @@ -214,9 +214,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 @@ -112,14 +112,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
15 changes: 15 additions & 0 deletions src/bootstrap/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,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 @@ -235,6 +236,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 @@ -381,6 +383,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 Expand Up @@ -508,6 +511,18 @@ impl Config {
.or_insert(Target::default());
target.musl_root = Some(parse_configure_path(value));
}
"CFG_MUSL_ROOT_MIPS" if value.len() > 0 => {
let target = "mips-unknown-linux-musl".to_string();
let target = self.target_config.entry(target)
.or_insert(Target::default());
target.musl_root = Some(parse_configure_path(value));
}
"CFG_MUSL_ROOT_MIPSEL" if value.len() > 0 => {
let target = "mipsel-unknown-linux-musl".to_string();
let target = self.target_config.entry(target)
.or_insert(Target::default());
target.musl_root = Some(parse_configure_path(value));
}
"CFG_DEFAULT_AR" if value.len() > 0 => {
self.rustc_default_ar = Some(value.to_string());
}
Expand Down
14 changes: 14 additions & 0 deletions src/bootstrap/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,10 @@ impl Build {
.env("RUSTC_DEBUGINFO_LINES", self.config.rust_debuginfo_lines.to_string());
}

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 @@ -917,6 +921,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
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 macOS");
}

// 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
4 changes: 3 additions & 1 deletion src/ci/docker/cross/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -78,5 +78,7 @@ ENV RUST_CONFIGURE_ARGS \
--target=$TARGETS \
--musl-root-arm=/usr/local/arm-linux-musleabi \
--musl-root-armhf=/usr/local/arm-linux-musleabihf \
--musl-root-armv7=/usr/local/armv7-linux-musleabihf
--musl-root-armv7=/usr/local/armv7-linux-musleabihf \
--musl-root-mips=/usr/local/mips-linux-musl \
--musl-root-mipsel=/usr/local/mipsel-linux-musl
ENV SCRIPT python2.7 ../x.py dist --target $TARGETS
10 changes: 0 additions & 10 deletions src/doc/unstable-book/src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,8 @@
- [alloc_system](library-features/alloc-system.md)
- [alloc](library-features/alloc.md)
- [as_c_str](library-features/as-c-str.md)
- [as_unsafe_cell](library-features/as-unsafe-cell.md)
- [ascii_ctype](library-features/ascii-ctype.md)
- [binary_heap_extras](library-features/binary-heap-extras.md)
- [binary_heap_peek_mut_pop](library-features/binary-heap-peek-mut-pop.md)
- [borrow_state](library-features/borrow-state.md)
- [box_heap](library-features/box-heap.md)
- [c_void_variant](library-features/c-void-variant.md)
- [char_escape_debug](library-features/char-escape-debug.md)
Expand All @@ -130,14 +127,12 @@
- [derive_clone_copy](library-features/derive-clone-copy.md)
- [derive_eq](library-features/derive-eq.md)
- [discriminant_value](library-features/discriminant-value.md)
- [enumset](library-features/enumset.md)
- [error_type_id](library-features/error-type-id.md)
- [exact_size_is_empty](library-features/exact-size-is-empty.md)
- [fd](library-features/fd.md)
- [fd_read](library-features/fd-read.md)
- [fixed_size_array](library-features/fixed-size-array.md)
- [float_bits_conv](library-features/float-bits-conv.md)
- [float_extras](library-features/float-extras.md)
- [flt2dec](library-features/flt2dec.md)
- [fmt_flags_align](library-features/fmt-flags-align.md)
- [fmt_internals](library-features/fmt-internals.md)
Expand All @@ -157,15 +152,13 @@
- [io_error_internals](library-features/io-error-internals.md)
- [io](library-features/io.md)
- [ip](library-features/ip.md)
- [is_unique](library-features/is-unique.md)
- [iter_rfind](library-features/iter-rfind.md)
- [libstd_io_internals](library-features/libstd-io-internals.md)
- [libstd_sys_internals](library-features/libstd-sys-internals.md)
- [libstd_thread_internals](library-features/libstd-thread-internals.md)
- [linked_list_extras](library-features/linked-list-extras.md)
- [lookup_host](library-features/lookup-host.md)
- [manually_drop](library-features/manually-drop.md)
- [map_entry_recover_keys](library-features/map-entry-recover-keys.md)
- [mpsc_select](library-features/mpsc-select.md)
- [n16](library-features/n16.md)
- [never_type_impls](library-features/never-type-impls.md)
Expand All @@ -188,7 +181,6 @@
- [rand](library-features/rand.md)
- [range_contains](library-features/range-contains.md)
- [raw](library-features/raw.md)
- [rc_would_unwrap](library-features/rc-would-unwrap.md)
- [retain_hash_collection](library-features/retain-hash-collection.md)
- [reverse_cmp_key](library-features/reverse-cmp-key.md)
- [rt](library-features/rt.md)
Expand Down Expand Up @@ -224,5 +216,3 @@
- [windows_handle](library-features/windows-handle.md)
- [windows_net](library-features/windows-net.md)
- [windows_stdio](library-features/windows-stdio.md)
- [zero_one](library-features/zero-one.md)
>>>>>> Add top level sections to the Unstable Book.
7 changes: 0 additions & 7 deletions src/doc/unstable-book/src/library-features/as-unsafe-cell.md

This file was deleted.

This file was deleted.

7 changes: 0 additions & 7 deletions src/doc/unstable-book/src/library-features/borrow-state.md

This file was deleted.

7 changes: 0 additions & 7 deletions src/doc/unstable-book/src/library-features/enumset.md

This file was deleted.

7 changes: 0 additions & 7 deletions src/doc/unstable-book/src/library-features/float-extras.md

This file was deleted.

7 changes: 0 additions & 7 deletions src/doc/unstable-book/src/library-features/is-unique.md

This file was deleted.

This file was deleted.

5 changes: 0 additions & 5 deletions src/doc/unstable-book/src/library-features/rc-would-unwrap.md

This file was deleted.

7 changes: 0 additions & 7 deletions src/doc/unstable-book/src/library-features/zero-one.md

This file was deleted.

19 changes: 1 addition & 18 deletions src/liballoc/rc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -341,19 +341,6 @@ impl<T> Rc<T> {
}
}

/// Checks whether [`Rc::try_unwrap`][try_unwrap] would return
/// [`Ok`].
///
/// [try_unwrap]: struct.Rc.html#method.try_unwrap
/// [`Ok`]: ../../std/result/enum.Result.html#variant.Ok
#[unstable(feature = "rc_would_unwrap",
reason = "just added for niche usecase",
issue = "28356")]
#[rustc_deprecated(since = "1.15.0", reason = "too niche; use `strong_count` instead")]
pub fn would_unwrap(this: &Self) -> bool {
Rc::strong_count(&this) == 1
}

/// Consumes the `Rc`, returning the wrapped pointer.
///
/// To avoid a memory leak the pointer must be converted back to an `Rc` using
Expand Down Expand Up @@ -501,11 +488,7 @@ impl<T: ?Sized> Rc<T> {
///
/// [weak]: struct.Weak.html
#[inline]
#[unstable(feature = "is_unique", reason = "uniqueness has unclear meaning",
issue = "28356")]
#[rustc_deprecated(since = "1.15.0",
reason = "too niche; use `strong_count` and `weak_count` instead")]
pub fn is_unique(this: &Self) -> bool {
fn is_unique(this: &Self) -> bool {
Rc::weak_count(this) == 0 && Rc::strong_count(this) == 1
}

Expand Down
76 changes: 0 additions & 76 deletions src/libcollections/binary_heap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -555,82 +555,6 @@ impl<T: Ord> BinaryHeap<T> {
self.sift_up(0, old_len);
}

/// Pushes an item onto the binary heap, then pops the greatest item off the queue in
/// an optimized fashion.
///
/// # Examples
///
/// Basic usage:
///
/// ```
/// #![feature(binary_heap_extras)]
/// #![allow(deprecated)]
///
/// use std::collections::BinaryHeap;
/// let mut heap = BinaryHeap::new();
/// heap.push(1);
/// heap.push(5);
///
/// assert_eq!(heap.push_pop(3), 5);
/// assert_eq!(heap.push_pop(9), 9);
/// assert_eq!(heap.len(), 2);
/// assert_eq!(heap.peek(), Some(&3));
/// ```
#[unstable(feature = "binary_heap_extras",
reason = "needs to be audited",
issue = "28147")]
#[rustc_deprecated(since = "1.13.0", reason = "use `peek_mut` instead")]
pub fn push_pop(&mut self, mut item: T) -> T {
match self.data.get_mut(0) {
None => return item,
Some(top) => {
if *top > item {
swap(&mut item, top);
} else {
return item;
}
}
}

self.sift_down(0);
item
}

/// Pops the greatest item off the binary heap, then pushes an item onto the queue in
/// an optimized fashion. The push is done regardless of whether the binary heap
/// was empty.
///
/// # Examples
///
/// Basic usage:
///
/// ```
/// #![feature(binary_heap_extras)]
/// #![allow(deprecated)]
///
/// use std::collections::BinaryHeap;
/// let mut heap = BinaryHeap::new();
///
/// assert_eq!(heap.replace(1), None);
/// assert_eq!(heap.replace(3), Some(1));
/// assert_eq!(heap.len(), 1);
/// assert_eq!(heap.peek(), Some(&3));
/// ```
#[unstable(feature = "binary_heap_extras",
reason = "needs to be audited",
issue = "28147")]
#[rustc_deprecated(since = "1.13.0", reason = "use `peek_mut` instead")]
pub fn replace(&mut self, mut item: T) -> Option<T> {
if !self.is_empty() {
swap(&mut item, &mut self.data[0]);
self.sift_down(0);
Some(item)
} else {
self.push(item);
None
}
}

/// Consumes the `BinaryHeap` and returns the underlying vector
/// in arbitrary order.
///
Expand Down
Loading