summaryrefslogtreecommitdiffstats
path: root/tests/ui/closures/2229_closure_analysis
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/closures/2229_closure_analysis')
-rw-r--r--tests/ui/closures/2229_closure_analysis/diagnostics/arrays.stderr14
-rw-r--r--tests/ui/closures/2229_closure_analysis/diagnostics/box.stderr8
-rw-r--r--tests/ui/closures/2229_closure_analysis/diagnostics/repr_packed.rs1
-rw-r--r--tests/ui/closures/2229_closure_analysis/diagnostics/repr_packed.stderr20
-rw-r--r--tests/ui/closures/2229_closure_analysis/diagnostics/union.rs4
-rw-r--r--tests/ui/closures/2229_closure_analysis/diagnostics/union.stderr4
-rw-r--r--tests/ui/closures/2229_closure_analysis/issue_88118.rs5
-rw-r--r--tests/ui/closures/2229_closure_analysis/migrations/auto_traits.fixed4
-rw-r--r--tests/ui/closures/2229_closure_analysis/migrations/auto_traits.rs4
-rw-r--r--tests/ui/closures/2229_closure_analysis/migrations/auto_traits.stderr4
-rw-r--r--tests/ui/closures/2229_closure_analysis/migrations/multi_diagnostics.fixed2
-rw-r--r--tests/ui/closures/2229_closure_analysis/migrations/multi_diagnostics.rs2
-rw-r--r--tests/ui/closures/2229_closure_analysis/migrations/multi_diagnostics.stderr2
13 files changed, 27 insertions, 47 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
diff --git a/tests/ui/closures/2229_closure_analysis/issue_88118.rs b/tests/ui/closures/2229_closure_analysis/issue_88118.rs
index 453b7e04a..bfb487649 100644
--- a/tests/ui/closures/2229_closure_analysis/issue_88118.rs
+++ b/tests/ui/closures/2229_closure_analysis/issue_88118.rs
@@ -1,10 +1,7 @@
// Regression test for #88118. Used to ICE.
-//
+// edition:2021
// check-pass
-#![allow(incomplete_features)]
-#![feature(capture_disjoint_fields)]
-
fn foo<MsU>(handler: impl FnOnce() -> MsU + Clone + 'static) {
Box::new(move |value| {
(|_| handler.clone()())(value);
diff --git a/tests/ui/closures/2229_closure_analysis/migrations/auto_traits.fixed b/tests/ui/closures/2229_closure_analysis/migrations/auto_traits.fixed
index 26703fbf8..b74b5e94e 100644
--- a/tests/ui/closures/2229_closure_analysis/migrations/auto_traits.fixed
+++ b/tests/ui/closures/2229_closure_analysis/migrations/auto_traits.fixed
@@ -26,7 +26,7 @@ fn test_send_trait() {
//~| HELP: add a dummy let to cause `fptr` to be fully captured
*fptr.0 = 20;
//~^ NOTE: in Rust 2018, this closure captures all of `fptr`, but in Rust 2021, it will only capture `fptr.0`
- } });
+ } }).join().unwrap();
}
/* Test Sync Trait Migration */
@@ -47,7 +47,7 @@ fn test_sync_trait() {
//~| HELP: add a dummy let to cause `fptr` to be fully captured
*fptr.0.0 = 20;
//~^ NOTE: in Rust 2018, this closure captures all of `fptr`, but in Rust 2021, it will only capture `fptr.0.0`
- } });
+ } }).join().unwrap();
}
/* Test Clone Trait Migration */
diff --git a/tests/ui/closures/2229_closure_analysis/migrations/auto_traits.rs b/tests/ui/closures/2229_closure_analysis/migrations/auto_traits.rs
index 932db51d4..e4965e33c 100644
--- a/tests/ui/closures/2229_closure_analysis/migrations/auto_traits.rs
+++ b/tests/ui/closures/2229_closure_analysis/migrations/auto_traits.rs
@@ -26,7 +26,7 @@ fn test_send_trait() {
//~| HELP: add a dummy let to cause `fptr` to be fully captured
*fptr.0 = 20;
//~^ NOTE: in Rust 2018, this closure captures all of `fptr`, but in Rust 2021, it will only capture `fptr.0`
- });
+ }).join().unwrap();
}
/* Test Sync Trait Migration */
@@ -47,7 +47,7 @@ fn test_sync_trait() {
//~| HELP: add a dummy let to cause `fptr` to be fully captured
*fptr.0.0 = 20;
//~^ NOTE: in Rust 2018, this closure captures all of `fptr`, but in Rust 2021, it will only capture `fptr.0.0`
- });
+ }).join().unwrap();
}
/* Test Clone Trait Migration */
diff --git a/tests/ui/closures/2229_closure_analysis/migrations/auto_traits.stderr b/tests/ui/closures/2229_closure_analysis/migrations/auto_traits.stderr
index 3a42cc8b8..856ec4a5b 100644
--- a/tests/ui/closures/2229_closure_analysis/migrations/auto_traits.stderr
+++ b/tests/ui/closures/2229_closure_analysis/migrations/auto_traits.stderr
@@ -19,7 +19,7 @@ LL ~ thread::spawn(move || { let _ = &fptr; unsafe {
LL |
...
LL |
-LL ~ } });
+LL ~ } }).join().unwrap();
|
error: changes to closure capture in Rust 2021 will affect which traits the closure implements
@@ -41,7 +41,7 @@ LL ~ thread::spawn(move || { let _ = &fptr; unsafe {
LL |
...
LL |
-LL ~ } });
+LL ~ } }).join().unwrap();
|
error: changes to closure capture in Rust 2021 will affect drop order and which traits the closure implements
diff --git a/tests/ui/closures/2229_closure_analysis/migrations/multi_diagnostics.fixed b/tests/ui/closures/2229_closure_analysis/migrations/multi_diagnostics.fixed
index 173dd2e2c..bde8c7497 100644
--- a/tests/ui/closures/2229_closure_analysis/migrations/multi_diagnostics.fixed
+++ b/tests/ui/closures/2229_closure_analysis/migrations/multi_diagnostics.fixed
@@ -145,7 +145,7 @@ fn test_multi_traits_issues() {
//~^ NOTE: in Rust 2018, this closure captures all of `fptr1`, but in Rust 2021, it will only capture `fptr1.0.0`
*fptr2.0 = 20;
//~^ NOTE: in Rust 2018, this closure captures all of `fptr2`, but in Rust 2021, it will only capture `fptr2.0`
- } });
+ } }).join().unwrap();
}
fn main() {
diff --git a/tests/ui/closures/2229_closure_analysis/migrations/multi_diagnostics.rs b/tests/ui/closures/2229_closure_analysis/migrations/multi_diagnostics.rs
index cfc4555ca..584c52ea1 100644
--- a/tests/ui/closures/2229_closure_analysis/migrations/multi_diagnostics.rs
+++ b/tests/ui/closures/2229_closure_analysis/migrations/multi_diagnostics.rs
@@ -141,7 +141,7 @@ fn test_multi_traits_issues() {
//~^ NOTE: in Rust 2018, this closure captures all of `fptr1`, but in Rust 2021, it will only capture `fptr1.0.0`
*fptr2.0 = 20;
//~^ NOTE: in Rust 2018, this closure captures all of `fptr2`, but in Rust 2021, it will only capture `fptr2.0`
- });
+ }).join().unwrap();
}
fn main() {
diff --git a/tests/ui/closures/2229_closure_analysis/migrations/multi_diagnostics.stderr b/tests/ui/closures/2229_closure_analysis/migrations/multi_diagnostics.stderr
index efb264447..344bc662e 100644
--- a/tests/ui/closures/2229_closure_analysis/migrations/multi_diagnostics.stderr
+++ b/tests/ui/closures/2229_closure_analysis/migrations/multi_diagnostics.stderr
@@ -111,7 +111,7 @@ LL ~ thread::spawn(move || { let _ = (&fptr1, &fptr2); unsafe {
LL |
...
LL |
-LL ~ } });
+LL ~ } }).join().unwrap();
|
error: aborting due to 5 previous errors