diff options
| author | bors <bors@rust-lang.org> | 2018-10-30 11:38:31 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2018-10-30 11:38:31 +0000 |
| commit | e8aef7cae14bc7a56859408c90253e9bcc07fcff (patch) | |
| tree | 01369c637678ec513ba6f874aa1e05ce8e88dbbb /src/test | |
| parent | b1ca3907e00211b2f645133af3574ca22e4f4f4d (diff) | |
| parent | c16ff6e7e86e01d7e5408d28f40a255546f37c6e (diff) | |
| download | rust-e8aef7cae14bc7a56859408c90253e9bcc07fcff.tar.gz rust-e8aef7cae14bc7a56859408c90253e9bcc07fcff.zip | |
Auto merge of #55502 - kennytm:rollup, r=kennytm
Rollup of 12 pull requests
Successful merges:
- #54885 (Don't lint 'unused_parens` on `if (break _) { .. }`)
- #55205 (Improve a few cases of collecting to an FxHash(Map/Set))
- #55450 (msp430: remove the whole Atomic* API)
- #55459 (Add UI test for #49296)
- #55472 (Use opt.take() instead of mem::replace(opt, None))
- #55473 (Take advantage of impl Iterator in (transitive/elaborate)_bounds)
- #55474 (Fix validation false positive)
- #55476 (Change a flat_map with 0/1-element vecs to a filter_map)
- #55487 (Adjust Ids of path segments in visibility modifiers)
- #55493 (Doc fixes)
- #55494 (borrowck=migrate must look at parents of closures)
- #55496 (Update clippy)
Failed merges:
r? @ghost
Diffstat (limited to 'src/test')
16 files changed, 329 insertions, 65 deletions
diff --git a/src/test/run-pass/issue-55376.rs b/src/test/run-pass/issue-55376.rs new file mode 100644 index 00000000000..9c7256fd26f --- /dev/null +++ b/src/test/run-pass/issue-55376.rs @@ -0,0 +1,25 @@ +// 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. + +// Tests that paths in `pub(...)` don't fail HIR verification. + +#![allow(unused_imports)] +#![allow(dead_code)] + +pub(self) use self::my_mod::Foo; + +mod my_mod { + pub(super) use self::Foo as Bar; + pub(in super::my_mod) use self::Foo as Baz; + + pub struct Foo; +} + +fn main() {} diff --git a/src/test/ui/borrowck/borrowck-closures-unique.nll.stderr b/src/test/ui/borrowck/borrowck-closures-unique.nll.stderr index 771ef88a662..231ae53fe82 100644 --- a/src/test/ui/borrowck/borrowck-closures-unique.nll.stderr +++ b/src/test/ui/borrowck/borrowck-closures-unique.nll.stderr @@ -40,19 +40,15 @@ LL | let c2 = || set(x); //~ ERROR two closures require unique access to `x` LL | c1; | -- first borrow later used here -warning[E0594]: cannot assign to `x`, as it is not declared as mutable +error[E0594]: cannot assign to `x`, as it is not declared as mutable --> $DIR/borrowck-closures-unique.rs:57:38 | LL | fn e(x: &'static mut isize) { | - help: consider changing this to be mutable: `mut x` LL | let c1 = |y: &'static mut isize| x = y; //~ ERROR closure cannot assign to immutable argument | ^^^^^ cannot assign - | - = warning: This error has been downgraded to a warning for backwards compatibility with previous releases. - It represents potential unsoundness in your code. - This warning will become a hard error in the future. -error: aborting due to 3 previous errors +error: aborting due to 4 previous errors Some errors occurred: E0500, E0524, E0594. For more information about an error, try `rustc --explain E0500`. diff --git a/src/test/ui/borrowck/borrowck-describe-lvalue.ast.nll.stderr b/src/test/ui/borrowck/borrowck-describe-lvalue.ast.nll.stderr index 88ae73b6368..c3aba793f19 100644 --- a/src/test/ui/borrowck/borrowck-describe-lvalue.ast.nll.stderr +++ b/src/test/ui/borrowck/borrowck-describe-lvalue.ast.nll.stderr @@ -20,7 +20,7 @@ LL | //[mir]~^ ERROR cannot borrow `x` as mutable more than o LL | *y = 1; | ------ first borrow later used here -warning: captured variable cannot escape `FnMut` closure body +error: captured variable cannot escape `FnMut` closure body --> $DIR/borrowck-describe-lvalue.rs:305:16 | LL | || { @@ -36,9 +36,6 @@ LL | | } | = note: `FnMut` closures only have access to their captured variables while they are executing... = note: ...therefore, they cannot allow references to captured variables to escape - = warning: This error has been downgraded to a warning for backwards compatibility with previous releases. - It represents potential unsoundness in your code. - This warning will become a hard error in the future. error[E0503]: cannot use `f.x` because it was mutably borrowed --> $DIR/borrowck-describe-lvalue.rs:53:9 @@ -382,7 +379,7 @@ LL | drop(x); //[ast]~ ERROR use of moved value: `x` | = note: move occurs because `x` has type `std::vec::Vec<i32>`, which does not implement the `Copy` trait -error: aborting due to 29 previous errors +error: aborting due to 30 previous errors Some errors occurred: E0382, E0499, E0502, E0503. For more information about an error, try `rustc --explain E0382`. diff --git a/src/test/ui/borrowck/issue-55492-borrowck-migrate-scans-parents.ast.stderr b/src/test/ui/borrowck/issue-55492-borrowck-migrate-scans-parents.ast.stderr new file mode 100644 index 00000000000..3180823f643 --- /dev/null +++ b/src/test/ui/borrowck/issue-55492-borrowck-migrate-scans-parents.ast.stderr @@ -0,0 +1,55 @@ +error[E0595]: closure cannot assign to immutable argument `x` + --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:21:22 + | +LL | let mut c1 = |y: &'static mut isize| x = y; + | ^^^^^^^^^^^^^^^^^^^^^^^ cannot borrow mutably +help: consider removing the `&mut`, as it is an immutable binding to a mutable reference + | +LL | x + | + +error[E0595]: closure cannot assign to immutable argument `x` + --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:29:22 + | +LL | let mut c1 = |z: &'static mut isize| { + | ^^^^^^^^^^^^^^^^^^^^^^^ cannot borrow mutably +help: consider removing the `&mut`, as it is an immutable binding to a mutable reference + | +LL | x + | + +error[E0595]: closure cannot assign to immutable argument `x` + --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:40:9 + | +LL | pub fn capture_assign_whole(x: (i32,)) { + | - help: make this binding mutable: `mut x` +LL | || { x = (1,); }; + | ^^ cannot borrow mutably + +error[E0595]: closure cannot assign to immutable argument `x` + --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:43:9 + | +LL | pub fn capture_assign_part(x: (i32,)) { + | - help: make this binding mutable: `mut x` +LL | || { x.0 = 1; }; + | ^^ cannot borrow mutably + +error[E0595]: closure cannot assign to immutable argument `x` + --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:46:9 + | +LL | pub fn capture_reborrow_whole(x: (i32,)) { + | - help: make this binding mutable: `mut x` +LL | || { &mut x; }; + | ^^ cannot borrow mutably + +error[E0595]: closure cannot assign to immutable argument `x` + --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:49:9 + | +LL | pub fn capture_reborrow_part(x: (i32,)) { + | - help: make this binding mutable: `mut x` +LL | || { &mut x.0; }; + | ^^ cannot borrow mutably + +error: aborting due to 6 previous errors + +For more information about this error, try `rustc --explain E0595`. diff --git a/src/test/ui/borrowck/issue-55492-borrowck-migrate-scans-parents.migrate.stderr b/src/test/ui/borrowck/issue-55492-borrowck-migrate-scans-parents.migrate.stderr new file mode 100644 index 00000000000..0ccddf0a67d --- /dev/null +++ b/src/test/ui/borrowck/issue-55492-borrowck-migrate-scans-parents.migrate.stderr @@ -0,0 +1,54 @@ +error[E0594]: cannot assign to `x`, as it is not declared as mutable + --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:21:46 + | +LL | pub fn e(x: &'static mut isize) { + | - help: consider changing this to be mutable: `mut x` +LL | static mut Y: isize = 3; +LL | let mut c1 = |y: &'static mut isize| x = y; + | ^^^^^ cannot assign + +error[E0594]: cannot assign to `x`, as it is not declared as mutable + --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:30:50 + | +LL | pub fn ee(x: &'static mut isize) { + | - help: consider changing this to be mutable: `mut x` +... +LL | let mut c2 = |y: &'static mut isize| x = y; + | ^^^^^ cannot assign + +error[E0594]: cannot assign to `x`, as it is not declared as mutable + --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:40:14 + | +LL | pub fn capture_assign_whole(x: (i32,)) { + | - help: consider changing this to be mutable: `mut x` +LL | || { x = (1,); }; + | ^^^^^^^^ cannot assign + +error[E0594]: cannot assign to `x.0`, as `x` is not declared as mutable + --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:43:14 + | +LL | pub fn capture_assign_part(x: (i32,)) { + | - help: consider changing this to be mutable: `mut x` +LL | || { x.0 = 1; }; + | ^^^^^^^ cannot assign + +error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable + --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:46:14 + | +LL | pub fn capture_reborrow_whole(x: (i32,)) { + | - help: consider changing this to be mutable: `mut x` +LL | || { &mut x; }; + | ^^^^^^ cannot borrow as mutable + +error[E0596]: cannot borrow `x.0` as mutable, as `x` is not declared as mutable + --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:49:14 + | +LL | pub fn capture_reborrow_part(x: (i32,)) { + | - help: consider changing this to be mutable: `mut x` +LL | || { &mut x.0; }; + | ^^^^^^^^ cannot borrow as mutable + +error: aborting due to 6 previous errors + +Some errors occurred: E0594, E0596. +For more information about an error, try `rustc --explain E0594`. diff --git a/src/test/ui/borrowck/issue-55492-borrowck-migrate-scans-parents.nll.stderr b/src/test/ui/borrowck/issue-55492-borrowck-migrate-scans-parents.nll.stderr new file mode 100644 index 00000000000..0ccddf0a67d --- /dev/null +++ b/src/test/ui/borrowck/issue-55492-borrowck-migrate-scans-parents.nll.stderr @@ -0,0 +1,54 @@ +error[E0594]: cannot assign to `x`, as it is not declared as mutable + --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:21:46 + | +LL | pub fn e(x: &'static mut isize) { + | - help: consider changing this to be mutable: `mut x` +LL | static mut Y: isize = 3; +LL | let mut c1 = |y: &'static mut isize| x = y; + | ^^^^^ cannot assign + +error[E0594]: cannot assign to `x`, as it is not declared as mutable + --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:30:50 + | +LL | pub fn ee(x: &'static mut isize) { + | - help: consider changing this to be mutable: `mut x` +... +LL | let mut c2 = |y: &'static mut isize| x = y; + | ^^^^^ cannot assign + +error[E0594]: cannot assign to `x`, as it is not declared as mutable + --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:40:14 + | +LL | pub fn capture_assign_whole(x: (i32,)) { + | - help: consider changing this to be mutable: `mut x` +LL | || { x = (1,); }; + | ^^^^^^^^ cannot assign + +error[E0594]: cannot assign to `x.0`, as `x` is not declared as mutable + --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:43:14 + | +LL | pub fn capture_assign_part(x: (i32,)) { + | - help: consider changing this to be mutable: `mut x` +LL | || { x.0 = 1; }; + | ^^^^^^^ cannot assign + +error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable + --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:46:14 + | +LL | pub fn capture_reborrow_whole(x: (i32,)) { + | - help: consider changing this to be mutable: `mut x` +LL | || { &mut x; }; + | ^^^^^^ cannot borrow as mutable + +error[E0596]: cannot borrow `x.0` as mutable, as `x` is not declared as mutable + --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:49:14 + | +LL | pub fn capture_reborrow_part(x: (i32,)) { + | - help: consider changing this to be mutable: `mut x` +LL | || { &mut x.0; }; + | ^^^^^^^^ cannot borrow as mutable + +error: aborting due to 6 previous errors + +Some errors occurred: E0594, E0596. +For more information about an error, try `rustc --explain E0594`. diff --git a/src/test/ui/borrowck/issue-55492-borrowck-migrate-scans-parents.rs b/src/test/ui/borrowck/issue-55492-borrowck-migrate-scans-parents.rs new file mode 100644 index 00000000000..25ad66a5d9b --- /dev/null +++ b/src/test/ui/borrowck/issue-55492-borrowck-migrate-scans-parents.rs @@ -0,0 +1,61 @@ +// rust-lang/rust#55492: errors detected during MIR-borrowck's +// analysis of a closure body may only be caught when AST-borrowck +// looks at some parent. + +// revisions: ast migrate nll + +// Since we are testing nll (and migration) explicitly as a separate +// revisions, don't 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 + + +// transcribed from borrowck-closures-unique.rs +mod borrowck_closures_unique { + pub fn e(x: &'static mut isize) { + static mut Y: isize = 3; + let mut c1 = |y: &'static mut isize| x = y; + unsafe { c1(&mut Y); } + } +} + +mod borrowck_closures_unique_grandparent { + pub fn ee(x: &'static mut isize) { + static mut Z: isize = 3; + let mut c1 = |z: &'static mut isize| { + let mut c2 = |y: &'static mut isize| x = y; + c2(z); + }; + unsafe { c1(&mut Z); } + } +} + +// adapted from mutability_errors.rs +mod mutability_errors { + pub fn capture_assign_whole(x: (i32,)) { + || { x = (1,); }; + } + pub fn capture_assign_part(x: (i32,)) { + || { x.0 = 1; }; + } + pub fn capture_reborrow_whole(x: (i32,)) { + || { &mut x; }; + } + pub fn capture_reborrow_part(x: (i32,)) { + || { &mut x.0; }; + } +} + +fn main() { + static mut X: isize = 2; + unsafe { borrowck_closures_unique::e(&mut X); } + + mutability_errors::capture_assign_whole((1000,)); + mutability_errors::capture_assign_part((2000,)); + mutability_errors::capture_reborrow_whole((3000,)); + mutability_errors::capture_reborrow_part((4000,)); +} diff --git a/src/test/ui/borrowck/mutability-errors.nll.stderr b/src/test/ui/borrowck/mutability-errors.nll.stderr index bb45fe2da81..14c41bb81b2 100644 --- a/src/test/ui/borrowck/mutability-errors.nll.stderr +++ b/src/test/ui/borrowck/mutability-errors.nll.stderr @@ -277,7 +277,7 @@ LL | &mut x; //~ ERROR LL | &mut x.0; //~ ERROR | ^^^^^^^^ cannot borrow as mutable -warning[E0594]: cannot assign to `x`, as it is not declared as mutable +error[E0594]: cannot assign to `x`, as it is not declared as mutable --> $DIR/mutability-errors.rs:70:9 | LL | fn imm_capture(x: (i32,)) { @@ -285,12 +285,8 @@ LL | fn imm_capture(x: (i32,)) { LL | || { //~ ERROR LL | x = (1,); | ^^^^^^^^ cannot assign - | - = warning: This error has been downgraded to a warning for backwards compatibility with previous releases. - It represents potential unsoundness in your code. - This warning will become a hard error in the future. -warning[E0594]: cannot assign to `x.0`, as `x` is not declared as mutable +error[E0594]: cannot assign to `x.0`, as `x` is not declared as mutable --> $DIR/mutability-errors.rs:71:9 | LL | fn imm_capture(x: (i32,)) { @@ -298,12 +294,8 @@ LL | fn imm_capture(x: (i32,)) { ... LL | x.0 = 1; | ^^^^^^^ cannot assign - | - = warning: This error has been downgraded to a warning for backwards compatibility with previous releases. - It represents potential unsoundness in your code. - This warning will become a hard error in the future. -warning[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable +error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable --> $DIR/mutability-errors.rs:72:9 | LL | fn imm_capture(x: (i32,)) { @@ -311,12 +303,8 @@ LL | fn imm_capture(x: (i32,)) { ... LL | &mut x; | ^^^^^^ cannot borrow as mutable - | - = warning: This error has been downgraded to a warning for backwards compatibility with previous releases. - It represents potential unsoundness in your code. - This warning will become a hard error in the future. -warning[E0596]: cannot borrow `x.0` as mutable, as `x` is not declared as mutable +error[E0596]: cannot borrow `x.0` as mutable, as `x` is not declared as mutable --> $DIR/mutability-errors.rs:73:9 | LL | fn imm_capture(x: (i32,)) { @@ -324,10 +312,6 @@ LL | fn imm_capture(x: (i32,)) { ... LL | &mut x.0; | ^^^^^^^^ cannot borrow as mutable - | - = warning: This error has been downgraded to a warning for backwards compatibility with previous releases. - It represents potential unsoundness in your code. - This warning will become a hard error in the future. error[E0594]: cannot assign to `x`, as it is not declared as mutable --> $DIR/mutability-errors.rs:76:9 @@ -389,7 +373,7 @@ error[E0596]: cannot borrow `X.0` as mutable, as `X` is an immutable static item LL | &mut X.0; //~ ERROR | ^^^^^^^^ cannot borrow as mutable -error: aborting due to 34 previous errors +error: aborting due to 38 previous errors Some errors occurred: E0594, E0596. For more information about an error, try `rustc --explain E0594`. diff --git a/src/test/ui/consts/const-eval/issue-49296.rs b/src/test/ui/consts/const-eval/issue-49296.rs new file mode 100644 index 00000000000..a7c3c5318d4 --- /dev/null +++ b/src/test/ui/consts/const-eval/issue-49296.rs @@ -0,0 +1,23 @@ +// issue-49296: Unsafe shenigans in constants can result in missing errors + +#![feature(const_fn)] +#![feature(const_fn_union)] + +const unsafe fn transmute<T: Copy, U: Copy>(t: T) -> U { + union Transmute<T: Copy, U: Copy> { + from: T, + to: U, + } + + Transmute { from: t }.to +} + +const fn wat(x: u64) -> &'static u64 { + unsafe { transmute(&x) } +} +const X: u64 = *wat(42); +//~^ ERROR any use of this value will cause an error + +fn main() { + println!("{}", X); +} diff --git a/src/test/ui/consts/const-eval/issue-49296.stderr b/src/test/ui/consts/const-eval/issue-49296.stderr new file mode 100644 index 00000000000..37462db4c96 --- /dev/null +++ b/src/test/ui/consts/const-eval/issue-49296.stderr @@ -0,0 +1,12 @@ +error: any use of this value will cause an error + --> $DIR/issue-49296.rs:18:1 + | +LL | const X: u64 = *wat(42); + | ^^^^^^^^^^^^^^^--------^ + | | + | dangling pointer was dereferenced + | + = note: #[deny(const_err)] on by default + +error: aborting due to previous error + diff --git a/src/test/ui/consts/const-validation-fail-55455.rs b/src/test/ui/consts/const-validation-fail-55455.rs new file mode 100644 index 00000000000..def4062339f --- /dev/null +++ b/src/test/ui/consts/const-validation-fail-55455.rs @@ -0,0 +1,9 @@ +// https://github.com/rust-lang/rust/issues/55454 +// compile-pass + +struct This<T>(T); + +const C: This<Option<&i32>> = This(Some(&1)); + +fn main() { +} diff --git a/src/test/ui/consts/promoted-validation-55454.rs b/src/test/ui/consts/promoted-validation-55454.rs new file mode 100644 index 00000000000..5e193b1b7de --- /dev/null +++ b/src/test/ui/consts/promoted-validation-55454.rs @@ -0,0 +1,9 @@ +// https://github.com/rust-lang/rust/issues/55454 +// compile-pass + +#[derive(PartialEq)] +struct This<T>(T); + +fn main() { + This(Some(&1)) == This(Some(&1)); +} diff --git a/src/test/ui/lint/unused_parens_json_suggestion.rs b/src/test/ui/lint/unused_parens_json_suggestion.rs index 187e7f31dfd..9eda59614f4 100644 --- a/src/test/ui/lint/unused_parens_json_suggestion.rs +++ b/src/test/ui/lint/unused_parens_json_suggestion.rs @@ -23,4 +23,13 @@ fn main() { // We want to suggest the properly-balanced expression `1 / (2 + 3)`, not // the malformed `1 / (2 + 3` let _a = (1 / (2 + 3)); + f(); +} + +fn f() -> bool { + loop { + if (break { return true }) { + } + } + false } diff --git a/src/test/ui/unboxed-closures/unboxed-closure-immutable-capture.nll.stderr b/src/test/ui/unboxed-closures/unboxed-closure-immutable-capture.nll.stderr index ee91ea3b66f..084d7ff3bcd 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-immutable-capture.nll.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closure-immutable-capture.nll.stderr @@ -33,7 +33,7 @@ LL | let x = 0; LL | move || set(&mut x); //~ ERROR cannot borrow | ^^^^^^ cannot borrow as mutable -warning[E0594]: cannot assign to `x`, as it is not declared as mutable +error[E0594]: cannot assign to `x`, as it is not declared as mutable --> $DIR/unboxed-closure-immutable-capture.rs:23:8 | LL | let x = 0; @@ -41,12 +41,8 @@ LL | let x = 0; ... LL | || x = 1; //~ ERROR cannot assign | ^^^^^ cannot assign - | - = warning: This error has been downgraded to a warning for backwards compatibility with previous releases. - It represents potential unsoundness in your code. - This warning will become a hard error in the future. -warning[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable +error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable --> $DIR/unboxed-closure-immutable-capture.rs:25:12 | LL | let x = 0; @@ -54,12 +50,8 @@ LL | let x = 0; ... LL | || set(&mut x); //~ ERROR cannot assign | ^^^^^^ cannot borrow as mutable - | - = warning: This error has been downgraded to a warning for backwards compatibility with previous releases. - It represents potential unsoundness in your code. - This warning will become a hard error in the future. -warning[E0594]: cannot assign to `x`, as it is not declared as mutable +error[E0594]: cannot assign to `x`, as it is not declared as mutable --> $DIR/unboxed-closure-immutable-capture.rs:26:8 | LL | let x = 0; @@ -67,12 +59,8 @@ LL | let x = 0; ... LL | || x = 1; //~ ERROR cannot assign | ^^^^^ cannot assign - | - = warning: This error has been downgraded to a warning for backwards compatibility with previous releases. - It represents potential unsoundness in your code. - This warning will become a hard error in the future. -warning[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable +error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable --> $DIR/unboxed-closure-immutable-capture.rs:28:12 | LL | let x = 0; @@ -80,12 +68,8 @@ LL | let x = 0; ... LL | || set(&mut x); //~ ERROR cannot assign | ^^^^^^ cannot borrow as mutable - | - = warning: This error has been downgraded to a warning for backwards compatibility with previous releases. - It represents potential unsoundness in your code. - This warning will become a hard error in the future. -error: aborting due to 4 previous errors +error: aborting due to 8 previous errors Some errors occurred: E0594, E0596. For more information about an error, try `rustc --explain E0594`. diff --git a/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-calling-fnmut-no-mut.nll.stderr b/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-calling-fnmut-no-mut.nll.stderr index fa0aba96e18..718c3a19938 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-calling-fnmut-no-mut.nll.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-calling-fnmut-no-mut.nll.stderr @@ -1,4 +1,4 @@ -warning[E0596]: cannot borrow `tick1` as mutable, as it is not declared as mutable +error[E0596]: cannot borrow `tick1` as mutable, as it is not declared as mutable --> $DIR/unboxed-closures-infer-fnmut-calling-fnmut-no-mut.rs:27:9 | LL | let tick1 = || { @@ -6,10 +6,6 @@ LL | let tick1 = || { ... LL | tick1(); | ^^^^^ cannot borrow as mutable - | - = warning: This error has been downgraded to a warning for backwards compatibility with previous releases. - It represents potential unsoundness in your code. - This warning will become a hard error in the future. error[E0596]: cannot borrow `tick2` as mutable, as it is not declared as mutable --> $DIR/unboxed-closures-infer-fnmut-calling-fnmut-no-mut.rs:30:5 @@ -20,6 +16,6 @@ LL | let tick2 = || { //~ ERROR closure cannot assign to immutable local var LL | tick2(); //~ ERROR cannot borrow | ^^^^^ cannot borrow as mutable -error: aborting due to previous error +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0596`. diff --git a/src/test/ui/unboxed-closures/unboxed-closures-mutate-upvar.nll.stderr b/src/test/ui/unboxed-closures/unboxed-closures-mutate-upvar.nll.stderr index 9858b8db211..f765f207303 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-mutate-upvar.nll.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closures-mutate-upvar.nll.stderr @@ -1,4 +1,4 @@ -warning[E0594]: cannot assign to `n`, as it is not declared as mutable +error[E0594]: cannot assign to `n`, as it is not declared as mutable --> $DIR/unboxed-closures-mutate-upvar.rs:25:9 | LL | let n = 0; @@ -6,10 +6,6 @@ LL | let n = 0; LL | let mut f = to_fn_mut(|| { //~ ERROR closure cannot assign LL | n += 1; | ^^^^^^ cannot assign - | - = warning: This error has been downgraded to a warning for backwards compatibility with previous releases. - It represents potential unsoundness in your code. - This warning will become a hard error in the future. error[E0594]: cannot assign to `n`, as it is not declared as mutable --> $DIR/unboxed-closures-mutate-upvar.rs:42:9 @@ -44,6 +40,6 @@ LL | | n += 1; //~ ERROR cannot assign LL | | }); | |_____^ -error: aborting due to 3 previous errors +error: aborting due to 4 previous errors For more information about this error, try `rustc --explain E0594`. |
