diff --git a/RELEASES.md b/RELEASES.md index 2c7557b058212..82472df727a07 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -1,3 +1,81 @@ +Version 1.29.0 (2018-09-13) +========================== + +Compiler +-------- +- [Bumped minimum LLVM version to 5.0.][51899] +- [Added `powerpc64le-unknown-linux-musl` target.][51619] +- [Added `aarch64-unknown-hermit` and `x86_64-unknown-hermit` targets.][52861] + +Libraries +--------- +- [`Once::call_once` now no longer requires `Once` to be `'static`.][52239] +- [`BuildHasherDefault` now implements `PartialEq` and `Eq`.][52402] +- [`Box`, `Box`, and `Box` now implement `Clone`.][51912] +- [Implemented `PartialEq<&str>` for `OsString` and `PartialEq` + for `&str`.][51178] +- [`Cell` now allows `T` to be unsized.][50494] +- [`SocketAddr` is now stable on Redox.][52656] + +Stabilized APIs +--------------- +- [`Arc::downcast`] +- [`Iterator::flatten`] +- [`Rc::downcast`] + +Cargo +----- +- [Cargo can silently fix some bad lockfiles ][cargo/5831] You can use + `--locked` to disable this behaviour. +- [`cargo-install` will now allow you to cross compile an install + using `--target`][cargo/5614] +- [Added the `cargo-fix` subcommand to automatically move project code from + 2015 edition to 2018.][cargo/5723] + +Misc +---- +- [`rustdoc` now has the `--cap-lints` option which demotes all lints above + the specified level to that level.][52354] For example `--cap-lints warn` + will demote `deny` and `forbid` lints to `warn`. +- [`rustc` and `rustdoc` will now have the exit code of `1` if compilation + fails, and `101` if there is a panic.][52197] +- [A preview of clippy has been made available through rustup.][51122] + You can install the preview with `rustup component add clippy-preview` + +Compatibility Notes +------------------- +- [`str::{slice_unchecked, slice_unchecked_mut}` are now deprecated.][51807] + Use `str::get_unchecked(begin..end)` instead. +- [`std::env::home_dir` is now deprecated for its unintuitive behaviour.][51656] + Consider using the `home_dir` function from + https://crates.io/crates/dirs instead. +- [`rustc` will no longer silently ignore invalid data in target spec.][52330] + +[52861]: https://github.com/rust-lang/rust/pull/52861/ +[52656]: https://github.com/rust-lang/rust/pull/52656/ +[52239]: https://github.com/rust-lang/rust/pull/52239/ +[52330]: https://github.com/rust-lang/rust/pull/52330/ +[52354]: https://github.com/rust-lang/rust/pull/52354/ +[52402]: https://github.com/rust-lang/rust/pull/52402/ +[52103]: https://github.com/rust-lang/rust/pull/52103/ +[52197]: https://github.com/rust-lang/rust/pull/52197/ +[51807]: https://github.com/rust-lang/rust/pull/51807/ +[51899]: https://github.com/rust-lang/rust/pull/51899/ +[51912]: https://github.com/rust-lang/rust/pull/51912/ +[51511]: https://github.com/rust-lang/rust/pull/51511/ +[51619]: https://github.com/rust-lang/rust/pull/51619/ +[51656]: https://github.com/rust-lang/rust/pull/51656/ +[51178]: https://github.com/rust-lang/rust/pull/51178/ +[51122]: https://github.com/rust-lang/rust/pull/51122 +[50494]: https://github.com/rust-lang/rust/pull/50494/ +[cargo/5614]: https://github.com/rust-lang/cargo/pull/5614/ +[cargo/5723]: https://github.com/rust-lang/cargo/pull/5723/ +[cargo/5831]: https://github.com/rust-lang/cargo/pull/5831/ +[`Arc::downcast`]: https://doc.rust-lang.org/std/sync/struct.Arc.html#method.downcast +[`Iterator::flatten`]: https://doc.rust-lang.org/std/iter/trait.Iterator.html#method.flatten +[`Rc::downcast`]: https://doc.rust-lang.org/std/rc/struct.Rc.html#method.downcast + + Version 1.28.0 (2018-08-02) =========================== diff --git a/src/librustc/infer/error_reporting/mod.rs b/src/librustc/infer/error_reporting/mod.rs index 90248e89fa73a..212821cac2e4a 100644 --- a/src/librustc/infer/error_reporting/mod.rs +++ b/src/librustc/infer/error_reporting/mod.rs @@ -303,7 +303,14 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { ) { debug!("report_region_errors(): {} errors to start", errors.len()); - if will_later_be_reported_by_nll && self.tcx.use_mir_borrowck() { + if will_later_be_reported_by_nll && + // FIXME: `use_mir_borrowck` seems wrong here... + self.tcx.use_mir_borrowck() && + // ... this is a band-aid; may be better to explicitly + // match on every borrowck_mode variant to guide decision + // here. + !self.tcx.migrate_borrowck() { + // With `#![feature(nll)]`, we want to present a nice user // experience, so don't even mention the errors from the // AST checker. diff --git a/src/librustc_mir/transform/const_prop.rs b/src/librustc_mir/transform/const_prop.rs index 9902fe98cc011..ab221eb7a92b7 100644 --- a/src/librustc_mir/transform/const_prop.rs +++ b/src/librustc_mir/transform/const_prop.rs @@ -333,11 +333,6 @@ impl<'b, 'a, 'tcx:'b> ConstPropagator<'b, 'a, 'tcx> { ) -> Option> { let span = source_info.span; match *rvalue { - // This branch exists for the sanity type check - Rvalue::Use(Operand::Constant(ref c)) => { - assert_eq!(c.ty, place_layout.ty); - self.eval_constant(c, source_info) - }, Rvalue::Use(ref op) => { self.eval_operand(op, source_info) }, diff --git a/src/test/ui/borrowck/issue-45983.stderr b/src/test/ui/borrowck/issue-45983.ast.stderr similarity index 92% rename from src/test/ui/borrowck/issue-45983.stderr rename to src/test/ui/borrowck/issue-45983.ast.stderr index 7625b9e76186a..db7cedffd8f72 100644 --- a/src/test/ui/borrowck/issue-45983.stderr +++ b/src/test/ui/borrowck/issue-45983.ast.stderr @@ -1,5 +1,5 @@ error: borrowed data cannot be stored outside of its closure - --> $DIR/issue-45983.rs:17:27 + --> $DIR/issue-45983.rs:36:27 | LL | let x = None; | - borrowed data cannot be stored into here... diff --git a/src/test/ui/borrowck/issue-45983.migrate.stderr b/src/test/ui/borrowck/issue-45983.migrate.stderr new file mode 100644 index 0000000000000..db7cedffd8f72 --- /dev/null +++ b/src/test/ui/borrowck/issue-45983.migrate.stderr @@ -0,0 +1,12 @@ +error: borrowed data cannot be stored outside of its closure + --> $DIR/issue-45983.rs:36:27 + | +LL | let x = None; + | - borrowed data cannot be stored into here... +LL | give_any(|y| x = Some(y)); + | --- ^ cannot be stored outside of its closure + | | + | ...because it cannot outlive this closure + +error: aborting due to previous error + diff --git a/src/test/ui/borrowck/issue-45983.nll.stderr b/src/test/ui/borrowck/issue-45983.nll.stderr index 64086cb07917d..9d62c7dba75ff 100644 --- a/src/test/ui/borrowck/issue-45983.nll.stderr +++ b/src/test/ui/borrowck/issue-45983.nll.stderr @@ -1,11 +1,11 @@ warning: not reporting region error due to nll - --> $DIR/issue-45983.rs:17:27 + --> $DIR/issue-45983.rs:36:27 | LL | give_any(|y| x = Some(y)); | ^ error: borrowed data escapes outside of closure - --> $DIR/issue-45983.rs:17:18 + --> $DIR/issue-45983.rs:36:18 | LL | let x = None; | - `x` is declared here, outside of the closure body @@ -15,7 +15,7 @@ LL | give_any(|y| x = Some(y)); | `y` is a reference that is only valid in the closure body error[E0594]: cannot assign to `x`, as it is not declared as mutable - --> $DIR/issue-45983.rs:17:18 + --> $DIR/issue-45983.rs:36:18 | LL | let x = None; | - help: consider changing this to be mutable: `mut x` diff --git a/src/test/ui/borrowck/issue-45983.rs b/src/test/ui/borrowck/issue-45983.rs index a6e5067195f47..bcbe0d1ffc000 100644 --- a/src/test/ui/borrowck/issue-45983.rs +++ b/src/test/ui/borrowck/issue-45983.rs @@ -8,6 +8,25 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +// As documented in Issue #45983, this test is evaluating the quality +// of our diagnostics on erroneous code using higher-ranked closures. +// +// However, as documented on Issue #53026, this test also became a +// prime example of our need to test the NLL migration mode +// *separately* from the existing test suites that focus solely on +// AST-borrwock and NLL. + +// revisions: ast migrate nll + +// Since we are testing nll (and migration) explicitly as a separate +// revisions, dont worry about the --compare-mode=nll on this test. + +// ignore-compare-mode-nll + +//[ast]compile-flags: -Z borrowck=ast +//[migrate]compile-flags: -Z borrowck=migrate -Z two-phase-borrows +//[nll]compile-flags: -Z borrowck=mir -Z two-phase-borrows + fn give_any FnOnce(&'r ())>(f: F) { f(&()); } @@ -15,5 +34,9 @@ fn give_any FnOnce(&'r ())>(f: F) { fn main() { let x = None; give_any(|y| x = Some(y)); - //~^ ERROR borrowed data cannot be stored outside of its closure + //[ast]~^ ERROR borrowed data cannot be stored outside of its closure + //[migrate]~^^ ERROR borrowed data cannot be stored outside of its closure + //[nll]~^^^ WARN not reporting region error due to nll + //[nll]~| ERROR borrowed data escapes outside of closure + //[nll]~| ERROR cannot assign to `x`, as it is not declared as mutable } diff --git a/src/test/ui/const-eval/issue-53157.rs b/src/test/ui/const-eval/issue-53157.rs new file mode 100644 index 0000000000000..900847767e1ba --- /dev/null +++ b/src/test/ui/const-eval/issue-53157.rs @@ -0,0 +1,23 @@ +// 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. + +// compile-pass + +macro_rules! m { + () => {{ + fn f(_: impl Sized) {} + f + }} +} + +fn main() { + fn f() -> impl Sized {}; + m!()(f()); +}