Address comments
This commit is contained in:
parent
ca44372957
commit
8cbeaf7382
7 changed files with 15 additions and 15 deletions
|
@ -619,7 +619,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||
}
|
||||
|
||||
if auto_trait_reasons.len() > 0 && drop_reason {
|
||||
reasons = format!("{}, and ", reasons);
|
||||
reasons = format!("{} and ", reasons);
|
||||
}
|
||||
|
||||
if drop_reason {
|
||||
|
@ -886,12 +886,12 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||
};
|
||||
|
||||
// Combine all the captures responsible for needing migrations into one HashSet
|
||||
let mut capture_disagnostic = drop_reorder_diagnostic.clone();
|
||||
let mut capture_diagnostic = drop_reorder_diagnostic.clone();
|
||||
for key in auto_trait_diagnostic.keys() {
|
||||
capture_disagnostic.insert(key.clone());
|
||||
capture_diagnostic.insert(key.clone());
|
||||
}
|
||||
|
||||
for captured_info in capture_disagnostic.iter() {
|
||||
for captured_info in capture_diagnostic.iter() {
|
||||
// Get the auto trait reasons of why migration is needed because of that capture, if there are any
|
||||
let capture_trait_reasons =
|
||||
if let Some(reasons) = auto_trait_diagnostic.get(captured_info) {
|
||||
|
@ -917,7 +917,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||
));
|
||||
}
|
||||
|
||||
if capture_disagnostic.len() > 0 {
|
||||
if capture_diagnostic.len() > 0 {
|
||||
need_migrations.push((var_hir_id, responsible_captured_hir_ids));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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