From c2ce55550606bcdaf267f039d63a9a7c8823e1c4 Mon Sep 17 00:00:00 2001 From: Aaron Power Date: Fri, 3 Aug 2018 16:07:03 +0100 Subject: [PATCH 1/9] Updated RELEASES.md for 1.29.0 --- RELEASES.md | 77 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) diff --git a/RELEASES.md b/RELEASES.md index 2c7557b058212..53de71a8491bc 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -1,3 +1,80 @@ +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 ignore the target triple specified in a project + directory's `.cargo/config`.][cargo/5606] +- [`cargo-install` will now allow you to cross compile an install + using `--target`][cargo/5614] +- [Added the `cargo-fix` to automatically move project code from 2015 edition + to 2018.][cargo/5723] + +Misc +---- +- [`rustdoc` now has the `--cap-lints` which allows you to set what level of + lint will cause and compilation failure.][52354] +- [`rustc` and `rustdoc` will now have the exit code of one if compilation + fails, and 101 if there is a panic.][52197] + +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 it's 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/ +[50494]: https://github.com/rust-lang/rust/pull/50494/ +[cargo/5606]: https://github.com/rust-lang/cargo/pull/5606/ +[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/sync/struct.Rc.html#method.downcast + + Version 1.28.0 (2018-08-02) =========================== From 3180b217d12814c75832bb625b96d80df7705da1 Mon Sep 17 00:00:00 2001 From: Aaron Power Date: Fri, 3 Aug 2018 18:27:25 +0100 Subject: [PATCH 2/9] Update RELEASES.md --- RELEASES.md | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/RELEASES.md b/RELEASES.md index 53de71a8491bc..121d8c72c8abe 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -29,23 +29,22 @@ Cargo `--locked` to disable this behaviour. - [`cargo-install` will now ignore the target triple specified in a project directory's `.cargo/config`.][cargo/5606] -- [`cargo-install` will now allow you to cross compile an install - using `--target`][cargo/5614] -- [Added the `cargo-fix` to automatically move project code from 2015 edition - to 2018.][cargo/5723] +- [Added the `cargo-fix` subcommand to automatically move project code from + 2015 edition to 2018.][cargo/5723] Misc ---- -- [`rustdoc` now has the `--cap-lints` which allows you to set what level of - lint will cause and compilation failure.][52354] -- [`rustc` and `rustdoc` will now have the exit code of one if compilation - fails, and 101 if there is a panic.][52197] +- [`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] 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 it's unintuitive behaviour.][51656] +- [`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] @@ -67,7 +66,6 @@ Compatibility Notes [51178]: https://github.com/rust-lang/rust/pull/51178/ [50494]: https://github.com/rust-lang/rust/pull/50494/ [cargo/5606]: https://github.com/rust-lang/cargo/pull/5606/ -[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 From 9d1c7b8c10b6682ad36157ebd006e59663b3fb48 Mon Sep 17 00:00:00 2001 From: Aaron Power Date: Fri, 3 Aug 2018 18:56:54 +0100 Subject: [PATCH 3/9] Update RELEASES.md --- RELEASES.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/RELEASES.md b/RELEASES.md index 121d8c72c8abe..52cd5a67bed82 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -27,8 +27,8 @@ Cargo ----- - [Cargo can silently fix some bad lockfiles ][cargo/5831] You can use `--locked` to disable this behaviour. -- [`cargo-install` will now ignore the target triple specified in a project - directory's `.cargo/config`.][cargo/5606] +- [`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] @@ -65,7 +65,7 @@ Compatibility Notes [51656]: https://github.com/rust-lang/rust/pull/51656/ [51178]: https://github.com/rust-lang/rust/pull/51178/ [50494]: https://github.com/rust-lang/rust/pull/50494/ -[cargo/5606]: https://github.com/rust-lang/cargo/pull/5606/ +[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 From 888ed73f22af7c7a8b4804739c91c1896723b3db Mon Sep 17 00:00:00 2001 From: Aaron Power Date: Fri, 3 Aug 2018 20:54:07 +0100 Subject: [PATCH 4/9] Update RELEASES.md --- RELEASES.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RELEASES.md b/RELEASES.md index 52cd5a67bed82..bc6cd4ac74662 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -70,7 +70,7 @@ Compatibility Notes [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/sync/struct.Rc.html#method.downcast +[`Rc::downcast`]: https://doc.rust-lang.org/std/rc/struct.Rc.html#method.downcast Version 1.28.0 (2018-08-02) From 0e31372a3f40f689e14293c0debbe9e53c26b40b Mon Sep 17 00:00:00 2001 From: Aaron Power Date: Wed, 22 Aug 2018 09:18:34 +0100 Subject: [PATCH 5/9] Update RELEASES.md --- RELEASES.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/RELEASES.md b/RELEASES.md index bc6cd4ac74662..87c2308f22c59 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -39,6 +39,8 @@ Misc 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] +- [Added a preview of clippy has been made available through rustup][51122] + Install with `rustup component add clippy-preview` Compatibility Notes ------------------- @@ -64,6 +66,7 @@ Compatibility Notes [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/ From 7f6c2a4d71a6de0db77df6fb596b7bbcb9761929 Mon Sep 17 00:00:00 2001 From: Aaron Power Date: Wed, 22 Aug 2018 21:18:31 +0100 Subject: [PATCH 6/9] Update RELEASES.md --- RELEASES.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/RELEASES.md b/RELEASES.md index 87c2308f22c59..82472df727a07 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -39,8 +39,8 @@ Misc 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] -- [Added a preview of clippy has been made available through rustup][51122] - Install with `rustup component add clippy-preview` +- [A preview of clippy has been made available through rustup.][51122] + You can install the preview with `rustup component add clippy-preview` Compatibility Notes ------------------- From 860317e307815cf17b3305fc135854e503b63b52 Mon Sep 17 00:00:00 2001 From: "Felix S. Klock II" Date: Sat, 4 Aug 2018 00:12:02 +0200 Subject: [PATCH 7/9] An attempt to fix NLL migration mode so that reports region errors when necessary. Namely, the code here was trying to be clever, and say "lets not report diagnostics when we 'know' NLL will report an error about them in the future." The problem is that in migration mode, when no error was reported here, the NLL error that we "knew" was coming was downgraded to a warning (!). This fixes that by only doing the "clever" skipping of region error reporting when we are not in migration mode. Rather than make a separate test for issue 53026, I just took the test that uncovered this in a first place, and extended it (via our revisions system) to explicitly show all three modes in action: ACT-borrowck, NLL, and NLL migration mode. (Tto be honest I hope not to have to add such revisions to many tests. Instead I hope to adopt some sort of new `compare-mode` for either borrowck=migrate or for the 2018 edition as a whole.) --- src/librustc/infer/error_reporting/mod.rs | 9 ++++++- ...ue-45983.stderr => issue-45983.ast.stderr} | 2 +- .../ui/borrowck/issue-45983.migrate.stderr | 12 +++++++++ src/test/ui/borrowck/issue-45983.nll.stderr | 6 ++--- src/test/ui/borrowck/issue-45983.rs | 25 ++++++++++++++++++- 5 files changed, 48 insertions(+), 6 deletions(-) rename src/test/ui/borrowck/{issue-45983.stderr => issue-45983.ast.stderr} (92%) create mode 100644 src/test/ui/borrowck/issue-45983.migrate.stderr 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/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 } From 8f42e866887d4ed1c447ce0aac0472727a3ebb96 Mon Sep 17 00:00:00 2001 From: Oliver Schneider Date: Tue, 7 Aug 2018 18:37:50 +0200 Subject: [PATCH 8/9] Remove an overly pedantic and wrong assertion --- src/librustc_mir/transform/const_prop.rs | 5 ----- src/test/ui/const-eval/issue-53157.rs | 23 +++++++++++++++++++++++ 2 files changed, 23 insertions(+), 5 deletions(-) create mode 100644 src/test/ui/const-eval/issue-53157.rs 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/const-eval/issue-53157.rs b/src/test/ui/const-eval/issue-53157.rs new file mode 100644 index 0000000000000..8beccd6c80b68 --- /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()); +} \ No newline at end of file From d1006d8f28f39f06d67bd5a5a1384b1e127dd870 Mon Sep 17 00:00:00 2001 From: Oliver Schneider Date: Tue, 7 Aug 2018 19:51:38 +0200 Subject: [PATCH 9/9] Fix tidy --- src/test/ui/const-eval/issue-53157.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/ui/const-eval/issue-53157.rs b/src/test/ui/const-eval/issue-53157.rs index 8beccd6c80b68..900847767e1ba 100644 --- a/src/test/ui/const-eval/issue-53157.rs +++ b/src/test/ui/const-eval/issue-53157.rs @@ -20,4 +20,4 @@ macro_rules! m { fn main() { fn f() -> impl Sized {}; m!()(f()); -} \ No newline at end of file +}