diff --git a/src/libcore/future.rs b/src/libcore/future.rs index a8c8f69411ea6..153cd6c0724d6 100644 --- a/src/libcore/future.rs +++ b/src/libcore/future.rs @@ -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. /// @@ -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, cx: &mut task::Context) -> Poll; } diff --git a/src/libcore/iter/iterator.rs b/src/libcore/iter/iterator.rs index 81150bc037809..8836de3edc874 100644 --- a/src/libcore/iter/iterator.rs +++ b/src/libcore/iter/iterator.rs @@ -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::>(); /// assert_eq!(flattened, &[1, 2, 3, 4, 5, 6]); @@ -1046,8 +1044,6 @@ pub trait Iterator { /// Mapping and then flattening: /// /// ``` - /// #![feature(iterator_flatten)] - /// /// let words = ["alpha", "beta", "gamma"]; /// /// // chars() returns an iterator @@ -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::>(); @@ -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 where Self: Sized, Self::Item: IntoIterator { Flatten { inner: flatten_compat(self) } diff --git a/src/libcore/iter/mod.rs b/src/libcore/iter/mod.rs index c4132270d5923..86b297557dddb 100644 --- a/src/libcore/iter/mod.rs +++ b/src/libcore/iter/mod.rs @@ -2575,13 +2575,13 @@ impl FusedIterator for FlatMap /// [`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 where I::Item: IntoIterator { inner: FlattenCompat::IntoIter>, } -#[unstable(feature = "iterator_flatten", issue = "48213")] +#[stable(feature = "iterator_flatten", since = "1.29")] impl fmt::Debug for Flatten where I: Iterator + fmt::Debug, U: Iterator + fmt::Debug, I::Item: IntoIterator, @@ -2591,7 +2591,7 @@ impl fmt::Debug for Flatten } } -#[unstable(feature = "iterator_flatten", issue = "48213")] +#[stable(feature = "iterator_flatten", since = "1.29")] impl Clone for Flatten where I: Iterator + Clone, U: Iterator + Clone, I::Item: IntoIterator, @@ -2599,7 +2599,7 @@ impl Clone for Flatten fn clone(&self) -> Self { Flatten { inner: self.inner.clone() } } } -#[unstable(feature = "iterator_flatten", issue = "48213")] +#[stable(feature = "iterator_flatten", since = "1.29")] impl Iterator for Flatten where I: Iterator, U: Iterator, I::Item: IntoIterator @@ -2627,7 +2627,7 @@ impl Iterator for Flatten } } -#[unstable(feature = "iterator_flatten", issue = "48213")] +#[stable(feature = "iterator_flatten", since = "1.29")] impl DoubleEndedIterator for Flatten where I: DoubleEndedIterator, U: DoubleEndedIterator, I::Item: IntoIterator @@ -2650,7 +2650,7 @@ impl DoubleEndedIterator for Flatten } } -#[unstable(feature = "iterator_flatten", issue = "48213")] +#[stable(feature = "iterator_flatten", since = "1.29")] impl FusedIterator for Flatten where I: FusedIterator, U: Iterator, I::Item: IntoIterator {} diff --git a/src/libcore/lib.rs b/src/libcore/lib.rs index 40caee855410e..9a210cda4a8e3 100644 --- a/src/libcore/lib.rs +++ b/src/libcore/lib.rs @@ -89,7 +89,6 @@ #![feature(extern_types)] #![feature(fundamental)] #![feature(intrinsics)] -#![feature(iterator_flatten)] #![feature(lang_items)] #![feature(link_llvm_intrinsics)] #![feature(never_type)] diff --git a/src/libcore/tests/lib.rs b/src/libcore/tests/lib.rs index 87612b7e81887..9d4a5213992a1 100644 --- a/src/libcore/tests/lib.rs +++ b/src/libcore/tests/lib.rs @@ -23,7 +23,6 @@ #![feature(flt2dec)] #![feature(fmt_internals)] #![feature(hashmap_internals)] -#![feature(iterator_flatten)] #![feature(pattern)] #![feature(range_is_empty)] #![feature(raw)] diff --git a/src/liblibc b/src/liblibc index a7e78a78e17c8..7cac8d0c9db3e 160000 --- a/src/liblibc +++ b/src/liblibc @@ -1 +1 @@ -Subproject commit a7e78a78e17c8776d7780008ccb3ce541ec64ae9 +Subproject commit 7cac8d0c9db3eff1d8c0d0e21f4a27bedb3c0ad5 diff --git a/src/librustc/middle/weak_lang_items.rs b/src/librustc/middle/weak_lang_items.rs index 1d147eef054f3..180e75df1a66e 100644 --- a/src/librustc/middle/weak_lang_items.rs +++ b/src/librustc/middle/weak_lang_items.rs @@ -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))); + } } )* } diff --git a/src/librustc_data_structures/indexed_set.rs b/src/librustc_data_structures/indexed_set.rs index c9495587c4687..30b87c0390a7e 100644 --- a/src/librustc_data_structures/indexed_set.rs +++ b/src/librustc_data_structures/indexed_set.rs @@ -233,7 +233,9 @@ impl IdxSet { &mut self.bits } - pub fn clone_from(&mut self, other: &IdxSet) { + /// Efficiently overwrite `self` with `other`. Panics if `self` and `other` + /// don't have the same length. + pub fn overwrite(&mut self, other: &IdxSet) { self.words_mut().clone_from_slice(other.words()); } diff --git a/src/librustc_mir/dataflow/at_location.rs b/src/librustc_mir/dataflow/at_location.rs index a89d1afae8637..05453bd58c43d 100644 --- a/src/librustc_mir/dataflow/at_location.rs +++ b/src/librustc_mir/dataflow/at_location.rs @@ -139,7 +139,7 @@ impl FlowsAtLocation for FlowAtLocation 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) { diff --git a/src/librustc_mir/dataflow/mod.rs b/src/librustc_mir/dataflow/mod.rs index 85458c7d68488..98cd9c35d8809 100644 --- a/src/librustc_mir/dataflow/mod.rs +++ b/src/librustc_mir/dataflow/mod.rs @@ -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); } diff --git a/src/librustc_mir/util/liveness.rs b/src/librustc_mir/util/liveness.rs index cfb1a2cd28bcc..34f8141141d26 100644 --- a/src/librustc_mir/util/liveness.rs +++ b/src/librustc_mir/util/liveness.rs @@ -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; } } diff --git a/src/librustc_passes/ast_validation.rs b/src/librustc_passes/ast_validation.rs index 97140d18c0865..ca361be258a10 100644 --- a/src/librustc_passes/ast_validation.rs +++ b/src/librustc_passes/ast_validation.rs @@ -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 \ - ") - .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 \ + " + ); + 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(); } _ => {} } diff --git a/src/librustc_typeck/check/method/suggest.rs b/src/librustc_typeck/check/method/suggest.rs index 35d237d94de82..68c71f4ce90e9 100644 --- a/src/librustc_typeck/check/method/suggest.rs +++ b/src/librustc_typeck/check/method/suggest.rs @@ -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("".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), diff --git a/src/libstd/alloc.rs b/src/libstd/alloc.rs index f28e91e19b73c..f6cecbea11f8d 100644 --- a/src/libstd/alloc.rs +++ b/src/libstd/alloc.rs @@ -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; diff --git a/src/libstd/build.rs b/src/libstd/build.rs index c001e4e8cebf9..9d5aebde62568 100644 --- a/src/libstd/build.rs +++ b/src/libstd/build.rs @@ -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") { @@ -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") { diff --git a/src/libstd/error.rs b/src/libstd/error.rs index 3160485375f6d..1958915602f83 100644 --- a/src/libstd/error.rs +++ b/src/libstd/error.rs @@ -49,6 +49,7 @@ use string; /// /// [`Result`]: ../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 { diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index d767265ead9d4..71ff9e8058ef3 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -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 { diff --git a/src/test/compile-fail/panic-implementation-missing.rs b/src/test/compile-fail/panic-implementation-missing.rs new file mode 100644 index 0000000000000..b11081a3e3bbe --- /dev/null +++ b/src/test/compile-fail/panic-implementation-missing.rs @@ -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 or the MIT license +// , 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() {} diff --git a/src/test/compile-fail/weak-lang-item.rs b/src/test/compile-fail/weak-lang-item.rs index 7b988c3595f5e..42972c40674b6 100644 --- a/src/test/compile-fail/weak-lang-item.rs +++ b/src/test/compile-fail/weak-lang-item.rs @@ -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 diff --git a/src/test/ui/issue-51874.rs b/src/test/ui/issue-51874.rs new file mode 100644 index 0000000000000..63425274d4c49 --- /dev/null +++ b/src/test/ui/issue-51874.rs @@ -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 or the MIT license +// , 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 +} diff --git a/src/test/ui/issue-51874.stderr b/src/test/ui/issue-51874.stderr new file mode 100644 index 0000000000000..8674645357189 --- /dev/null +++ b/src/test/ui/issue-51874.stderr @@ -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`. diff --git a/src/test/ui/suggestions/placement-syntax.rs b/src/test/ui/suggestions/placement-syntax.rs new file mode 100644 index 0000000000000..39252597a23e8 --- /dev/null +++ b/src/test/ui/suggestions/placement-syntax.rs @@ -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 or the MIT license +// , 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"); + } +} diff --git a/src/test/ui/suggestions/placement-syntax.stderr b/src/test/ui/suggestions/placement-syntax.stderr new file mode 100644 index 0000000000000..933ba96519c44 --- /dev/null +++ b/src/test/ui/suggestions/placement-syntax.stderr @@ -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 +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 +