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 12 pull requests #42242

Closed
wants to merge 33 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
a7d91ef
Remove `FusedIterator` implementation of `iter::Scan`
tbu- May 15, 2017
f8b66a0
trace_macro: Show both the macro call and its expansion. #42072.
jorendorff May 19, 2017
57f260d
Override size_hint and propagate ExactSizeIterator for iter::StepBy
scottmcm May 23, 2017
4be488c
Add iterator_step_by to the unstable book's summary
scottmcm May 21, 2017
fcb3a71
Update description of iter::StepBy
scottmcm May 21, 2017
794e572
Give step_trait a distinct tracking issue from step_by
scottmcm May 23, 2017
21dd71f
incr.comp.: Track expanded spans instead of FileMaps.
michaelwoerister May 23, 2017
fb9ca16
Remove all instances of fragment_infos and fragment sets
Nashenas88 May 24, 2017
6453f68
rust-src: include everything needed to compile libstd with jemalloc
RalfJung May 25, 2017
94b074f
Remove superfluous `;;` sequences
callahad May 25, 2017
8019430
Fix 'associate type' typo
May 25, 2017
5ce2eb1
use shared scripts for init and sccache in cross image
venkatagiri May 25, 2017
a563f35
Remove irrelevant tests and unused testing attribute
Nashenas88 May 25, 2017
cb7dbd5
ci: move musl install into their own scripts
venkatagiri May 25, 2017
435e1ce
Remove stray lockfile
brson May 25, 2017
0530339
regression test for #36379
venkatagiri May 25, 2017
6b151ef
regression test for #38954
venkatagiri May 25, 2017
04ac7c3
regression test for #39362
venkatagiri May 25, 2017
9ee9abc
regression test for #38160
venkatagiri May 25, 2017
95436c6
regression test for #37665
venkatagiri May 25, 2017
2160b4a
regression test for #37550
venkatagiri May 25, 2017
babc2a0
Rollup merge of #42014 - tbu-:pr_scan_not_fused, r=alexcrichton
Mark-Simulacrum May 26, 2017
caa2327
Rollup merge of #42103 - jorendorff:master, r=estebank
Mark-Simulacrum May 26, 2017
60fba60
Rollup merge of #42167 - scottmcm:iter-stepby-sizehint, r=alexcrichton
Mark-Simulacrum May 26, 2017
49e9ce3
Rollup merge of #42169 - scottmcm:new-step-trait-issue, r=alexcrichton
Mark-Simulacrum May 26, 2017
c3a500a
Rollup merge of #42175 - michaelwoerister:filemap-hashing-fix-1, r=ni…
Mark-Simulacrum May 26, 2017
f7c11a8
Rollup merge of #42207 - Nashenas88:remove_fragment_info, r=eddyb
Mark-Simulacrum May 26, 2017
0d00c83
Rollup merge of #42214 - RalfJung:rust-src, r=alexcrichton
Mark-Simulacrum May 26, 2017
57cf5fe
Rollup merge of #42215 - callahad:remove-superfluous-semis, r=Mark-Si…
Mark-Simulacrum May 26, 2017
0ebf2b5
Rollup merge of #42216 - charliesome:associate-type-typo, r=petrochenkov
Mark-Simulacrum May 26, 2017
ab6c565
Rollup merge of #42218 - venkatagiri:update_cross, r=alexcrichton
Mark-Simulacrum May 26, 2017
6b917c3
Rollup merge of #42224 - brson:lockfile, r=nikomatsakis
Mark-Simulacrum May 26, 2017
e988851
Rollup merge of #42230 - venkatagiri:ice_regression_tests, r=Mark-Sim…
Mark-Simulacrum May 26, 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
16 changes: 15 additions & 1 deletion src/bootstrap/dist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -619,6 +619,7 @@ pub fn rust_src(build: &Build) {
"src/liballoc",
"src/liballoc_jemalloc",
"src/liballoc_system",
"src/libbacktrace",
"src/libcollections",
"src/libcompiler_builtins",
"src/libcore",
Expand All @@ -634,12 +635,25 @@ pub fn rust_src(build: &Build) {
"src/libstd_unicode",
"src/libunwind",
"src/rustc/libc_shim",
"src/libtest",
"src/libterm",
"src/libgetopts",
"src/compiler-rt",
"src/jemalloc",
];
let std_src_dirs_exclude = [
"src/compiler-rt/test",
"src/jemalloc/test/unit",
];

for item in &std_src_dirs {
let dst = &dst_src.join(item);
t!(fs::create_dir_all(dst));
cp_r(&plain_dst_src.join(item), dst);
cp_filtered(&plain_dst_src.join(item), dst,
&|path| {
let item_path = Path::new(item).join(path);
!std_src_dirs_exclude.iter().any(|excl| item_path == Path::new(excl))
} );
}

// Create source tarball in rust-installer format
Expand Down
38 changes: 14 additions & 24 deletions src/ci/docker/cross/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,9 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
libssl-dev \
pkg-config

RUN curl -o /usr/local/bin/sccache \
https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-05-12-sccache-x86_64-unknown-linux-musl && \
chmod +x /usr/local/bin/sccache

RUN curl -OL https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64.deb && \
dpkg -i dumb-init_*.deb && \
rm dumb-init_*.deb
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
# dumb-init
COPY scripts/dumb-init.sh /scripts/
RUN sh /scripts/dumb-init.sh

WORKDIR /tmp

Expand All @@ -38,23 +33,11 @@ RUN ./build-rumprun.sh
COPY cross/build-arm-musl.sh /tmp/
RUN ./build-arm-musl.sh

# originally from
# https://downloads.openwrt.org/snapshots/trunk/ar71xx/generic/OpenWrt-Toolchain-ar71xx-generic_gcc-5.3.0_musl-1.1.16.Linux-x86_64.tar.bz2
RUN mkdir /usr/local/mips-linux-musl
RUN curl -L https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/OpenWrt-Toolchain-ar71xx-generic_gcc-5.3.0_musl-1.1.16.Linux-x86_64.tar.bz2 | \
tar xjf - -C /usr/local/mips-linux-musl --strip-components=2
RUN for file in /usr/local/mips-linux-musl/bin/mips-openwrt-linux-*; do \
ln -s $file /usr/local/bin/`basename $file`; \
done
COPY cross/install-mips-musl.sh /tmp/
RUN ./install-mips-musl.sh

# Note that this originally came from:
# https://downloads.openwrt.org/snapshots/trunk/malta/generic/OpenWrt-Toolchain-malta-le_gcc-5.3.0_musl-1.1.15.Linux-x86_64.tar.bz2
RUN mkdir /usr/local/mipsel-linux-musl
RUN curl -L https://s3.amazonaws.com/rust-lang-ci/libc/OpenWrt-Toolchain-malta-le_gcc-5.3.0_musl-1.1.15.Linux-x86_64.tar.bz2 | \
tar xjf - -C /usr/local/mipsel-linux-musl --strip-components=2
RUN for file in /usr/local/mipsel-linux-musl/bin/mipsel-openwrt-linux-*; do \
ln -s $file /usr/local/bin/`basename $file`; \
done
COPY cross/install-mipsel-musl.sh /tmp/
RUN ./install-mipsel-musl.sh

ENV TARGETS=asmjs-unknown-emscripten
ENV TARGETS=$TARGETS,wasm32-unknown-emscripten
Expand All @@ -80,3 +63,10 @@ ENV RUST_CONFIGURE_ARGS \
--musl-root-armhf=/usr/local/arm-linux-musleabihf \
--musl-root-armv7=/usr/local/armv7-linux-musleabihf
ENV SCRIPT python2.7 ../x.py dist --target $TARGETS

# sccache
COPY scripts/sccache.sh /scripts/
RUN sh /scripts/sccache.sh

# init
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
24 changes: 24 additions & 0 deletions src/ci/docker/cross/install-mips-musl.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Copyright 2017 The Rust Project Developers. See the COPYRIGHT
# file at the top-level directory of this distribution and at
# http://rust-lang.org/COPYRIGHT.
#
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
# option. This file may not be copied, modified, or distributed
# except according to those terms.

set -ex

mkdir /usr/local/mips-linux-musl

# originally from
# https://downloads.openwrt.org/snapshots/trunk/ar71xx/generic/
# OpenWrt-Toolchain-ar71xx-generic_gcc-5.3.0_musl-1.1.16.Linux-x86_64.tar.bz2
URL="https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror"
FILE="OpenWrt-Toolchain-ar71xx-generic_gcc-5.3.0_musl-1.1.16.Linux-x86_64.tar.bz2"
curl -L "$URL/$FILE" | tar xjf - -C /usr/local/mips-linux-musl --strip-components=2

for file in /usr/local/mips-linux-musl/bin/mips-openwrt-linux-*; do
ln -s $file /usr/local/bin/`basename $file`
done
24 changes: 24 additions & 0 deletions src/ci/docker/cross/install-mipsel-musl.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Copyright 2017 The Rust Project Developers. See the COPYRIGHT
# file at the top-level directory of this distribution and at
# http://rust-lang.org/COPYRIGHT.
#
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
# option. This file may not be copied, modified, or distributed
# except according to those terms.

set -ex

mkdir /usr/local/mipsel-linux-musl

# Note that this originally came from:
# https://downloads.openwrt.org/snapshots/trunk/malta/generic/
# OpenWrt-Toolchain-malta-le_gcc-5.3.0_musl-1.1.15.Linux-x86_64.tar.bz2
URL="https://s3.amazonaws.com/rust-lang-ci/libc"
FILE="OpenWrt-Toolchain-malta-le_gcc-5.3.0_musl-1.1.15.Linux-x86_64.tar.bz2"
curl -L "$URL/$FILE" | tar xjf - -C /usr/local/mipsel-linux-musl --strip-components=2

for file in /usr/local/mipsel-linux-musl/bin/mipsel-openwrt-linux-*; do
ln -s $file /usr/local/bin/`basename $file`
done
1 change: 1 addition & 0 deletions src/doc/unstable-book/src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@
- [io](library-features/io.md)
- [ip](library-features/ip.md)
- [iter_rfind](library-features/iter-rfind.md)
- [iterator_step_by](library-features/iterator-step-by.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)
Expand Down
4 changes: 2 additions & 2 deletions src/doc/unstable-book/src/library-features/step-trait.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# `step_trait`

The tracking issue for this feature is: [#27741]
The tracking issue for this feature is: [#42168]

[#27741]: https://github.com/rust-lang/rust/issues/27741
[#42168]: https://github.com/rust-lang/rust/issues/42168

------------------------
2 changes: 1 addition & 1 deletion src/libcollections/str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1018,7 +1018,7 @@ impl str {
///
/// ```
/// let x = "(///)".to_string();
/// let d: Vec<_> = x.split('/').collect();;
/// let d: Vec<_> = x.split('/').collect();
///
/// assert_eq!(d, &["(", "", "", ")"]);
/// ```
Expand Down
27 changes: 21 additions & 6 deletions src/libcore/iter/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ pub use self::iterator::Iterator;

#[unstable(feature = "step_trait",
reason = "likely to be replaced by finer-grained traits",
issue = "27741")]
issue = "42168")]
pub use self::range::Step;
#[unstable(feature = "step_by", reason = "recent addition",
issue = "27741")]
Expand Down Expand Up @@ -520,7 +520,7 @@ impl<I> Iterator for Cycle<I> where I: Clone + Iterator {
#[unstable(feature = "fused", issue = "35602")]
impl<I> FusedIterator for Cycle<I> where I: Clone + Iterator {}

/// An iterator that steps by n elements every iteration.
/// An adapter for stepping iterators by a custom amount.
///
/// This `struct` is created by the [`step_by`] method on [`Iterator`]. See
/// its documentation for more.
Expand Down Expand Up @@ -553,8 +553,27 @@ impl<I> Iterator for StepBy<I> where I: Iterator {
self.iter.nth(self.step)
}
}

#[inline]
fn size_hint(&self) -> (usize, Option<usize>) {
let inner_hint = self.iter.size_hint();

if self.first_take {
let f = |n| if n == 0 { 0 } else { 1 + (n-1)/(self.step+1) };
(f(inner_hint.0), inner_hint.1.map(f))
} else {
let f = |n| n / (self.step+1);
(f(inner_hint.0), inner_hint.1.map(f))
}
}
}

// StepBy can only make the iterator shorter, so the len will still fit.
#[unstable(feature = "iterator_step_by",
reason = "unstable replacement of Range::step_by",
issue = "27741")]
impl<I> ExactSizeIterator for StepBy<I> where I: ExactSizeIterator {}

/// An iterator that strings two iterators together.
///
/// This `struct` is created by the [`chain`] method on [`Iterator`]. See its
Expand Down Expand Up @@ -1813,10 +1832,6 @@ impl<B, I, St, F> Iterator for Scan<I, St, F> where
}
}

#[unstable(feature = "fused", issue = "35602")]
impl<B, I, St, F> FusedIterator for Scan<I, St, F>
where I: FusedIterator, F: FnMut(&mut St, I::Item) -> Option<B> {}

/// An iterator that maps each element to an iterator, and yields the elements
/// of the produced iterators.
///
Expand Down
8 changes: 4 additions & 4 deletions src/libcore/iter/range.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use super::{FusedIterator, TrustedLen};
/// two `Step` objects.
#[unstable(feature = "step_trait",
reason = "likely to be replaced by finer-grained traits",
issue = "27741")]
issue = "42168")]
pub trait Step: PartialOrd + Sized {
/// Steps `self` if possible.
fn step(&self, by: &Self) -> Option<Self>;
Expand Down Expand Up @@ -55,7 +55,7 @@ macro_rules! step_impl_unsigned {
($($t:ty)*) => ($(
#[unstable(feature = "step_trait",
reason = "likely to be replaced by finer-grained traits",
issue = "27741")]
issue = "42168")]
impl Step for $t {
#[inline]
fn step(&self, by: &$t) -> Option<$t> {
Expand Down Expand Up @@ -115,7 +115,7 @@ macro_rules! step_impl_signed {
($($t:ty)*) => ($(
#[unstable(feature = "step_trait",
reason = "likely to be replaced by finer-grained traits",
issue = "27741")]
issue = "42168")]
impl Step for $t {
#[inline]
fn step(&self, by: &$t) -> Option<$t> {
Expand Down Expand Up @@ -187,7 +187,7 @@ macro_rules! step_impl_no_between {
($($t:ty)*) => ($(
#[unstable(feature = "step_trait",
reason = "likely to be replaced by finer-grained traits",
issue = "27741")]
issue = "42168")]
impl Step for $t {
#[inline]
fn step(&self, by: &$t) -> Option<$t> {
Expand Down
73 changes: 73 additions & 0 deletions src/libcore/tests/iter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,79 @@ fn test_iterator_step_by_zero() {
it.next();
}

#[test]
fn test_iterator_step_by_size_hint() {
struct StubSizeHint(usize, Option<usize>);
impl Iterator for StubSizeHint {
type Item = ();
fn next(&mut self) -> Option<()> {
self.0 -= 1;
if let Some(ref mut upper) = self.1 {
*upper -= 1;
}
Some(())
}
fn size_hint(&self) -> (usize, Option<usize>) {
(self.0, self.1)
}
}

// The two checks in each case are needed because the logic
// is different before the first call to `next()`.

let mut it = StubSizeHint(10, Some(10)).step_by(1);
assert_eq!(it.size_hint(), (10, Some(10)));
it.next();
assert_eq!(it.size_hint(), (9, Some(9)));

// exact multiple
let mut it = StubSizeHint(10, Some(10)).step_by(3);
assert_eq!(it.size_hint(), (4, Some(4)));
it.next();
assert_eq!(it.size_hint(), (3, Some(3)));

// larger base range, but not enough to get another element
let mut it = StubSizeHint(12, Some(12)).step_by(3);
assert_eq!(it.size_hint(), (4, Some(4)));
it.next();
assert_eq!(it.size_hint(), (3, Some(3)));

// smaller base range, so fewer resulting elements
let mut it = StubSizeHint(9, Some(9)).step_by(3);
assert_eq!(it.size_hint(), (3, Some(3)));
it.next();
assert_eq!(it.size_hint(), (2, Some(2)));

// infinite upper bound
let mut it = StubSizeHint(usize::MAX, None).step_by(1);
assert_eq!(it.size_hint(), (usize::MAX, None));
it.next();
assert_eq!(it.size_hint(), (usize::MAX-1, None));

// still infinite with larger step
let mut it = StubSizeHint(7, None).step_by(3);
assert_eq!(it.size_hint(), (3, None));
it.next();
assert_eq!(it.size_hint(), (2, None));

// propagates ExactSizeIterator
let a = [1,2,3,4,5];
let it = a.iter().step_by(2);
assert_eq!(it.len(), 3);

// Cannot be TrustedLen as a step greater than one makes an iterator
// with (usize::MAX, None) no longer meet the safety requirements
trait TrustedLenCheck { fn test(self) -> bool; }
impl<T:Iterator> TrustedLenCheck for T {
default fn test(self) -> bool { false }
}
impl<T:TrustedLen> TrustedLenCheck for T {
fn test(self) -> bool { true }
}
assert!(TrustedLenCheck::test(a.iter()));
assert!(!TrustedLenCheck::test(a.iter().step_by(1)));
}

#[test]
fn test_filter_map() {
let it = (0..).step_by(1).take(10)
Expand Down
2 changes: 2 additions & 0 deletions src/libcore/tests/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,11 @@
#![feature(slice_patterns)]
#![feature(sort_internals)]
#![feature(sort_unstable)]
#![feature(specialization)]
#![feature(step_by)]
#![feature(step_trait)]
#![feature(test)]
#![feature(trusted_len)]
#![feature(try_from)]
#![feature(unicode)]
#![feature(unique)]
Expand Down
2 changes: 0 additions & 2 deletions src/librustc/dep_graph/dep_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,6 @@ pub enum DepNode<D: Clone + Debug> {
IsMirAvailable(D),
ItemAttrs(D),
FnArgNames(D),
FileMap(D, Arc<String>),
}

impl<D: Clone + Debug> DepNode<D> {
Expand Down Expand Up @@ -307,7 +306,6 @@ impl<D: Clone + Debug> DepNode<D> {
ConstIsRvaluePromotableToStatic(ref d) => op(d).map(ConstIsRvaluePromotableToStatic),
IsMirAvailable(ref d) => op(d).map(IsMirAvailable),
GlobalMetaData(ref d, kind) => op(d).map(|d| GlobalMetaData(d, kind)),
FileMap(ref d, ref file_name) => op(d).map(|d| FileMap(d, file_name.clone())),
}
}
}
Expand Down
Loading