Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improves migrations lint for RFC2229 #86965

Merged
merged 9 commits into from
Jul 11, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update error message
roxelo committed Jul 9, 2021

Verified

This commit was signed with the committer’s verified signature.
jaybuidl jaybuidl
commit 0e8e89daa6c53b32e866205fd00ba385c66b90de
4 changes: 2 additions & 2 deletions compiler/rustc_typeck/src/check/upvar.rs
Original file line number Diff line number Diff line change
@@ -505,7 +505,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|lint| {
let mut diagnostics_builder = lint.build(
format!(
"{} will change in Rust 2021",
"changes to closure capture in Rust 2021 will affect {}",
reasons
)
.as_str(),
@@ -567,7 +567,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {

if auto_trait_reasons.len() > 0 {
reasons = format!(
"{} trait implementation",
"{} closure trait implementation",
auto_trait_reasons.clone().into_iter().collect::<Vec<&str>>().join(", ")
);
}
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@ fn test_send_trait() {
let mut f = 10;
let fptr = SendPointer(&mut f as *mut i32);
thread::spawn(move || { let _ = &fptr; unsafe {
//~^ ERROR: `Send` trait implementation
//~^ ERROR: `Send` closure trait implementation
//~| HELP: add a dummy let to cause `fptr` to be fully captured
*fptr.0 = 20;
} });
@@ -28,7 +28,7 @@ fn test_sync_trait() {
let f = CustomInt(&mut f as *mut i32);
let fptr = SyncPointer(f);
thread::spawn(move || { let _ = &fptr; unsafe {
//~^ ERROR: `Sync`, `Send` trait implementation
//~^ ERROR: `Sync`, `Send` closure trait implementation
//~| HELP: add a dummy let to cause `fptr` to be fully captured
*fptr.0.0 = 20;
} });
@@ -49,7 +49,7 @@ impl Clone for U {
fn test_clone_trait() {
let f = U(S(String::from("Hello World")), T(0));
let c = || { let _ = &f;
//~^ ERROR: `Clone` trait implementation, and drop order
//~^ ERROR: `Clone` closure trait implementation, and drop order
//~| HELP: add a dummy let to cause `f` to be fully captured
let f_1 = f.1;
println!("{:?}", f_1.0);
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@ fn test_send_trait() {
let mut f = 10;
let fptr = SendPointer(&mut f as *mut i32);
thread::spawn(move || unsafe {
//~^ ERROR: `Send` trait implementation
//~^ ERROR: `Send` closure trait implementation
//~| HELP: add a dummy let to cause `fptr` to be fully captured
*fptr.0 = 20;
});
@@ -28,7 +28,7 @@ fn test_sync_trait() {
let f = CustomInt(&mut f as *mut i32);
let fptr = SyncPointer(f);
thread::spawn(move || unsafe {
//~^ ERROR: `Sync`, `Send` trait implementation
//~^ ERROR: `Sync`, `Send` closure trait implementation
//~| HELP: add a dummy let to cause `fptr` to be fully captured
*fptr.0.0 = 20;
});
@@ -49,7 +49,7 @@ impl Clone for U {
fn test_clone_trait() {
let f = U(S(String::from("Hello World")), T(0));
let c = || {
//~^ ERROR: `Clone` trait implementation, and drop order
//~^ ERROR: `Clone` closure trait implementation, and drop order
//~| HELP: add a dummy let to cause `f` to be fully captured
let f_1 = f.1;
println!("{:?}", f_1.0);
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error: `Send` trait implementation will change in Rust 2021
error: changes to closure capture in Rust 2021 will affect `Send` closure trait implementation
--> $DIR/auto_traits.rs:13:19
|
LL | thread::spawn(move || unsafe {
@@ -25,7 +25,7 @@ LL | *fptr.0 = 20;
LL | } });
|

error: `Sync`, `Send` trait implementation will change in Rust 2021
error: changes to closure capture in Rust 2021 will affect `Sync`, `Send` closure trait implementation
--> $DIR/auto_traits.rs:30:19
|
LL | thread::spawn(move || unsafe {
@@ -47,7 +47,7 @@ LL | *fptr.0.0 = 20;
LL | } });
|

error: `Clone` trait implementation, and drop order will change in Rust 2021
error: changes to closure capture in Rust 2021 will affect `Clone` closure trait implementation, and drop order
--> $DIR/auto_traits.rs:51:13
|
LL | let c = || {
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error: drop order will change in Rust 2021
error: changes to closure capture in Rust 2021 will affect drop order
--> $DIR/insignificant_drop.rs:15:13
|
LL | let c = || {
@@ -35,7 +35,7 @@ LL |
LL | let _t = t.0;
...

error: drop order will change in Rust 2021
error: changes to closure capture in Rust 2021 will affect drop order
--> $DIR/insignificant_drop.rs:38:13
|
LL | let c = || {
@@ -64,7 +64,7 @@ LL | let _t = t.0;
LL |
...

error: drop order will change in Rust 2021
error: changes to closure capture in Rust 2021 will affect drop order
--> $DIR/insignificant_drop.rs:57:13
|
LL | let c = || {
@@ -90,7 +90,7 @@ LL | let _t = t.0;
LL |
...

error: drop order will change in Rust 2021
error: changes to closure capture in Rust 2021 will affect drop order
--> $DIR/insignificant_drop.rs:77:13
|
LL | let c = || {
@@ -116,7 +116,7 @@ LL | let _t = t.0;
LL |
...

error: drop order will change in Rust 2021
error: changes to closure capture in Rust 2021 will affect drop order
--> $DIR/insignificant_drop.rs:97:13
|
LL | let c = || {
@@ -142,7 +142,7 @@ LL | let _t = t.0;
LL |
...

error: drop order will change in Rust 2021
error: changes to closure capture in Rust 2021 will affect drop order
--> $DIR/insignificant_drop.rs:114:13
|
LL | let c = move || {
@@ -170,7 +170,7 @@ LL | println!("{} {}", t1.1, t.1);
LL |
...

error: drop order will change in Rust 2021
error: changes to closure capture in Rust 2021 will affect drop order
--> $DIR/insignificant_drop.rs:132:13
|
LL | let c = || {
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error: drop order will change in Rust 2021
error: changes to closure capture in Rust 2021 will affect drop order
--> $DIR/insignificant_drop_attr_migrations.rs:37:13
|
LL | let c = || {
@@ -28,7 +28,7 @@ LL | let _t = t.0;
LL |
...

error: drop order will change in Rust 2021
error: changes to closure capture in Rust 2021 will affect drop order
--> $DIR/insignificant_drop_attr_migrations.rs:56:13
|
LL | let c = move || {
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error: drop order will change in Rust 2021
error: changes to closure capture in Rust 2021 will affect drop order
--> $DIR/migrations_rustfix.rs:19:13
|
LL | let c = || {
@@ -29,7 +29,7 @@ LL | let _t = t.0;
LL |
...

error: drop order will change in Rust 2021
error: changes to closure capture in Rust 2021 will affect drop order
--> $DIR/migrations_rustfix.rs:33:13
|
LL | let c = || t.0;
Original file line number Diff line number Diff line change
@@ -17,7 +17,7 @@ where
{
let f = panic::AssertUnwindSafe(f);
let result = panic::catch_unwind(move || { let _ = &f;
//~^ ERROR: `UnwindSafe`, `RefUnwindSafe` trait implementation
//~^ ERROR: `UnwindSafe`, `RefUnwindSafe` closure trait implementation
//~| HELP: add a dummy let to cause `f` to be fully captured
f.0()
});
Original file line number Diff line number Diff line change
@@ -17,7 +17,7 @@ where
{
let f = panic::AssertUnwindSafe(f);
let result = panic::catch_unwind(move || {
//~^ ERROR: `UnwindSafe`, `RefUnwindSafe` trait implementation
//~^ ERROR: `UnwindSafe`, `RefUnwindSafe` closure trait implementation
//~| HELP: add a dummy let to cause `f` to be fully captured
f.0()
});
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error: `UnwindSafe`, `RefUnwindSafe` trait implementation will change in Rust 2021
error: changes to closure capture in Rust 2021 will affect `UnwindSafe`, `RefUnwindSafe` closure trait implementation
--> $DIR/mir_calls_to_shims.rs:19:38
|
LL | let result = panic::catch_unwind(move || {
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error: drop order will change in Rust 2021
error: changes to closure capture in Rust 2021 will affect drop order
--> $DIR/precise.rs:19:13
|
LL | let c = || {
@@ -27,7 +27,7 @@ LL | let _t = &t.1;
LL | };
|

error: drop order will change in Rust 2021
error: changes to closure capture in Rust 2021 will affect drop order
--> $DIR/precise.rs:41:13
|
LL | let c = || {
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error: drop order will change in Rust 2021
error: changes to closure capture in Rust 2021 will affect drop order
--> $DIR/significant_drop.rs:25:13
|
LL | let c = || {
@@ -34,7 +34,7 @@ LL | let _t = t.0;
LL |
...

error: drop order will change in Rust 2021
error: changes to closure capture in Rust 2021 will affect drop order
--> $DIR/significant_drop.rs:47:13
|
LL | let c = || {
@@ -63,7 +63,7 @@ LL | let _t = t.0;
LL |
...

error: drop order will change in Rust 2021
error: changes to closure capture in Rust 2021 will affect drop order
--> $DIR/significant_drop.rs:66:13
|
LL | let c = || {
@@ -89,7 +89,7 @@ LL | let _t = t.0;
LL |
...

error: drop order will change in Rust 2021
error: changes to closure capture in Rust 2021 will affect drop order
--> $DIR/significant_drop.rs:85:13
|
LL | let c = || {
@@ -114,7 +114,7 @@ LL | let _t = t.0;
LL |
...

error: drop order will change in Rust 2021
error: changes to closure capture in Rust 2021 will affect drop order
--> $DIR/significant_drop.rs:102:13
|
LL | let c = || {
@@ -139,7 +139,7 @@ LL | let _t = t.0;
LL |
...

error: drop order will change in Rust 2021
error: changes to closure capture in Rust 2021 will affect drop order
--> $DIR/significant_drop.rs:117:13
|
LL | let c = || {
@@ -164,7 +164,7 @@ LL | let _t = t.1;
LL |
...

error: drop order will change in Rust 2021
error: changes to closure capture in Rust 2021 will affect drop order
--> $DIR/significant_drop.rs:134:13
|
LL | let c = move || {