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 19 pull requests #50608

Closed
wants to merge 52 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
265bc31
added missing implementation hint
rizakrko Apr 22, 2018
221b7ca
Remove usages of Term::as_str and mark it for removal
Zoxc Apr 9, 2018
b0fcb5f
Extend tests for RFC1598 (GAT)
gavento Mar 27, 2018
e09d9ec
Tidy up the code
gavento Mar 27, 2018
a66a011
Fix test stderr after tidying the source
gavento Mar 28, 2018
0617b92
Add tests for GAT parameter number and kindness
gavento Mar 28, 2018
571337b
Update tests with Nikos comments
gavento Apr 11, 2018
a43171a
Update tests to use compile-pass
gavento May 2, 2018
9073c89
Minor fromatting for RFC 1598 tests
gavento May 2, 2018
000d3c9
Make DepGraph::previous_work_products immutable
wesleywiser May 8, 2018
ea49428
Don't use Lock for heavily accessed CrateMetadata::cnum_map.
michaelwoerister May 8, 2018
868d2a1
Fix comment
wesleywiser May 8, 2018
ecedf44
unary op filter, dereference hint
rizakrko May 8, 2018
5128aff
Fix update-references for tests within subdirectories.
ehuss May 4, 2018
127d243
[wip] fixed some error, added missing test
rizakrko May 9, 2018
31d2012
Adapt some method visibilities in librustc_metadata::cstore.
michaelwoerister May 8, 2018
fa8ac4a
fixed double ref hint
rizakrko May 9, 2018
77c40f8
Inline `Span` methods.
nnethercote May 9, 2018
78262e7
Use SmallVec for DepNodeIndex within dep_graph.
nnethercote May 9, 2018
0ba1c10
Clarify in the docs that `mul_add` is not always faster.
frewsxcv May 9, 2018
b8b957d
Make CrateNum allocation more thread-safe.
michaelwoerister May 8, 2018
a981089
Allow for specifying a linker plugin for cross-language LTO
michaelwoerister Apr 25, 2018
23aa483
add fn `into_inner(self) -> (Idx, Idx)` to RangeInclusive (#49022)
May 9, 2018
254b601
std: Avoid `ptr::copy` if unnecessary in `vec::Drain`
alexcrichton May 9, 2018
050cb1c
Don't require clippy/miri for beta
oli-obk May 9, 2018
b817403
Document the checktools script
oli-obk May 9, 2018
4537025
Add comment about first element in CStore::metas.
michaelwoerister May 9, 2018
8010604
move See also links to top
ExpHP May 9, 2018
b8eb91a
make std::str link into See also link
ExpHP May 9, 2018
9c4e5b3
Restore RawVec::reserve* documentation
glandium May 10, 2018
ae3feff
Remove unnecessary mutable borrow and resizing
whitfin May 10, 2018
7def3f0
Retry when downloading the Docker cache.
kennytm May 10, 2018
12446dd
Pull in a wasm fix from LLVM upstream
alexcrichton May 7, 2018
cdfd283
Rollup merge of #49423 - gavento:gavento-dev, r=nikomatsakis
alexcrichton May 10, 2018
54018b1
Rollup merge of #49823 - Zoxc:term-str, r=alexcrichton
alexcrichton May 10, 2018
9179672
Rollup merge of #50161 - rizakrko:impl_note, r=estebank
alexcrichton May 10, 2018
6ef0b28
Rollup merge of #50447 - ehuss:fix-update-references, r=alexcrichton
alexcrichton May 10, 2018
a9d4683
Rollup merge of #50514 - alexcrichton:update-llvm, r=kennytm
alexcrichton May 10, 2018
072bfa6
Rollup merge of #50524 - wesleywiser:immutable_prev_work_products, r=…
alexcrichton May 10, 2018
8982c67
Rollup merge of #50532 - michaelwoerister:lockless-cnum-map, r=Zoxc
alexcrichton May 10, 2018
d8c8a1b
Rollup merge of #50538 - michaelwoerister:atomic-cnums, r=Zoxc
alexcrichton May 10, 2018
d709eff
Rollup merge of #50564 - nnethercote:inline-Span-methods, r=petrochenkov
alexcrichton May 10, 2018
681f2f8
Rollup merge of #50565 - nnethercote:try_mark_green, r=michaelwoerister
alexcrichton May 10, 2018
932029e
Rollup merge of #50569 - michaelwoerister:cross-lang-lto-2, r=alexcri…
alexcrichton May 10, 2018
6a1380c
Rollup merge of #50572 - frewsxcv:frewsxcv-fma, r=sfackler
alexcrichton May 10, 2018
1eb617c
Rollup merge of #50573 - oli-obk:tool_sanity, r=kennytm
alexcrichton May 10, 2018
0989adf
Rollup merge of #50574 - s3bk:range_inclusive_into_inner, r=SimonSapin
alexcrichton May 10, 2018
10c986e
Rollup merge of #50575 - alexcrichton:faster-drain-drop, r=sfackler
alexcrichton May 10, 2018
677ed48
Rollup merge of #50588 - ExpHP:i-can-see-my-house-from-here, r=frewsxcv
alexcrichton May 10, 2018
ce2fd97
Rollup merge of #50591 - glandium:cleanup, r=dtolnay
alexcrichton May 10, 2018
ae4104b
Rollup merge of #50598 - whitfin:unnecessary-mut-borrow, r=michaelwoe…
alexcrichton May 10, 2018
bc516e1
Rollup merge of #50606 - kennytm:retry-docker-cache, r=alexcrichton
alexcrichton May 10, 2018
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
4 changes: 3 additions & 1 deletion src/ci/docker/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,10 @@ if [ -f "$docker_dir/$image/Dockerfile" ]; then
s3url="s3://$SCCACHE_BUCKET/docker/$cksum"
url="https://s3-us-west-1.amazonaws.com/$SCCACHE_BUCKET/docker/$cksum"
echo "Attempting to download $s3url"
rm -f /tmp/rustci_docker_cache
set +e
loaded_images=$(curl $url | docker load | sed 's/.* sha/sha/')
retry curl -f -L -C - -o /tmp/rustci_docker_cache "$url"
loaded_images=$(docker load -i /tmp/rustci_docker_cache | sed 's/.* sha/sha/')
set -e
echo "Downloaded containers:\n$loaded_images"
fi
Expand Down
44 changes: 33 additions & 11 deletions src/ci/docker/x86_64-gnu-tools/checktools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ SIX_WEEK_CYCLE="$(( ($(date +%s) / 604800 - 3) % 6 ))"

touch "$TOOLSTATE_FILE"

# Try to test all the tools and store the build/test success in the TOOLSTATE_FILE

set +e
python2.7 "$X_PY" test --no-fail-fast \
src/doc/book \
Expand All @@ -38,6 +40,7 @@ set -e
cat "$TOOLSTATE_FILE"
echo

# This function checks that if a tool's submodule changed, the tool's state must improve
verify_status() {
echo "Verifying status of $1..."
if echo "$CHANGED_FILES" | grep -q "^M[[:blank:]]$2$"; then
Expand All @@ -57,17 +60,36 @@ verify_status() {
fi
}

# deduplicates the submodule check and the assertion that on beta some tools MUST be passing
check_dispatch() {
if [ "$1" = submodule_changed ]; then
# ignore $2 (branch id)
verify_status $3 $4
elif [ "$2" = beta ]; then
echo "Requiring test passing for $3..."
if grep -q '"'"$3"'":"\(test\|build\)-fail"' "$TOOLSTATE_FILE"; then
exit 4
fi
fi
}

# list all tools here
status_check() {
check_dispatch $1 beta book src/doc/book
check_dispatch $1 beta nomicon src/doc/nomicon
check_dispatch $1 beta reference src/doc/reference
check_dispatch $1 beta rust-by-example src/doc/rust-by-example
check_dispatch $1 beta rls src/tool/rls
check_dispatch $1 beta rustfmt src/tool/rustfmt
# these tools are not required for beta to successfully branch
check_dispatch $1 nightly clippy-driver src/tool/clippy
check_dispatch $1 nightly miri src/tool/miri
}

# If this PR is intended to update one of these tools, do not let the build pass
# when they do not test-pass.

verify_status book src/doc/book
verify_status nomicon src/doc/nomicon
verify_status reference src/doc/reference
verify_status rust-by-example src/doc/rust-by-example
verify_status rls src/tool/rls
verify_status rustfmt src/tool/rustfmt
verify_status clippy-driver src/tool/clippy
verify_status miri src/tool/miri
status_check "submodule_changed"

if [ "$RUST_RELEASE_CHANNEL" = nightly -a -n "${TOOLSTATE_REPO_ACCESS_TOKEN+is_set}" ]; then
. "$(dirname $0)/repo.sh"
Expand All @@ -86,6 +108,6 @@ $COMMIT\t$(cat "$TOOLSTATE_FILE")
exit 0
fi

if grep -q fail "$TOOLSTATE_FILE"; then
exit 4
fi
# abort compilation if an important tool doesn't build
# (this code is reachable if not on the nightly channel)
status_check "beta_required"
3 changes: 2 additions & 1 deletion src/ci/shared.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@ function retry {
while true; do
"$@" && break || {
if [[ $n -lt $max ]]; then
sleep $n # don't retry immediately
((n++))
echo "Command failed. Attempt $n/$max:"
else
echo "The command has failed after $n attempts."
exit 1
return 1
fi
}
done
Expand Down
113 changes: 57 additions & 56 deletions src/liballoc/raw_vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -385,26 +385,7 @@ impl<T, A: Alloc> RawVec<T, A> {
}
}

/// Ensures that the buffer contains at least enough space to hold
/// `used_cap + needed_extra_cap` elements. If it doesn't already,
/// will reallocate the minimum possible amount of memory necessary.
/// Generally this will be exactly the amount of memory necessary,
/// but in principle the allocator is free to give back more than
/// we asked for.
///
/// If `used_cap` exceeds `self.cap()`, this may fail to actually allocate
/// the requested space. This is not really unsafe, but the unsafe
/// code *you* write that relies on the behavior of this function may break.
///
/// # Panics
///
/// * Panics if the requested capacity exceeds `usize::MAX` bytes.
/// * Panics on 32-bit platforms if the requested capacity exceeds
/// `isize::MAX` bytes.
///
/// # Aborts
///
/// Aborts on OOM
/// The same as `reserve_exact`, but returns on errors instead of panicking or aborting.
pub fn try_reserve_exact(&mut self, used_cap: usize, needed_extra_cap: usize)
-> Result<(), CollectionAllocErr> {

Expand Down Expand Up @@ -441,6 +422,26 @@ impl<T, A: Alloc> RawVec<T, A> {
}
}

/// Ensures that the buffer contains at least enough space to hold
/// `used_cap + needed_extra_cap` elements. If it doesn't already,
/// will reallocate the minimum possible amount of memory necessary.
/// Generally this will be exactly the amount of memory necessary,
/// but in principle the allocator is free to give back more than
/// we asked for.
///
/// If `used_cap` exceeds `self.cap()`, this may fail to actually allocate
/// the requested space. This is not really unsafe, but the unsafe
/// code *you* write that relies on the behavior of this function may break.
///
/// # Panics
///
/// * Panics if the requested capacity exceeds `usize::MAX` bytes.
/// * Panics on 32-bit platforms if the requested capacity exceeds
/// `isize::MAX` bytes.
///
/// # Aborts
///
/// Aborts on OOM
pub fn reserve_exact(&mut self, used_cap: usize, needed_extra_cap: usize) {
match self.try_reserve_exact(used_cap, needed_extra_cap) {
Err(CapacityOverflow) => capacity_overflow(),
Expand All @@ -463,6 +464,42 @@ impl<T, A: Alloc> RawVec<T, A> {
Ok(cmp::max(double_cap, required_cap))
}

/// The same as `reserve`, but returns on errors instead of panicking or aborting.
pub fn try_reserve(&mut self, used_cap: usize, needed_extra_cap: usize)
-> Result<(), CollectionAllocErr> {
unsafe {
// NOTE: we don't early branch on ZSTs here because we want this
// to actually catch "asking for more than usize::MAX" in that case.
// If we make it past the first branch then we are guaranteed to
// panic.

// Don't actually need any more capacity.
// Wrapping in case they give a bad `used_cap`
if self.cap().wrapping_sub(used_cap) >= needed_extra_cap {
return Ok(());
}

let new_cap = self.amortized_new_size(used_cap, needed_extra_cap)?;
let new_layout = Layout::array::<T>(new_cap).map_err(|_| CapacityOverflow)?;

// FIXME: may crash and burn on over-reserve
alloc_guard(new_layout.size())?;

let res = match self.current_layout() {
Some(layout) => {
debug_assert!(new_layout.align() == layout.align());
self.a.realloc(NonNull::from(self.ptr).as_opaque(), layout, new_layout.size())
}
None => self.a.alloc(new_layout),
};

self.ptr = res?.cast().into();
self.cap = new_cap;

Ok(())
}
}

/// Ensures that the buffer contains at least enough space to hold
/// `used_cap + needed_extra_cap` elements. If it doesn't already have
/// enough capacity, will reallocate enough space plus comfortable slack
Expand Down Expand Up @@ -515,42 +552,6 @@ impl<T, A: Alloc> RawVec<T, A> {
/// # vector.push_all(&[1, 3, 5, 7, 9]);
/// # }
/// ```
pub fn try_reserve(&mut self, used_cap: usize, needed_extra_cap: usize)
-> Result<(), CollectionAllocErr> {
unsafe {
// NOTE: we don't early branch on ZSTs here because we want this
// to actually catch "asking for more than usize::MAX" in that case.
// If we make it past the first branch then we are guaranteed to
// panic.

// Don't actually need any more capacity.
// Wrapping in case they give a bad `used_cap`
if self.cap().wrapping_sub(used_cap) >= needed_extra_cap {
return Ok(());
}

let new_cap = self.amortized_new_size(used_cap, needed_extra_cap)?;
let new_layout = Layout::array::<T>(new_cap).map_err(|_| CapacityOverflow)?;

// FIXME: may crash and burn on over-reserve
alloc_guard(new_layout.size())?;

let res = match self.current_layout() {
Some(layout) => {
debug_assert!(new_layout.align() == layout.align());
self.a.realloc(NonNull::from(self.ptr).as_opaque(), layout, new_layout.size())
}
None => self.a.alloc(new_layout),
};

self.ptr = res?.cast().into();
self.cap = new_cap;

Ok(())
}
}

/// The same as try_reserve, but errors are lowered to a call to oom().
pub fn reserve(&mut self, used_cap: usize, needed_extra_cap: usize) {
match self.try_reserve(used_cap, needed_extra_cap) {
Err(CapacityOverflow) => capacity_overflow(),
Expand Down
4 changes: 2 additions & 2 deletions src/liballoc/slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

//! A dynamically-sized view into a contiguous sequence, `[T]`.
//!
//! *[See also the slice primitive type](../../std/primitive.slice.html).*
//!
//! Slices are a view into a block of memory represented as a pointer and a
//! length.
//!
Expand Down Expand Up @@ -78,8 +80,6 @@
//! * Further methods that return iterators are [`.split`], [`.splitn`],
//! [`.chunks`], [`.windows`] and more.
//!
//! *[See also the slice primitive type](../../std/primitive.slice.html).*
//!
//! [`Clone`]: ../../std/clone/trait.Clone.html
//! [`Eq`]: ../../std/cmp/trait.Eq.html
//! [`Ord`]: ../../std/cmp/trait.Ord.html
Expand Down
4 changes: 2 additions & 2 deletions src/liballoc/str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

//! Unicode string slices.
//!
//! *[See also the `str` primitive type](../../std/primitive.str.html).*
//!
//! The `&str` type is one of the two main string types, the other being `String`.
//! Unlike its `String` counterpart, its contents are borrowed.
//!
Expand All @@ -29,8 +31,6 @@
//! ```
//! let hello_world: &'static str = "Hello, world!";
//! ```
//!
//! *[See also the `str` primitive type](../../std/primitive.str.html).*

#![stable(feature = "rust1", since = "1.0.0")]

Expand Down
8 changes: 5 additions & 3 deletions src/liballoc/vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2533,9 +2533,11 @@ impl<'a, T> Drop for Drain<'a, T> {
// memmove back untouched tail, update to new length
let start = source_vec.len();
let tail = self.tail_start;
let src = source_vec.as_ptr().offset(tail as isize);
let dst = source_vec.as_mut_ptr().offset(start as isize);
ptr::copy(src, dst, self.tail_len);
if tail != start {
let src = source_vec.as_ptr().offset(tail as isize);
let dst = source_vec.as_mut_ptr().offset(start as isize);
ptr::copy(src, dst, self.tail_len);
}
source_vec.set_len(start + self.tail_len);
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/libcore/num/f32.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
//! This module provides constants which are specific to the implementation
//! of the `f32` floating point data type.
//!
//! Mathematically significant numbers are provided in the `consts` sub-module.
//!
//! *[See also the `f32` primitive type](../../std/primitive.f32.html).*
//!
//! Mathematically significant numbers are provided in the `consts` sub-module.

#![stable(feature = "rust1", since = "1.0.0")]

Expand Down
4 changes: 2 additions & 2 deletions src/libcore/num/f64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
//! This module provides constants which are specific to the implementation
//! of the `f64` floating point data type.
//!
//! Mathematically significant numbers are provided in the `consts` sub-module.
//!
//! *[See also the `f64` primitive type](../../std/primitive.f64.html).*
//!
//! Mathematically significant numbers are provided in the `consts` sub-module.

#![stable(feature = "rust1", since = "1.0.0")]

Expand Down
15 changes: 15 additions & 0 deletions src/libcore/ops/range.rs
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,21 @@ impl<Idx> RangeInclusive<Idx> {
pub fn end(&self) -> &Idx {
&self.end
}

/// Destructures the RangeInclusive into (lower bound, upper (inclusive) bound).
///
/// # Examples
///
/// ```
/// #![feature(inclusive_range_methods)]
///
/// assert_eq!((3..=5).into_inner(), (3, 5));
/// ```
#[unstable(feature = "inclusive_range_methods", issue = "49022")]
#[inline]
pub fn into_inner(self) -> (Idx, Idx) {
(self.start, self.end)
}
}

#[stable(feature = "inclusive_range", since = "1.26.0")]
Expand Down
5 changes: 3 additions & 2 deletions src/libproc_macro/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -755,6 +755,7 @@ impl Term {
}
}

// FIXME: Remove this, do not stabilize
/// Get a reference to the interned string.
#[unstable(feature = "proc_macro", issue = "38356")]
pub fn as_str(&self) -> &str {
Expand All @@ -779,7 +780,7 @@ impl Term {
#[unstable(feature = "proc_macro", issue = "38356")]
impl fmt::Display for Term {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
self.as_str().fmt(f)
self.sym.as_str().fmt(f)
}
}

Expand Down Expand Up @@ -1176,7 +1177,7 @@ impl TokenTree {
},
self::TokenTree::Term(tt) => {
let ident = ast::Ident::new(tt.sym, tt.span.0);
let sym_str = tt.sym.as_str();
let sym_str = tt.sym.to_string();
let token = if sym_str.starts_with("'") {
Lifetime(ident)
} else if sym_str.starts_with("r#") {
Expand Down
2 changes: 1 addition & 1 deletion src/libproc_macro/quote.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ impl Quote for Op {

impl Quote for Term {
fn quote(self) -> TokenStream {
quote!(::Term::new((quote self.as_str()), (quote self.span())))
quote!(::Term::new((quote self.sym.as_str()), (quote self.span())))
}
}

Expand Down
Loading