Address comments
This commit is contained in:
parent
ca44372957
commit
8cbeaf7382
7 changed files with 15 additions and 15 deletions
|
|
@ -56,7 +56,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 for closure, and drop order
|
||||
//~^ ERROR: `Clone` trait implementation for closure and drop order
|
||||
//~| NOTE: in Rust 2018, this closure would implement `Clone` as `f` implements `Clone`, but in Rust 2021, this closure would no longer implement `Clone` as `f.1` does not implement `Clone`
|
||||
//~| NOTE: for more information, see
|
||||
//~| HELP: add a dummy let to cause `f` to be fully captured
|
||||
|
|
|
|||
|
|
@ -56,7 +56,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 for closure, and drop order
|
||||
//~^ ERROR: `Clone` trait implementation for closure and drop order
|
||||
//~| NOTE: in Rust 2018, this closure would implement `Clone` as `f` implements `Clone`, but in Rust 2021, this closure would no longer implement `Clone` as `f.1` does not implement `Clone`
|
||||
//~| NOTE: for more information, see
|
||||
//~| HELP: add a dummy let to cause `f` to be fully captured
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ LL |
|
|||
LL | *fptr.0.0 = 20;
|
||||
...
|
||||
|
||||
error: changes to closure capture in Rust 2021 will affect `Clone` trait implementation for closure, and drop order
|
||||
error: changes to closure capture in Rust 2021 will affect `Clone` trait implementation for closure and drop order
|
||||
--> $DIR/auto_traits.rs:58:13
|
||||
|
|
||||
LL | let c = || {
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ fn test_multi_issues() {
|
|||
let f1 = U(S(String::from("foo")), T(0));
|
||||
let f2 = U(S(String::from("bar")), T(0));
|
||||
let c = || { let _ = (&f1, &f2);
|
||||
//~^ ERROR: `Clone` trait implementation for closure, and drop order
|
||||
//~^ ERROR: `Clone` trait implementation for closure and drop order
|
||||
//~| NOTE: in Rust 2018, this closure would implement `Clone` as `f1` implements `Clone`, but in Rust 2021, this closure would no longer implement `Clone` as `f1.0` does not implement `Clone`
|
||||
//~| NOTE: for more information, see
|
||||
//~| HELP: add a dummy let to cause `f1`, `f2` to be fully captured
|
||||
|
|
@ -84,7 +84,7 @@ fn test_capturing_several_disjoint_fields_individually_1() {
|
|||
fn test_capturing_several_disjoint_fields_individually_2() {
|
||||
let f1 = U1(S(String::from("foo")), T(0), S(String::from("bar")));
|
||||
let c = || { let _ = &f1;
|
||||
//~^ ERROR: `Clone` trait implementation for closure, and drop order
|
||||
//~^ ERROR: `Clone` trait implementation for closure and drop order
|
||||
//~| NOTE: in Rust 2018, this closure would implement `Clone` as `f1` implements `Clone`, but in Rust 2021, this closure would no longer implement `Clone` as `f1.0` does not implement `Clone`
|
||||
//~| NOTE: for more information, see
|
||||
//~| HELP: add a dummy let to cause `f1` to be fully captured
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ fn test_multi_issues() {
|
|||
let f1 = U(S(String::from("foo")), T(0));
|
||||
let f2 = U(S(String::from("bar")), T(0));
|
||||
let c = || {
|
||||
//~^ ERROR: `Clone` trait implementation for closure, and drop order
|
||||
//~^ ERROR: `Clone` trait implementation for closure and drop order
|
||||
//~| NOTE: in Rust 2018, this closure would implement `Clone` as `f1` implements `Clone`, but in Rust 2021, this closure would no longer implement `Clone` as `f1.0` does not implement `Clone`
|
||||
//~| NOTE: for more information, see
|
||||
//~| HELP: add a dummy let to cause `f1`, `f2` to be fully captured
|
||||
|
|
@ -84,7 +84,7 @@ fn test_capturing_several_disjoint_fields_individually_1() {
|
|||
fn test_capturing_several_disjoint_fields_individually_2() {
|
||||
let f1 = U1(S(String::from("foo")), T(0), S(String::from("bar")));
|
||||
let c = || {
|
||||
//~^ ERROR: `Clone` trait implementation for closure, and drop order
|
||||
//~^ ERROR: `Clone` trait implementation for closure and drop order
|
||||
//~| NOTE: in Rust 2018, this closure would implement `Clone` as `f1` implements `Clone`, but in Rust 2021, this closure would no longer implement `Clone` as `f1.0` does not implement `Clone`
|
||||
//~| NOTE: for more information, see
|
||||
//~| HELP: add a dummy let to cause `f1` to be fully captured
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
error: changes to closure capture in Rust 2021 will affect `Clone` trait implementation for closure, and drop order
|
||||
error: changes to closure capture in Rust 2021 will affect `Clone` trait implementation for closure and drop order
|
||||
--> $DIR/multi_diagnostics.rs:23:13
|
||||
|
|
||||
LL | let c = || {
|
||||
|
|
@ -75,7 +75,7 @@ LL |
|
|||
LL |
|
||||
...
|
||||
|
||||
error: changes to closure capture in Rust 2021 will affect `Clone` trait implementation for closure, and drop order
|
||||
error: changes to closure capture in Rust 2021 will affect `Clone` trait implementation for closure and drop order
|
||||
--> $DIR/multi_diagnostics.rs:86:13
|
||||
|
|
||||
LL | let c = || {
|
||||
|
|
@ -90,8 +90,8 @@ LL | let _f_1 = f1.1;
|
|||
LL | }
|
||||
| -
|
||||
| |
|
||||
| in Rust 2018, `f1` would be dropped here, but in Rust 2021, only `f1.0` would be dropped here alongside the closure
|
||||
| in Rust 2018, `f1` would be dropped here, but in Rust 2021, only `f1.1` would be dropped here alongside the closure
|
||||
| in Rust 2018, `f1` would be dropped here, but in Rust 2021, only `f1.0` would be dropped here alongside the closure
|
||||
|
|
||||
= 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 `f1` to be fully captured
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue