Skip to content

Rollup of 9 pull requests #51948

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 19 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
85796dd
stabilize Iterator::flatten in 1.29, fixes #48115.
Centril Jun 11, 2018
30d825c
Fix doc links
MajorBreakfast Jun 27, 2018
64f8e3b
Update liblibc
est31 Jun 28, 2018
23d59d0
Suggest correct comparison against negative literal
estebank Jun 28, 2018
08683f0
Rename `IdxSet::clone_from`.
nnethercote Jun 28, 2018
d6cf182
Fix inconsequential typo in GlobalAlloc doc example
Ixrec Jun 29, 2018
28c4813
use literal span for concrete type suggestion
euclio Jun 29, 2018
faaf250
improve the error message when `#[panic_implementation]` is missing
japaric Jun 29, 2018
ee52862
update another cfail test
japaric Jun 29, 2018
3265189
Use in-tree libbacktrace on Fuchsia
cramertj Jun 30, 2018
2bccea4
Rollup merge of #51511 - Centril:feature/stabilize_iterator_flatten, …
kennytm Jun 30, 2018
fcacb5e
Rollup merge of #51853 - MajorBreakfast:fix-doc-links, r=cramertj
kennytm Jun 30, 2018
399b404
Rollup merge of #51864 - est31:libc_update, r=alexcrichton
kennytm Jun 30, 2018
1991a9b
Rollup merge of #51869 - nnethercote:rm-clone_from, r=nikomatsakis
kennytm Jun 30, 2018
65ec6c6
Rollup merge of #51883 - estebank:placement-suggestion, r=varkor
kennytm Jun 30, 2018
13f0310
Rollup merge of #51890 - Ixrec:patch-3, r=alexcrichton
kennytm Jun 30, 2018
7d8831e
Rollup merge of #51920 - euclio:concrete-type-suggestion, r=estebank
kennytm Jun 30, 2018
9f3ca33
Rollup merge of #51921 - japaric:panic-impl-error, r=nagisa
kennytm Jun 30, 2018
334ae88
Rollup merge of #51931 - cramertj:rm-libbacktrace, r=alexcrichton
kennytm Jun 30, 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
14 changes: 9 additions & 5 deletions src/libcore/future.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,18 +45,18 @@ pub trait Future {
///
/// This function returns:
///
/// - `Poll::Pending` if the future is not ready yet
/// - `Poll::Ready(val)` with the result `val` of this future if it finished
/// successfully.
/// - [`Poll::Pending`] if the future is not ready yet
/// - [`Poll::Ready(val)`] with the result `val` of this future if it
/// finished successfully.
///
/// Once a future has finished, clients should not `poll` it again.
///
/// When a future is not ready yet, `poll` returns
/// [`Poll::Pending`](::task::Poll). The future will *also* register the
/// `Poll::Pending`. The future will *also* register the
/// interest of the current task in the value being produced. For example,
/// if the future represents the availability of data on a socket, then the
/// task is recorded so that when data arrives, it is woken up (via
/// [`cx.waker()`](::task::Context::waker)). Once a task has been woken up,
/// [`cx.waker()`]). Once a task has been woken up,
/// it should attempt to `poll` the future again, which may or may not
/// produce a final value.
///
Expand Down Expand Up @@ -90,6 +90,10 @@ pub trait Future {
/// then any future calls to `poll` may panic, block forever, or otherwise
/// cause bad behavior. The `Future` trait itself provides no guarantees
/// about the behavior of `poll` after a future has completed.
///
/// [`Poll::Pending`]: ../task/enum.Poll.html#variant.Pending
/// [`Poll::Ready(val)`]: ../task/enum.Poll.html#variant.Ready
/// [`cx.waker()`]: ../task/struct.Context.html#method.waker
fn poll(self: PinMut<Self>, cx: &mut task::Context) -> Poll<Self::Output>;
}

Expand Down
8 changes: 1 addition & 7 deletions src/libcore/iter/iterator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1036,8 +1036,6 @@ pub trait Iterator {
/// Basic usage:
///
/// ```
/// #![feature(iterator_flatten)]
///
/// let data = vec![vec![1, 2, 3, 4], vec![5, 6]];
/// let flattened = data.into_iter().flatten().collect::<Vec<u8>>();
/// assert_eq!(flattened, &[1, 2, 3, 4, 5, 6]);
Expand All @@ -1046,8 +1044,6 @@ pub trait Iterator {
/// Mapping and then flattening:
///
/// ```
/// #![feature(iterator_flatten)]
///
/// let words = ["alpha", "beta", "gamma"];
///
/// // chars() returns an iterator
Expand All @@ -1074,8 +1070,6 @@ pub trait Iterator {
/// Flattening once only removes one level of nesting:
///
/// ```
/// #![feature(iterator_flatten)]
///
/// let d3 = [[[1, 2], [3, 4]], [[5, 6], [7, 8]]];
///
/// let d2 = d3.iter().flatten().collect::<Vec<_>>();
Expand All @@ -1093,7 +1087,7 @@ pub trait Iterator {
///
/// [`flat_map()`]: #method.flat_map
#[inline]
#[unstable(feature = "iterator_flatten", issue = "48213")]
#[stable(feature = "iterator_flatten", since = "1.29")]
fn flatten(self) -> Flatten<Self>
where Self: Sized, Self::Item: IntoIterator {
Flatten { inner: flatten_compat(self) }
Expand Down
12 changes: 6 additions & 6 deletions src/libcore/iter/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2575,13 +2575,13 @@ impl<I, U, F> FusedIterator for FlatMap<I, U, F>
/// [`flatten`]: trait.Iterator.html#method.flatten
/// [`Iterator`]: trait.Iterator.html
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
#[unstable(feature = "iterator_flatten", issue = "48213")]
#[stable(feature = "iterator_flatten", since = "1.29")]
pub struct Flatten<I: Iterator>
where I::Item: IntoIterator {
inner: FlattenCompat<I, <I::Item as IntoIterator>::IntoIter>,
}

#[unstable(feature = "iterator_flatten", issue = "48213")]
#[stable(feature = "iterator_flatten", since = "1.29")]
impl<I, U> fmt::Debug for Flatten<I>
where I: Iterator + fmt::Debug, U: Iterator + fmt::Debug,
I::Item: IntoIterator<IntoIter = U, Item = U::Item>,
Expand All @@ -2591,15 +2591,15 @@ impl<I, U> fmt::Debug for Flatten<I>
}
}

#[unstable(feature = "iterator_flatten", issue = "48213")]
#[stable(feature = "iterator_flatten", since = "1.29")]
impl<I, U> Clone for Flatten<I>
where I: Iterator + Clone, U: Iterator + Clone,
I::Item: IntoIterator<IntoIter = U, Item = U::Item>,
{
fn clone(&self) -> Self { Flatten { inner: self.inner.clone() } }
}

#[unstable(feature = "iterator_flatten", issue = "48213")]
#[stable(feature = "iterator_flatten", since = "1.29")]
impl<I, U> Iterator for Flatten<I>
where I: Iterator, U: Iterator,
I::Item: IntoIterator<IntoIter = U, Item = U::Item>
Expand Down Expand Up @@ -2627,7 +2627,7 @@ impl<I, U> Iterator for Flatten<I>
}
}

#[unstable(feature = "iterator_flatten", issue = "48213")]
#[stable(feature = "iterator_flatten", since = "1.29")]
impl<I, U> DoubleEndedIterator for Flatten<I>
where I: DoubleEndedIterator, U: DoubleEndedIterator,
I::Item: IntoIterator<IntoIter = U, Item = U::Item>
Expand All @@ -2650,7 +2650,7 @@ impl<I, U> DoubleEndedIterator for Flatten<I>
}
}

#[unstable(feature = "iterator_flatten", issue = "48213")]
#[stable(feature = "iterator_flatten", since = "1.29")]
impl<I, U> FusedIterator for Flatten<I>
where I: FusedIterator, U: Iterator,
I::Item: IntoIterator<IntoIter = U, Item = U::Item> {}
Expand Down
1 change: 0 additions & 1 deletion src/libcore/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@
#![feature(extern_types)]
#![feature(fundamental)]
#![feature(intrinsics)]
#![feature(iterator_flatten)]
#![feature(lang_items)]
#![feature(link_llvm_intrinsics)]
#![feature(never_type)]
Expand Down
1 change: 0 additions & 1 deletion src/libcore/tests/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#![feature(flt2dec)]
#![feature(fmt_internals)]
#![feature(hashmap_internals)]
#![feature(iterator_flatten)]
#![feature(pattern)]
#![feature(range_is_empty)]
#![feature(raw)]
Expand Down
2 changes: 1 addition & 1 deletion src/liblibc
Submodule liblibc updated 48 files
+5 −2 .travis.yml
+54 −74 Cargo.lock
+1 −1 Cargo.toml
+21 −21 README.md
+1 −1 ci/linux-sparc64.sh
+3 −1 ci/style.rs
+17 −2 libc-test/build.rs
+63 −5 src/dox.rs
+2 −0 src/fuchsia/mod.rs
+25 −27 src/lib.rs
+34 −0 src/redox/mod.rs
+12 −0 src/redox/net.rs
+33 −2 src/unix/bsd/apple/mod.rs
+2 −0 src/unix/bsd/freebsdlike/freebsd/mod.rs
+24 −4 src/unix/bsd/freebsdlike/mod.rs
+27 −4 src/unix/bsd/netbsdlike/mod.rs
+9 −0 src/unix/bsd/netbsdlike/netbsd/mod.rs
+2 −0 src/unix/bsd/netbsdlike/openbsdlike/bitrig/mod.rs
+3 −0 src/unix/bsd/netbsdlike/openbsdlike/mod.rs
+4 −0 src/unix/bsd/netbsdlike/openbsdlike/openbsd/mod.rs
+27 −4 src/unix/haiku/mod.rs
+15 −0 src/unix/mod.rs
+0 −16 src/unix/notbsd/android/b32/mod.rs
+0 −25 src/unix/notbsd/android/b64/mod.rs
+111 −23 src/unix/notbsd/android/mod.rs
+15 −27 src/unix/notbsd/emscripten.rs
+71 −3 src/unix/notbsd/linux/mips/mips32.rs
+70 −0 src/unix/notbsd/linux/mips/mips64.rs
+21 −20 src/unix/notbsd/linux/mips/mod.rs
+148 −50 src/unix/notbsd/linux/mod.rs
+74 −0 src/unix/notbsd/linux/musl/b32/mod.rs
+0 −62 src/unix/notbsd/linux/musl/b64/mod.rs
+143 −12 src/unix/notbsd/linux/musl/b64/powerpc64.rs
+136 −0 src/unix/notbsd/linux/musl/b64/x86_64.rs
+20 −74 src/unix/notbsd/linux/musl/mod.rs
+71 −0 src/unix/notbsd/linux/other/b32/mod.rs
+43 −0 src/unix/notbsd/linux/other/b64/aarch64.rs
+72 −0 src/unix/notbsd/linux/other/b64/not_x32.rs
+70 −0 src/unix/notbsd/linux/other/b64/powerpc64.rs
+77 −0 src/unix/notbsd/linux/other/b64/sparc64.rs
+42 −0 src/unix/notbsd/linux/other/b64/x32.rs
+4 −0 src/unix/notbsd/linux/other/b64/x86_64.rs
+42 −20 src/unix/notbsd/linux/other/mod.rs
+41 −0 src/unix/notbsd/linux/s390x.rs
+200 −2 src/unix/notbsd/mod.rs
+2 −2 src/unix/solaris/mod.rs
+367 −2 src/unix/uclibc/mips/mips32.rs
+5 −2 src/unix/uclibc/mod.rs
10 changes: 7 additions & 3 deletions src/librustc/middle/weak_lang_items.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,13 @@ fn verify<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
if missing.contains(&lang_items::$item) &&
!whitelisted(tcx, lang_items::$item) &&
items.$name().is_none() {
tcx.sess.err(&format!("language item required, but not found: `{}`",
stringify!($name)));

if lang_items::$item == lang_items::PanicImplLangItem {
tcx.sess.err(&format!("`#[panic_implementation]` function required, \
but not found"));
} else {
tcx.sess.err(&format!("language item required, but not found: `{}`",
stringify!($name)));
}
}
)*
}
Expand Down
4 changes: 3 additions & 1 deletion src/librustc_data_structures/indexed_set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,9 @@ impl<T: Idx> IdxSet<T> {
&mut self.bits
}

pub fn clone_from(&mut self, other: &IdxSet<T>) {
/// Efficiently overwrite `self` with `other`. Panics if `self` and `other`
/// don't have the same length.
pub fn overwrite(&mut self, other: &IdxSet<T>) {
self.words_mut().clone_from_slice(other.words());
}

Expand Down
2 changes: 1 addition & 1 deletion src/librustc_mir/dataflow/at_location.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ impl<BD> FlowsAtLocation for FlowAtLocation<BD>
where BD: BitDenotation
{
fn reset_to_entry_of(&mut self, bb: BasicBlock) {
(*self.curr_state).clone_from(self.base_results.sets().on_entry_set_for(bb.index()));
self.curr_state.overwrite(self.base_results.sets().on_entry_set_for(bb.index()));
}

fn reconstruct_statement_effect(&mut self, loc: Location) {
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_mir/dataflow/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ impl<'b, 'a: 'b, 'tcx: 'a, BD> PropagationContext<'b, 'a, 'tcx, BD> where BD: Bi
{
let sets = builder.flow_state.sets.for_block(bb_idx);
debug_assert!(in_out.words().len() == sets.on_entry.words().len());
in_out.clone_from(sets.on_entry);
in_out.overwrite(sets.on_entry);
in_out.union(sets.gen_set);
in_out.subtract(sets.kill_set);
}
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_mir/util/liveness.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,14 +141,14 @@ pub fn liveness_of_locals<'tcx>(mir: &Mir<'tcx>, mode: LivenessMode) -> Liveness
for &successor in mir.basic_blocks()[b].terminator().successors() {
bits.union(&ins[successor]);
}
outs[b].clone_from(&bits);
outs[b].overwrite(&bits);

// bits = use ∪ (bits - def)
def_use[b].apply(&mut bits);

// update bits on entry and flag if they have changed
if ins[b] != bits {
ins[b].clone_from(&bits);
ins[b].overwrite(&bits);
changed = true;
}
}
Expand Down
27 changes: 21 additions & 6 deletions src/librustc_passes/ast_validation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,12 +172,27 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
ExprKind::InlineAsm(..) if !self.session.target.target.options.allow_asm => {
span_err!(self.session, expr.span, E0472, "asm! is unsupported on this target");
}
ExprKind::ObsoleteInPlace(..) => {
self.err_handler()
.struct_span_err(expr.span, "emplacement syntax is obsolete (for now, anyway)")
.note("for more information, see \
<https://github.com/rust-lang/rust/issues/27779#issuecomment-378416911>")
.emit();
ExprKind::ObsoleteInPlace(ref place, ref val) => {
let mut err = self.err_handler().struct_span_err(
expr.span,
"emplacement syntax is obsolete (for now, anyway)",
);
err.note(
"for more information, see \
<https://github.com/rust-lang/rust/issues/27779#issuecomment-378416911>"
);
match val.node {
ExprKind::Lit(ref v) if v.node.is_numeric() => {
err.span_suggestion(
place.span.between(val.span),
"if you meant to write a comparison against a negative value, add a \
space in between `<` and `-`",
"< -".to_string(),
);
}
_ => {}
}
err.emit();
}
_ => {}
}
Expand Down
7 changes: 3 additions & 4 deletions src/librustc_typeck/check/method/suggest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -245,12 +245,11 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
"f32"
};
match expr.node {
hir::ExprLit(_) => { // numeric literal
let snippet = tcx.sess.codemap().span_to_snippet(expr.span)
hir::ExprLit(ref lit) => { // numeric literal
let snippet = tcx.sess.codemap().span_to_snippet(lit.span)
.unwrap_or("<numeric literal>".to_string());
// FIXME: use the literal for missing snippet

err.span_suggestion(expr.span,
err.span_suggestion(lit.span,
&format!("you must specify a concrete type for \
this numeric value, like `{}`",
concrete_type),
Expand Down
2 changes: 1 addition & 1 deletion src/libstd/alloc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
//! ```rust,ignore (demonstrates crates.io usage)
//! extern crate jemallocator;
//!
//! use jemallacator::Jemalloc;
//! use jemallocator::Jemalloc;
//!
//! #[global_allocator]
//! static GLOBAL: Jemalloc = Jemalloc;
Expand Down
5 changes: 0 additions & 5 deletions src/libstd/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ fn main() {
if cfg!(feature = "backtrace") &&
!target.contains("cloudabi") &&
!target.contains("emscripten") &&
!target.contains("fuchsia") &&
!target.contains("msvc") &&
!target.contains("wasm32")
{
Expand Down Expand Up @@ -68,10 +67,6 @@ fn main() {
println!("cargo:rustc-link-lib=userenv");
println!("cargo:rustc-link-lib=shell32");
} else if target.contains("fuchsia") {
// use system-provided libbacktrace
if cfg!(feature = "backtrace") {
println!("cargo:rustc-link-lib=backtrace");
}
println!("cargo:rustc-link-lib=zircon");
println!("cargo:rustc-link-lib=fdio");
} else if target.contains("cloudabi") {
Expand Down
1 change: 1 addition & 0 deletions src/libstd/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ use string;
///
/// [`Result<T, E>`]: ../result/enum.Result.html
/// [`Display`]: ../fmt/trait.Display.html
/// [`Debug`]: ../fmt/trait.Debug.html
/// [`cause`]: trait.Error.html#method.cause
#[stable(feature = "rust1", since = "1.0.0")]
pub trait Error: Debug + Display {
Expand Down
10 changes: 10 additions & 0 deletions src/libsyntax/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1298,6 +1298,16 @@ impl LitKind {
}
}

/// Returns true if this is a numeric literal.
pub fn is_numeric(&self) -> bool {
match *self {
LitKind::Int(..) |
LitKind::Float(..) |
LitKind::FloatUnsuffixed(..) => true,
_ => false,
}
}

/// Returns true if this literal has no suffix. Note: this will return true
/// for literals with prefixes such as raw strings and byte strings.
pub fn is_unsuffixed(&self) -> bool {
Expand Down
18 changes: 18 additions & 0 deletions src/test/compile-fail/panic-implementation-missing.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Copyright 2018 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.

// error-pattern: `#[panic_implementation]` function required, but not found

#![feature(lang_items)]
#![no_main]
#![no_std]

#[lang = "eh_personality"]
fn eh() {}
2 changes: 1 addition & 1 deletion src/test/compile-fail/weak-lang-item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
// except according to those terms.

// aux-build:weak-lang-items.rs
// error-pattern: language item required, but not found: `panic_impl`
// error-pattern: `#[panic_implementation]` function required, but not found
// error-pattern: language item required, but not found: `eh_personality`
// ignore-wasm32-bare compiled with panic=abort, personality not required

Expand Down
13 changes: 13 additions & 0 deletions src/test/ui/issue-51874.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// Copyright 2018 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.

fn main() {
let a = (1.0).pow(1.0); //~ ERROR can't call method `pow` on ambiguous numeric type
}
13 changes: 13 additions & 0 deletions src/test/ui/issue-51874.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
error[E0689]: can't call method `pow` on ambiguous numeric type `{float}`
--> $DIR/issue-51874.rs:12:19
|
LL | let a = (1.0).pow(1.0); //~ ERROR can't call method `pow` on ambiguous numeric type
| ^^^
help: you must specify a concrete type for this numeric value, like `f32`
|
LL | let a = (1.0_f32).pow(1.0); //~ ERROR can't call method `pow` on ambiguous numeric type
| ^^^^^^^

error: aborting due to previous error

For more information about this error, try `rustc --explain E0689`.
17 changes: 17 additions & 0 deletions src/test/ui/suggestions/placement-syntax.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Copyright 2018 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.

fn main() {
let x = -5;
if x<-1 {
//~^ ERROR emplacement syntax is obsolete
println!("ok");
}
}
14 changes: 14 additions & 0 deletions src/test/ui/suggestions/placement-syntax.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
error: emplacement syntax is obsolete (for now, anyway)
--> $DIR/placement-syntax.rs:13:8
|
LL | if x<-1 {
| ^^^^
|
= note: for more information, see <https://github.com/rust-lang/rust/issues/27779#issuecomment-378416911>
help: if you meant to write a comparison against a negative value, add a space in between `<` and `-`
|
LL | if x< -1 {
| ^^^

error: aborting due to previous error