Rename disjoint_capture_migration lint to rust_2021_incompatible_closure_captures
This commit is contained in:
parent
b09dad3edd
commit
bbfb8579ff
27 changed files with 180 additions and 177 deletions
|
|
@ -1,10 +1,10 @@
|
|||
// run-rustfix
|
||||
#![deny(disjoint_capture_migration)]
|
||||
#![deny(rust_2021_incompatible_closure_captures)]
|
||||
|
||||
use std::thread;
|
||||
|
||||
/* Test Send Trait Migration */
|
||||
struct SendPointer (*mut i32);
|
||||
struct SendPointer(*mut i32);
|
||||
unsafe impl Send for SendPointer {}
|
||||
|
||||
fn test_send_trait() {
|
||||
|
|
@ -18,8 +18,8 @@ fn test_send_trait() {
|
|||
}
|
||||
|
||||
/* Test Sync Trait Migration */
|
||||
struct CustomInt (*mut i32);
|
||||
struct SyncPointer (CustomInt);
|
||||
struct CustomInt(*mut i32);
|
||||
struct SyncPointer(CustomInt);
|
||||
unsafe impl Sync for SyncPointer {}
|
||||
unsafe impl Send for CustomInt {}
|
||||
|
||||
|
|
@ -38,7 +38,7 @@ fn test_sync_trait() {
|
|||
struct S(String);
|
||||
struct T(i32);
|
||||
|
||||
struct U(S,T);
|
||||
struct U(S, T);
|
||||
|
||||
impl Clone for U {
|
||||
fn clone(&self) -> Self {
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
// run-rustfix
|
||||
#![deny(disjoint_capture_migration)]
|
||||
#![deny(rust_2021_incompatible_closure_captures)]
|
||||
|
||||
use std::thread;
|
||||
|
||||
/* Test Send Trait Migration */
|
||||
struct SendPointer (*mut i32);
|
||||
struct SendPointer(*mut i32);
|
||||
unsafe impl Send for SendPointer {}
|
||||
|
||||
fn test_send_trait() {
|
||||
|
|
@ -18,8 +18,8 @@ fn test_send_trait() {
|
|||
}
|
||||
|
||||
/* Test Sync Trait Migration */
|
||||
struct CustomInt (*mut i32);
|
||||
struct SyncPointer (CustomInt);
|
||||
struct CustomInt(*mut i32);
|
||||
struct SyncPointer(CustomInt);
|
||||
unsafe impl Sync for SyncPointer {}
|
||||
unsafe impl Send for CustomInt {}
|
||||
|
||||
|
|
@ -38,7 +38,7 @@ fn test_sync_trait() {
|
|||
struct S(String);
|
||||
struct T(i32);
|
||||
|
||||
struct U(S,T);
|
||||
struct U(S, T);
|
||||
|
||||
impl Clone for U {
|
||||
fn clone(&self) -> Self {
|
||||
|
|
|
|||
|
|
@ -12,8 +12,8 @@ LL | | });
|
|||
note: the lint level is defined here
|
||||
--> $DIR/auto_traits.rs:2:9
|
||||
|
|
||||
LL | #![deny(disjoint_capture_migration)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
LL | #![deny(rust_2021_incompatible_closure_captures)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/disjoint-capture-in-closures.html>
|
||||
help: add a dummy let to cause `fptr` to be fully captured
|
||||
|
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
// run-rustfix
|
||||
|
||||
#![deny(disjoint_capture_migration)]
|
||||
#![deny(rust_2021_incompatible_closure_captures)]
|
||||
//~^ NOTE: the lint level is defined here
|
||||
|
||||
// Test cases for types that implement a insignificant drop (stlib defined)
|
||||
|
|
@ -13,9 +13,9 @@ fn test1_all_need_migration() {
|
|||
let t2 = (String::new(), String::new());
|
||||
|
||||
let c = || { let _ = (&t, &t1, &t2);
|
||||
//~^ ERROR: drop order
|
||||
//~| NOTE: for more information, see
|
||||
//~| HELP: add a dummy let to cause `t`, `t1`, `t2` to be fully captured
|
||||
//~^ ERROR: drop order
|
||||
//~| NOTE: for more information, see
|
||||
//~| HELP: add a dummy let to cause `t`, `t1`, `t2` to be fully captured
|
||||
|
||||
let _t = t.0;
|
||||
let _t1 = t1.0;
|
||||
|
|
@ -33,9 +33,9 @@ fn test2_only_precise_paths_need_migration() {
|
|||
let t2 = (String::new(), String::new());
|
||||
|
||||
let c = || { let _ = (&t, &t1);
|
||||
//~^ ERROR: drop order
|
||||
//~| NOTE: for more information, see
|
||||
//~| HELP: add a dummy let to cause `t`, `t1` to be fully captured
|
||||
//~^ ERROR: drop order
|
||||
//~| NOTE: for more information, see
|
||||
//~| HELP: add a dummy let to cause `t`, `t1` to be fully captured
|
||||
let _t = t.0;
|
||||
let _t1 = t1.0;
|
||||
let _t2 = t2;
|
||||
|
|
@ -50,9 +50,9 @@ fn test3_only_by_value_need_migration() {
|
|||
let t = (String::new(), String::new());
|
||||
let t1 = (String::new(), String::new());
|
||||
let c = || { let _ = &t;
|
||||
//~^ ERROR: drop order
|
||||
//~| NOTE: for more information, see
|
||||
//~| HELP: add a dummy let to cause `t` to be fully captured
|
||||
//~^ ERROR: drop order
|
||||
//~| NOTE: for more information, see
|
||||
//~| HELP: add a dummy let to cause `t` to be fully captured
|
||||
let _t = t.0;
|
||||
println!("{}", t1.1);
|
||||
};
|
||||
|
|
@ -69,9 +69,9 @@ fn test4_only_non_copy_types_need_migration() {
|
|||
let t1 = (0i32, 0i32);
|
||||
|
||||
let c = || { let _ = &t;
|
||||
//~^ ERROR: drop order
|
||||
//~| NOTE: for more information, see
|
||||
//~| HELP: add a dummy let to cause `t` to be fully captured
|
||||
//~^ ERROR: drop order
|
||||
//~| NOTE: for more information, see
|
||||
//~| HELP: add a dummy let to cause `t` to be fully captured
|
||||
let _t = t.0;
|
||||
let _t1 = t1.0;
|
||||
};
|
||||
|
|
@ -88,9 +88,9 @@ fn test5_only_drop_types_need_migration() {
|
|||
let s = S(0i32, 0i32);
|
||||
|
||||
let c = || { let _ = &t;
|
||||
//~^ ERROR: drop order
|
||||
//~| NOTE: for more information, see
|
||||
//~| HELP: add a dummy let to cause `t` to be fully captured
|
||||
//~^ ERROR: drop order
|
||||
//~| NOTE: for more information, see
|
||||
//~| HELP: add a dummy let to cause `t` to be fully captured
|
||||
let _t = t.0;
|
||||
let _s = s.0;
|
||||
};
|
||||
|
|
@ -104,9 +104,9 @@ fn test6_move_closures_non_copy_types_might_need_migration() {
|
|||
let t = (String::new(), String::new());
|
||||
let t1 = (String::new(), String::new());
|
||||
let c = move || { let _ = (&t1, &t);
|
||||
//~^ ERROR: drop order
|
||||
//~| NOTE: for more information, see
|
||||
//~| HELP: add a dummy let to cause `t1`, `t` to be fully captured
|
||||
//~^ ERROR: drop order
|
||||
//~| NOTE: for more information, see
|
||||
//~| HELP: add a dummy let to cause `t1`, `t` to be fully captured
|
||||
println!("{} {}", t1.1, t.1);
|
||||
};
|
||||
|
||||
|
|
@ -120,9 +120,9 @@ fn test7_drop_non_drop_aggregate_need_migration() {
|
|||
let t = (String::new(), String::new(), 0i32);
|
||||
|
||||
let c = || { let _ = &t;
|
||||
//~^ ERROR: drop order
|
||||
//~| NOTE: for more information, see
|
||||
//~| HELP: add a dummy let to cause `t` to be fully captured
|
||||
//~^ ERROR: drop order
|
||||
//~| NOTE: for more information, see
|
||||
//~| HELP: add a dummy let to cause `t` to be fully captured
|
||||
let _t = t.0;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
// run-rustfix
|
||||
|
||||
#![deny(disjoint_capture_migration)]
|
||||
#![deny(rust_2021_incompatible_closure_captures)]
|
||||
//~^ NOTE: the lint level is defined here
|
||||
|
||||
// Test cases for types that implement a insignificant drop (stlib defined)
|
||||
|
|
@ -13,9 +13,9 @@ fn test1_all_need_migration() {
|
|||
let t2 = (String::new(), String::new());
|
||||
|
||||
let c = || {
|
||||
//~^ ERROR: drop order
|
||||
//~| NOTE: for more information, see
|
||||
//~| HELP: add a dummy let to cause `t`, `t1`, `t2` to be fully captured
|
||||
//~^ ERROR: drop order
|
||||
//~| NOTE: for more information, see
|
||||
//~| HELP: add a dummy let to cause `t`, `t1`, `t2` to be fully captured
|
||||
|
||||
let _t = t.0;
|
||||
let _t1 = t1.0;
|
||||
|
|
@ -33,9 +33,9 @@ fn test2_only_precise_paths_need_migration() {
|
|||
let t2 = (String::new(), String::new());
|
||||
|
||||
let c = || {
|
||||
//~^ ERROR: drop order
|
||||
//~| NOTE: for more information, see
|
||||
//~| HELP: add a dummy let to cause `t`, `t1` to be fully captured
|
||||
//~^ ERROR: drop order
|
||||
//~| NOTE: for more information, see
|
||||
//~| HELP: add a dummy let to cause `t`, `t1` to be fully captured
|
||||
let _t = t.0;
|
||||
let _t1 = t1.0;
|
||||
let _t2 = t2;
|
||||
|
|
@ -50,9 +50,9 @@ fn test3_only_by_value_need_migration() {
|
|||
let t = (String::new(), String::new());
|
||||
let t1 = (String::new(), String::new());
|
||||
let c = || {
|
||||
//~^ ERROR: drop order
|
||||
//~| NOTE: for more information, see
|
||||
//~| HELP: add a dummy let to cause `t` to be fully captured
|
||||
//~^ ERROR: drop order
|
||||
//~| NOTE: for more information, see
|
||||
//~| HELP: add a dummy let to cause `t` to be fully captured
|
||||
let _t = t.0;
|
||||
println!("{}", t1.1);
|
||||
};
|
||||
|
|
@ -69,9 +69,9 @@ fn test4_only_non_copy_types_need_migration() {
|
|||
let t1 = (0i32, 0i32);
|
||||
|
||||
let c = || {
|
||||
//~^ ERROR: drop order
|
||||
//~| NOTE: for more information, see
|
||||
//~| HELP: add a dummy let to cause `t` to be fully captured
|
||||
//~^ ERROR: drop order
|
||||
//~| NOTE: for more information, see
|
||||
//~| HELP: add a dummy let to cause `t` to be fully captured
|
||||
let _t = t.0;
|
||||
let _t1 = t1.0;
|
||||
};
|
||||
|
|
@ -88,9 +88,9 @@ fn test5_only_drop_types_need_migration() {
|
|||
let s = S(0i32, 0i32);
|
||||
|
||||
let c = || {
|
||||
//~^ ERROR: drop order
|
||||
//~| NOTE: for more information, see
|
||||
//~| HELP: add a dummy let to cause `t` to be fully captured
|
||||
//~^ ERROR: drop order
|
||||
//~| NOTE: for more information, see
|
||||
//~| HELP: add a dummy let to cause `t` to be fully captured
|
||||
let _t = t.0;
|
||||
let _s = s.0;
|
||||
};
|
||||
|
|
@ -104,9 +104,9 @@ fn test6_move_closures_non_copy_types_might_need_migration() {
|
|||
let t = (String::new(), String::new());
|
||||
let t1 = (String::new(), String::new());
|
||||
let c = move || {
|
||||
//~^ ERROR: drop order
|
||||
//~| NOTE: for more information, see
|
||||
//~| HELP: add a dummy let to cause `t1`, `t` to be fully captured
|
||||
//~^ ERROR: drop order
|
||||
//~| NOTE: for more information, see
|
||||
//~| HELP: add a dummy let to cause `t1`, `t` to be fully captured
|
||||
println!("{} {}", t1.1, t.1);
|
||||
};
|
||||
|
||||
|
|
@ -120,9 +120,9 @@ fn test7_drop_non_drop_aggregate_need_migration() {
|
|||
let t = (String::new(), String::new(), 0i32);
|
||||
|
||||
let c = || {
|
||||
//~^ ERROR: drop order
|
||||
//~| NOTE: for more information, see
|
||||
//~| HELP: add a dummy let to cause `t` to be fully captured
|
||||
//~^ ERROR: drop order
|
||||
//~| NOTE: for more information, see
|
||||
//~| HELP: add a dummy let to cause `t` to be fully captured
|
||||
let _t = t.0;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -14,8 +14,8 @@ LL | | };
|
|||
note: the lint level is defined here
|
||||
--> $DIR/insignificant_drop.rs:3:9
|
||||
|
|
||||
LL | #![deny(disjoint_capture_migration)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
LL | #![deny(rust_2021_incompatible_closure_captures)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/disjoint-capture-in-closures.html>
|
||||
help: add a dummy let to cause `t`, `t1`, `t2` to be fully captured
|
||||
|
|
||||
|
|
|
|||
|
|
@ -1,8 +1,7 @@
|
|||
// run-rustfix
|
||||
|
||||
#![deny(disjoint_capture_migration)]
|
||||
#![deny(rust_2021_incompatible_closure_captures)]
|
||||
//~^ NOTE: the lint level is defined here
|
||||
|
||||
#![feature(rustc_attrs)]
|
||||
#![allow(unused)]
|
||||
|
||||
|
|
@ -36,9 +35,9 @@ fn significant_drop_needs_migration() {
|
|||
let t = (SigDrop {}, SigDrop {});
|
||||
|
||||
let c = || { let _ = &t;
|
||||
//~^ ERROR: drop order
|
||||
//~| NOTE: for more information, see
|
||||
//~| HELP: add a dummy let to cause `t` to be fully captured
|
||||
//~^ ERROR: drop order
|
||||
//~| NOTE: for more information, see
|
||||
//~| HELP: add a dummy let to cause `t` to be fully captured
|
||||
let _t = t.0;
|
||||
};
|
||||
|
||||
|
|
@ -54,9 +53,9 @@ fn generic_struct_with_significant_drop_needs_migration() {
|
|||
|
||||
// move is used to force i32 to be copied instead of being a ref
|
||||
let c = move || { let _ = &t;
|
||||
//~^ ERROR: drop order
|
||||
//~| NOTE: for more information, see
|
||||
//~| HELP: add a dummy let to cause `t` to be fully captured
|
||||
//~^ ERROR: drop order
|
||||
//~| NOTE: for more information, see
|
||||
//~| HELP: add a dummy let to cause `t` to be fully captured
|
||||
let _t = t.1;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,7 @@
|
|||
// run-rustfix
|
||||
|
||||
#![deny(disjoint_capture_migration)]
|
||||
#![deny(rust_2021_incompatible_closure_captures)]
|
||||
//~^ NOTE: the lint level is defined here
|
||||
|
||||
#![feature(rustc_attrs)]
|
||||
#![allow(unused)]
|
||||
|
||||
|
|
@ -36,9 +35,9 @@ fn significant_drop_needs_migration() {
|
|||
let t = (SigDrop {}, SigDrop {});
|
||||
|
||||
let c = || {
|
||||
//~^ ERROR: drop order
|
||||
//~| NOTE: for more information, see
|
||||
//~| HELP: add a dummy let to cause `t` to be fully captured
|
||||
//~^ ERROR: drop order
|
||||
//~| NOTE: for more information, see
|
||||
//~| HELP: add a dummy let to cause `t` to be fully captured
|
||||
let _t = t.0;
|
||||
};
|
||||
|
||||
|
|
@ -54,9 +53,9 @@ fn generic_struct_with_significant_drop_needs_migration() {
|
|||
|
||||
// move is used to force i32 to be copied instead of being a ref
|
||||
let c = move || {
|
||||
//~^ ERROR: drop order
|
||||
//~| NOTE: for more information, see
|
||||
//~| HELP: add a dummy let to cause `t` to be fully captured
|
||||
//~^ ERROR: drop order
|
||||
//~| NOTE: for more information, see
|
||||
//~| HELP: add a dummy let to cause `t` to be fully captured
|
||||
let _t = t.1;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
error: drop order will change in Rust 2021
|
||||
--> $DIR/insignificant_drop_attr_migrations.rs:38:13
|
||||
--> $DIR/insignificant_drop_attr_migrations.rs:37:13
|
||||
|
|
||||
LL | let c = || {
|
||||
| _____________^
|
||||
|
|
@ -13,8 +13,8 @@ LL | | };
|
|||
note: the lint level is defined here
|
||||
--> $DIR/insignificant_drop_attr_migrations.rs:3:9
|
||||
|
|
||||
LL | #![deny(disjoint_capture_migration)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
LL | #![deny(rust_2021_incompatible_closure_captures)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/disjoint-capture-in-closures.html>
|
||||
help: add a dummy let to cause `t` to be fully captured
|
||||
|
|
||||
|
|
@ -27,7 +27,7 @@ LL | };
|
|||
|
|
||||
|
||||
error: drop order will change in Rust 2021
|
||||
--> $DIR/insignificant_drop_attr_migrations.rs:56:13
|
||||
--> $DIR/insignificant_drop_attr_migrations.rs:55:13
|
||||
|
|
||||
LL | let c = move || {
|
||||
| _____________^
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
// run-pass
|
||||
|
||||
#![deny(disjoint_capture_migration)]
|
||||
#![deny(rust_2021_incompatible_closure_captures)]
|
||||
#![feature(rustc_attrs)]
|
||||
#![allow(unused)]
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
// run-pass
|
||||
|
||||
#![warn(disjoint_capture_migration)]
|
||||
#![warn(rust_2021_incompatible_closure_captures)]
|
||||
|
||||
fn main() {
|
||||
if let a = "" {
|
||||
//~^ WARNING: irrefutable `if let` pattern
|
||||
//~^ WARNING: irrefutable `if let` pattern
|
||||
drop(|_: ()| drop(a));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// run-rustfix
|
||||
#![deny(disjoint_capture_migration)]
|
||||
#![deny(rust_2021_incompatible_closure_captures)]
|
||||
//~^ NOTE: the lint level is defined here
|
||||
|
||||
// Test the two possible cases for automated migartion using rustfix
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// run-rustfix
|
||||
#![deny(disjoint_capture_migration)]
|
||||
#![deny(rust_2021_incompatible_closure_captures)]
|
||||
//~^ NOTE: the lint level is defined here
|
||||
|
||||
// Test the two possible cases for automated migartion using rustfix
|
||||
|
|
|
|||
|
|
@ -13,8 +13,8 @@ LL | | };
|
|||
note: the lint level is defined here
|
||||
--> $DIR/migrations_rustfix.rs:2:9
|
||||
|
|
||||
LL | #![deny(disjoint_capture_migration)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
LL | #![deny(rust_2021_incompatible_closure_captures)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/disjoint-capture-in-closures.html>
|
||||
help: add a dummy let to cause `t` to be fully captured
|
||||
|
|
||||
|
|
|
|||
|
|
@ -1,16 +1,20 @@
|
|||
// run-rustfix
|
||||
|
||||
#![deny(disjoint_capture_migration)]
|
||||
#![deny(rust_2021_incompatible_closure_captures)]
|
||||
// ignore-wasm32-bare compiled with panic=abort by default
|
||||
|
||||
#![feature(fn_traits)]
|
||||
#![feature(never_type)]
|
||||
|
||||
use std::panic;
|
||||
|
||||
fn foo_diverges() -> ! { panic!() }
|
||||
fn foo_diverges() -> ! {
|
||||
panic!()
|
||||
}
|
||||
|
||||
fn assert_panics<F>(f: F) where F: FnOnce() {
|
||||
fn assert_panics<F>(f: F)
|
||||
where
|
||||
F: FnOnce(),
|
||||
{
|
||||
let f = panic::AssertUnwindSafe(f);
|
||||
let result = panic::catch_unwind(move || { let _ = &f;
|
||||
//~^ ERROR: `UnwindSafe`, `RefUnwindSafe` trait implementation
|
||||
|
|
@ -23,7 +27,8 @@ fn assert_panics<F>(f: F) where F: FnOnce() {
|
|||
}
|
||||
|
||||
fn test_fn_ptr_panic<T>(mut t: T)
|
||||
where T: Fn() -> !
|
||||
where
|
||||
T: Fn() -> !,
|
||||
{
|
||||
let as_fn = <T as Fn<()>>::call;
|
||||
assert_panics(|| as_fn(&t, ()));
|
||||
|
|
|
|||
|
|
@ -1,16 +1,20 @@
|
|||
// run-rustfix
|
||||
|
||||
#![deny(disjoint_capture_migration)]
|
||||
#![deny(rust_2021_incompatible_closure_captures)]
|
||||
// ignore-wasm32-bare compiled with panic=abort by default
|
||||
|
||||
#![feature(fn_traits)]
|
||||
#![feature(never_type)]
|
||||
|
||||
use std::panic;
|
||||
|
||||
fn foo_diverges() -> ! { panic!() }
|
||||
fn foo_diverges() -> ! {
|
||||
panic!()
|
||||
}
|
||||
|
||||
fn assert_panics<F>(f: F) where F: FnOnce() {
|
||||
fn assert_panics<F>(f: F)
|
||||
where
|
||||
F: FnOnce(),
|
||||
{
|
||||
let f = panic::AssertUnwindSafe(f);
|
||||
let result = panic::catch_unwind(move || {
|
||||
//~^ ERROR: `UnwindSafe`, `RefUnwindSafe` trait implementation
|
||||
|
|
@ -23,7 +27,8 @@ fn assert_panics<F>(f: F) where F: FnOnce() {
|
|||
}
|
||||
|
||||
fn test_fn_ptr_panic<T>(mut t: T)
|
||||
where T: Fn() -> !
|
||||
where
|
||||
T: Fn() -> !,
|
||||
{
|
||||
let as_fn = <T as Fn<()>>::call;
|
||||
assert_panics(|| as_fn(&t, ()));
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
error: `UnwindSafe`, `RefUnwindSafe` trait implementation will change in Rust 2021
|
||||
--> $DIR/mir_calls_to_shims.rs:15:38
|
||||
--> $DIR/mir_calls_to_shims.rs:19:38
|
||||
|
|
||||
LL | let result = panic::catch_unwind(move || {
|
||||
| ______________________________________^
|
||||
|
|
@ -12,8 +12,8 @@ LL | | });
|
|||
note: the lint level is defined here
|
||||
--> $DIR/mir_calls_to_shims.rs:3:9
|
||||
|
|
||||
LL | #![deny(disjoint_capture_migration)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
LL | #![deny(rust_2021_incompatible_closure_captures)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/disjoint-capture-in-closures.html>
|
||||
help: add a dummy let to cause `f` to be fully captured
|
||||
|
|
||||
|
|
|
|||
|
|
@ -2,8 +2,7 @@
|
|||
|
||||
// Set of test cases that don't need migrations
|
||||
|
||||
#![deny(disjoint_capture_migration)]
|
||||
|
||||
#![deny(rust_2021_incompatible_closure_captures)]
|
||||
|
||||
// Copy types as copied by the closure instead of being moved into the closure
|
||||
// Therefore their drop order isn't tied to the closure and won't be requiring any
|
||||
|
|
@ -53,7 +52,6 @@ fn test4_insignificant_drop_non_drop_aggregate() {
|
|||
c();
|
||||
}
|
||||
|
||||
|
||||
struct Foo(i32);
|
||||
impl Drop for Foo {
|
||||
fn drop(&mut self) {
|
||||
|
|
@ -80,5 +78,4 @@ fn main() {
|
|||
test3_only_copy_types_move_closure();
|
||||
test4_insignificant_drop_non_drop_aggregate();
|
||||
test5_significant_drop_non_drop_aggregate();
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
// run-rustfix
|
||||
|
||||
#![deny(disjoint_capture_migration)]
|
||||
#![deny(rust_2021_incompatible_closure_captures)]
|
||||
|
||||
#[derive(Debug)]
|
||||
struct Foo(i32);
|
||||
|
|
@ -17,8 +17,8 @@ fn test_precise_analysis_drop_paths_not_captured_by_move() {
|
|||
let t = ConstainsDropField(Foo(10), Foo(20));
|
||||
|
||||
let c = || { let _ = &t;
|
||||
//~^ ERROR: drop order
|
||||
//~| HELP: add a dummy let to cause `t` to be fully captured
|
||||
//~^ ERROR: drop order
|
||||
//~| HELP: add a dummy let to cause `t` to be fully captured
|
||||
let _t = t.0;
|
||||
let _t = &t.1;
|
||||
};
|
||||
|
|
@ -28,8 +28,7 @@ fn test_precise_analysis_drop_paths_not_captured_by_move() {
|
|||
|
||||
struct S;
|
||||
impl Drop for S {
|
||||
fn drop(&mut self) {
|
||||
}
|
||||
fn drop(&mut self) {}
|
||||
}
|
||||
|
||||
struct T(S, S);
|
||||
|
|
@ -40,8 +39,8 @@ fn test_precise_analysis_long_path_missing() {
|
|||
let u = U(T(S, S), T(S, S));
|
||||
|
||||
let c = || { let _ = &u;
|
||||
//~^ ERROR: drop order
|
||||
//~| HELP: add a dummy let to cause `u` to be fully captured
|
||||
//~^ ERROR: drop order
|
||||
//~| HELP: add a dummy let to cause `u` to be fully captured
|
||||
let _x = u.0.0;
|
||||
let _x = u.0.1;
|
||||
let _x = u.1.0;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
// run-rustfix
|
||||
|
||||
#![deny(disjoint_capture_migration)]
|
||||
#![deny(rust_2021_incompatible_closure_captures)]
|
||||
|
||||
#[derive(Debug)]
|
||||
struct Foo(i32);
|
||||
|
|
@ -17,8 +17,8 @@ fn test_precise_analysis_drop_paths_not_captured_by_move() {
|
|||
let t = ConstainsDropField(Foo(10), Foo(20));
|
||||
|
||||
let c = || {
|
||||
//~^ ERROR: drop order
|
||||
//~| HELP: add a dummy let to cause `t` to be fully captured
|
||||
//~^ ERROR: drop order
|
||||
//~| HELP: add a dummy let to cause `t` to be fully captured
|
||||
let _t = t.0;
|
||||
let _t = &t.1;
|
||||
};
|
||||
|
|
@ -28,8 +28,7 @@ fn test_precise_analysis_drop_paths_not_captured_by_move() {
|
|||
|
||||
struct S;
|
||||
impl Drop for S {
|
||||
fn drop(&mut self) {
|
||||
}
|
||||
fn drop(&mut self) {}
|
||||
}
|
||||
|
||||
struct T(S, S);
|
||||
|
|
@ -40,8 +39,8 @@ fn test_precise_analysis_long_path_missing() {
|
|||
let u = U(T(S, S), T(S, S));
|
||||
|
||||
let c = || {
|
||||
//~^ ERROR: drop order
|
||||
//~| HELP: add a dummy let to cause `u` to be fully captured
|
||||
//~^ ERROR: drop order
|
||||
//~| HELP: add a dummy let to cause `u` to be fully captured
|
||||
let _x = u.0.0;
|
||||
let _x = u.0.1;
|
||||
let _x = u.1.0;
|
||||
|
|
|
|||
|
|
@ -13,8 +13,8 @@ LL | | };
|
|||
note: the lint level is defined here
|
||||
--> $DIR/precise.rs:3:9
|
||||
|
|
||||
LL | #![deny(disjoint_capture_migration)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
LL | #![deny(rust_2021_incompatible_closure_captures)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/disjoint-capture-in-closures.html>
|
||||
help: add a dummy let to cause `t` to be fully captured
|
||||
|
|
||||
|
|
@ -27,7 +27,7 @@ LL | };
|
|||
|
|
||||
|
||||
error: drop order will change in Rust 2021
|
||||
--> $DIR/precise.rs:42:13
|
||||
--> $DIR/precise.rs:41:13
|
||||
|
|
||||
LL | let c = || {
|
||||
| _____________^
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
// run-pass
|
||||
|
||||
#![deny(disjoint_capture_migration)]
|
||||
#![deny(rust_2021_incompatible_closure_captures)]
|
||||
|
||||
#[derive(Debug)]
|
||||
struct Foo(i32);
|
||||
|
|
@ -73,8 +73,7 @@ fn test_precise_analysis_parent_captured_2() {
|
|||
|
||||
struct S;
|
||||
impl Drop for S {
|
||||
fn drop(&mut self) {
|
||||
}
|
||||
fn drop(&mut self) {}
|
||||
}
|
||||
|
||||
struct T(S, S);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// run-rustfix
|
||||
#![deny(disjoint_capture_migration)]
|
||||
#![deny(rust_2021_incompatible_closure_captures)]
|
||||
//~^ NOTE: the lint level is defined here
|
||||
|
||||
// Test cases for types that implement a significant drop (user defined)
|
||||
|
|
@ -23,9 +23,9 @@ fn test1_all_need_migration() {
|
|||
let t2 = (Foo(0), Foo(0));
|
||||
|
||||
let c = || { let _ = (&t, &t1, &t2);
|
||||
//~^ ERROR: drop order
|
||||
//~| NOTE: for more information, see
|
||||
//~| HELP: add a dummy let to cause `t`, `t1`, `t2` to be fully captured
|
||||
//~^ ERROR: drop order
|
||||
//~| NOTE: for more information, see
|
||||
//~| HELP: add a dummy let to cause `t`, `t1`, `t2` to be fully captured
|
||||
let _t = t.0;
|
||||
let _t1 = t1.0;
|
||||
let _t2 = t2.0;
|
||||
|
|
@ -42,9 +42,9 @@ fn test2_only_precise_paths_need_migration() {
|
|||
let t2 = (Foo(0), Foo(0));
|
||||
|
||||
let c = || { let _ = (&t, &t1);
|
||||
//~^ ERROR: drop order
|
||||
//~| NOTE: for more information, see
|
||||
//~| HELP: add a dummy let to cause `t`, `t1` to be fully captured
|
||||
//~^ ERROR: drop order
|
||||
//~| NOTE: for more information, see
|
||||
//~| HELP: add a dummy let to cause `t`, `t1` to be fully captured
|
||||
let _t = t.0;
|
||||
let _t1 = t1.0;
|
||||
let _t2 = t2;
|
||||
|
|
@ -59,9 +59,9 @@ fn test3_only_by_value_need_migration() {
|
|||
let t = (Foo(0), Foo(0));
|
||||
let t1 = (Foo(0), Foo(0));
|
||||
let c = || { let _ = &t;
|
||||
//~^ ERROR: drop order
|
||||
//~| NOTE: for more information, see
|
||||
//~| HELP: add a dummy let to cause `t` to be fully captured
|
||||
//~^ ERROR: drop order
|
||||
//~| NOTE: for more information, see
|
||||
//~| HELP: add a dummy let to cause `t` to be fully captured
|
||||
let _t = t.0;
|
||||
println!("{:?}", t1.1);
|
||||
};
|
||||
|
|
@ -77,9 +77,9 @@ fn test4_type_contains_drop_need_migration() {
|
|||
let t = ConstainsDropField(Foo(0), Foo(0));
|
||||
|
||||
let c = || { let _ = &t;
|
||||
//~^ ERROR: drop order
|
||||
//~| NOTE: for more information, see
|
||||
//~| HELP: add a dummy let to cause `t` to be fully captured
|
||||
//~^ ERROR: drop order
|
||||
//~| NOTE: for more information, see
|
||||
//~| HELP: add a dummy let to cause `t` to be fully captured
|
||||
let _t = t.0;
|
||||
};
|
||||
|
||||
|
|
@ -93,9 +93,9 @@ fn test5_drop_non_drop_aggregate_need_migration() {
|
|||
let t = (Foo(0), Foo(0), 0i32);
|
||||
|
||||
let c = || { let _ = &t;
|
||||
//~^ ERROR: drop order
|
||||
//~| NOTE: for more information, see
|
||||
//~| HELP: add a dummy let to cause `t` to be fully captured
|
||||
//~^ ERROR: drop order
|
||||
//~| NOTE: for more information, see
|
||||
//~| HELP: add a dummy let to cause `t` to be fully captured
|
||||
let _t = t.0;
|
||||
};
|
||||
|
||||
|
|
@ -107,9 +107,9 @@ fn test6_significant_insignificant_drop_aggregate_need_migration() {
|
|||
let t = (Foo(0), String::new());
|
||||
|
||||
let c = || { let _ = &t;
|
||||
//~^ ERROR: drop order
|
||||
//~| NOTE: for more information, see
|
||||
//~| HELP: add a dummy let to cause `t` to be fully captured
|
||||
//~^ ERROR: drop order
|
||||
//~| NOTE: for more information, see
|
||||
//~| HELP: add a dummy let to cause `t` to be fully captured
|
||||
let _t = t.1;
|
||||
};
|
||||
|
||||
|
|
@ -123,9 +123,9 @@ fn test7_move_closures_non_copy_types_might_need_migration() {
|
|||
let t1 = (Foo(0), Foo(0), Foo(0));
|
||||
|
||||
let c = move || { let _ = (&t1, &t);
|
||||
//~^ ERROR: drop order
|
||||
//~| NOTE: for more information, see
|
||||
//~| HELP: add a dummy let to cause `t1`, `t` to be fully captured
|
||||
//~^ ERROR: drop order
|
||||
//~| NOTE: for more information, see
|
||||
//~| HELP: add a dummy let to cause `t1`, `t` to be fully captured
|
||||
println!("{:?} {:?}", t1.1, t.1);
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// run-rustfix
|
||||
#![deny(disjoint_capture_migration)]
|
||||
#![deny(rust_2021_incompatible_closure_captures)]
|
||||
//~^ NOTE: the lint level is defined here
|
||||
|
||||
// Test cases for types that implement a significant drop (user defined)
|
||||
|
|
@ -23,9 +23,9 @@ fn test1_all_need_migration() {
|
|||
let t2 = (Foo(0), Foo(0));
|
||||
|
||||
let c = || {
|
||||
//~^ ERROR: drop order
|
||||
//~| NOTE: for more information, see
|
||||
//~| HELP: add a dummy let to cause `t`, `t1`, `t2` to be fully captured
|
||||
//~^ ERROR: drop order
|
||||
//~| NOTE: for more information, see
|
||||
//~| HELP: add a dummy let to cause `t`, `t1`, `t2` to be fully captured
|
||||
let _t = t.0;
|
||||
let _t1 = t1.0;
|
||||
let _t2 = t2.0;
|
||||
|
|
@ -42,9 +42,9 @@ fn test2_only_precise_paths_need_migration() {
|
|||
let t2 = (Foo(0), Foo(0));
|
||||
|
||||
let c = || {
|
||||
//~^ ERROR: drop order
|
||||
//~| NOTE: for more information, see
|
||||
//~| HELP: add a dummy let to cause `t`, `t1` to be fully captured
|
||||
//~^ ERROR: drop order
|
||||
//~| NOTE: for more information, see
|
||||
//~| HELP: add a dummy let to cause `t`, `t1` to be fully captured
|
||||
let _t = t.0;
|
||||
let _t1 = t1.0;
|
||||
let _t2 = t2;
|
||||
|
|
@ -59,9 +59,9 @@ fn test3_only_by_value_need_migration() {
|
|||
let t = (Foo(0), Foo(0));
|
||||
let t1 = (Foo(0), Foo(0));
|
||||
let c = || {
|
||||
//~^ ERROR: drop order
|
||||
//~| NOTE: for more information, see
|
||||
//~| HELP: add a dummy let to cause `t` to be fully captured
|
||||
//~^ ERROR: drop order
|
||||
//~| NOTE: for more information, see
|
||||
//~| HELP: add a dummy let to cause `t` to be fully captured
|
||||
let _t = t.0;
|
||||
println!("{:?}", t1.1);
|
||||
};
|
||||
|
|
@ -77,9 +77,9 @@ fn test4_type_contains_drop_need_migration() {
|
|||
let t = ConstainsDropField(Foo(0), Foo(0));
|
||||
|
||||
let c = || {
|
||||
//~^ ERROR: drop order
|
||||
//~| NOTE: for more information, see
|
||||
//~| HELP: add a dummy let to cause `t` to be fully captured
|
||||
//~^ ERROR: drop order
|
||||
//~| NOTE: for more information, see
|
||||
//~| HELP: add a dummy let to cause `t` to be fully captured
|
||||
let _t = t.0;
|
||||
};
|
||||
|
||||
|
|
@ -93,9 +93,9 @@ fn test5_drop_non_drop_aggregate_need_migration() {
|
|||
let t = (Foo(0), Foo(0), 0i32);
|
||||
|
||||
let c = || {
|
||||
//~^ ERROR: drop order
|
||||
//~| NOTE: for more information, see
|
||||
//~| HELP: add a dummy let to cause `t` to be fully captured
|
||||
//~^ ERROR: drop order
|
||||
//~| NOTE: for more information, see
|
||||
//~| HELP: add a dummy let to cause `t` to be fully captured
|
||||
let _t = t.0;
|
||||
};
|
||||
|
||||
|
|
@ -107,9 +107,9 @@ fn test6_significant_insignificant_drop_aggregate_need_migration() {
|
|||
let t = (Foo(0), String::new());
|
||||
|
||||
let c = || {
|
||||
//~^ ERROR: drop order
|
||||
//~| NOTE: for more information, see
|
||||
//~| HELP: add a dummy let to cause `t` to be fully captured
|
||||
//~^ ERROR: drop order
|
||||
//~| NOTE: for more information, see
|
||||
//~| HELP: add a dummy let to cause `t` to be fully captured
|
||||
let _t = t.1;
|
||||
};
|
||||
|
||||
|
|
@ -123,9 +123,9 @@ fn test7_move_closures_non_copy_types_might_need_migration() {
|
|||
let t1 = (Foo(0), Foo(0), Foo(0));
|
||||
|
||||
let c = move || {
|
||||
//~^ ERROR: drop order
|
||||
//~| NOTE: for more information, see
|
||||
//~| HELP: add a dummy let to cause `t1`, `t` to be fully captured
|
||||
//~^ ERROR: drop order
|
||||
//~| NOTE: for more information, see
|
||||
//~| HELP: add a dummy let to cause `t1`, `t` to be fully captured
|
||||
println!("{:?} {:?}", t1.1, t.1);
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -14,8 +14,8 @@ LL | | };
|
|||
note: the lint level is defined here
|
||||
--> $DIR/significant_drop.rs:2:9
|
||||
|
|
||||
LL | #![deny(disjoint_capture_migration)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
LL | #![deny(rust_2021_incompatible_closure_captures)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/disjoint-capture-in-closures.html>
|
||||
help: add a dummy let to cause `t`, `t1`, `t2` to be fully captured
|
||||
|
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue