diff options
Diffstat (limited to 'tests/ui/closures/2229_closure_analysis/diagnostics')
6 files changed, 17 insertions, 34 deletions
diff --git a/tests/ui/closures/2229_closure_analysis/diagnostics/arrays.stderr b/tests/ui/closures/2229_closure_analysis/diagnostics/arrays.stderr index 4f41060dc..9e5200ef3 100644 --- a/tests/ui/closures/2229_closure_analysis/diagnostics/arrays.stderr +++ b/tests/ui/closures/2229_closure_analysis/diagnostics/arrays.stderr @@ -2,7 +2,7 @@ error[E0503]: cannot use `arr` because it was mutably borrowed --> $DIR/arrays.rs:14:5 | LL | let mut c = || { - | -- borrow of `arr` occurs here + | -- `arr` is borrowed here LL | arr[0] += 10; | --- borrow occurs due to use of `arr` in closure ... @@ -16,7 +16,7 @@ error[E0503]: cannot use `arr[_]` because it was mutably borrowed --> $DIR/arrays.rs:14:5 | LL | let mut c = || { - | -- borrow of `arr` occurs here + | -- `arr` is borrowed here LL | arr[0] += 10; | --- borrow occurs due to use of `arr` in closure ... @@ -30,12 +30,12 @@ error[E0506]: cannot assign to `arr[_]` because it is borrowed --> $DIR/arrays.rs:29:5 | LL | let c = || { - | -- borrow of `arr[_]` occurs here + | -- `arr[_]` is borrowed here LL | println!("{:#?}", &arr[3..4]); | --- borrow occurs due to use in closure ... LL | arr[1] += 10; - | ^^^^^^^^^^^^ assignment to borrowed `arr[_]` occurs here + | ^^^^^^^^^^^^ `arr[_]` is assigned to here but it was already borrowed LL | LL | c(); | - borrow later used here @@ -44,12 +44,12 @@ error[E0506]: cannot assign to `arr[_]` because it is borrowed --> $DIR/arrays.rs:43:5 | LL | let c = || { - | -- borrow of `arr[_]` occurs here + | -- `arr[_]` is borrowed here LL | println!("{}", arr[3]); | --- borrow occurs due to use in closure ... LL | arr[1] += 10; - | ^^^^^^^^^^^^ assignment to borrowed `arr[_]` occurs here + | ^^^^^^^^^^^^ `arr[_]` is assigned to here but it was already borrowed LL | LL | c(); | - borrow later used here @@ -58,7 +58,7 @@ error[E0503]: cannot use `arr` because it was mutably borrowed --> $DIR/arrays.rs:57:20 | LL | let mut c = || { - | -- borrow of `arr` occurs here + | -- `arr` is borrowed here LL | arr[1] += 10; | --- borrow occurs due to use of `arr` in closure ... diff --git a/tests/ui/closures/2229_closure_analysis/diagnostics/box.stderr b/tests/ui/closures/2229_closure_analysis/diagnostics/box.stderr index f8b178752..2e3259e64 100644 --- a/tests/ui/closures/2229_closure_analysis/diagnostics/box.stderr +++ b/tests/ui/closures/2229_closure_analysis/diagnostics/box.stderr @@ -2,12 +2,12 @@ error[E0506]: cannot assign to `e.0.0.m.x` because it is borrowed --> $DIR/box.rs:21:5 | LL | let mut c = || { - | -- borrow of `e.0.0.m.x` occurs here + | -- `e.0.0.m.x` is borrowed here LL | e.0.0.m.x = format!("not-x"); | --------- borrow occurs due to use in closure ... LL | e.0.0.m.x = format!("not-x"); - | ^^^^^^^^^ assignment to borrowed `e.0.0.m.x` occurs here + | ^^^^^^^^^ `e.0.0.m.x` is assigned to here but it was already borrowed LL | LL | c(); | - borrow later used here @@ -32,12 +32,12 @@ error[E0506]: cannot assign to `e.0.0.m.x` because it is borrowed --> $DIR/box.rs:55:5 | LL | let c = || { - | -- borrow of `e.0.0.m.x` occurs here + | -- `e.0.0.m.x` is borrowed here LL | println!("{}", e.0.0.m.x); | --------- borrow occurs due to use in closure ... LL | e.0.0.m.x = format!("not-x"); - | ^^^^^^^^^ assignment to borrowed `e.0.0.m.x` occurs here + | ^^^^^^^^^ `e.0.0.m.x` is assigned to here but it was already borrowed LL | LL | c(); | - borrow later used here diff --git a/tests/ui/closures/2229_closure_analysis/diagnostics/repr_packed.rs b/tests/ui/closures/2229_closure_analysis/diagnostics/repr_packed.rs index 1488f3296..c7ee90ea7 100644 --- a/tests/ui/closures/2229_closure_analysis/diagnostics/repr_packed.rs +++ b/tests/ui/closures/2229_closure_analysis/diagnostics/repr_packed.rs @@ -20,7 +20,6 @@ fn test_missing_unsafe_warning_on_repr_packed() { let c = || { println!("{}", foo.x); //~^ ERROR: reference to packed field is unaligned - //~| WARNING: this was previously accepted by the compiler but is being phased out let _z = foo.x; }; diff --git a/tests/ui/closures/2229_closure_analysis/diagnostics/repr_packed.stderr b/tests/ui/closures/2229_closure_analysis/diagnostics/repr_packed.stderr index 508c4b911..9c2c43457 100644 --- a/tests/ui/closures/2229_closure_analysis/diagnostics/repr_packed.stderr +++ b/tests/ui/closures/2229_closure_analysis/diagnostics/repr_packed.stderr @@ -1,29 +1,13 @@ -error: reference to packed field is unaligned +error[E0793]: reference to packed field is unaligned --> $DIR/repr_packed.rs:21:24 | LL | println!("{}", foo.x); | ^^^^^ | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #82523 <https://github.com/rust-lang/rust/issues/82523> = note: fields of packed structs are not properly aligned, and creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) = help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers) - = note: `#[deny(unaligned_references)]` on by default = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error -Future incompatibility report: Future breakage diagnostic: -error: reference to packed field is unaligned - --> $DIR/repr_packed.rs:21:24 - | -LL | println!("{}", foo.x); - | ^^^^^ - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #82523 <https://github.com/rust-lang/rust/issues/82523> - = note: fields of packed structs are not properly aligned, and creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) - = help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers) - = note: `#[deny(unaligned_references)]` on by default - = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) - +For more information about this error, try `rustc --explain E0793`. diff --git a/tests/ui/closures/2229_closure_analysis/diagnostics/union.rs b/tests/ui/closures/2229_closure_analysis/diagnostics/union.rs index 46b54846e..695337ea8 100644 --- a/tests/ui/closures/2229_closure_analysis/diagnostics/union.rs +++ b/tests/ui/closures/2229_closure_analysis/diagnostics/union.rs @@ -11,7 +11,7 @@ union A { fn main() { let mut a = A { y: 1 }; let mut c = || { - //~^ borrow of `a.y` occurs here + //~^ `a.y` is borrowed here let _ = unsafe { &a.y }; let _ = &mut a; //~^ borrow occurs due to use in closure @@ -19,7 +19,7 @@ fn main() { }; a.y = 1; //~^ cannot assign to `a.y` because it is borrowed [E0506] - //~| assignment to borrowed `a.y` occurs here + //~| `a.y` is assigned to here c(); //~^ borrow later used here } diff --git a/tests/ui/closures/2229_closure_analysis/diagnostics/union.stderr b/tests/ui/closures/2229_closure_analysis/diagnostics/union.stderr index 7c34e2336..17834e612 100644 --- a/tests/ui/closures/2229_closure_analysis/diagnostics/union.stderr +++ b/tests/ui/closures/2229_closure_analysis/diagnostics/union.stderr @@ -2,13 +2,13 @@ error[E0506]: cannot assign to `a.y` because it is borrowed --> $DIR/union.rs:20:5 | LL | let mut c = || { - | -- borrow of `a.y` occurs here + | -- `a.y` is borrowed here ... LL | let _ = &mut a; | - borrow occurs due to use in closure ... LL | a.y = 1; - | ^^^^^^^ assignment to borrowed `a.y` occurs here + | ^^^^^^^ `a.y` is assigned to here but it was already borrowed ... LL | c(); | - borrow later used here |