Fix wording
This commit is contained in:
parent
36eb5442bd
commit
81b062ae88
12 changed files with 250 additions and 397 deletions
|
|
@ -498,10 +498,12 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||
|
||||
let local_def_id = closure_def_id.expect_local();
|
||||
let closure_hir_id = self.tcx.hir().local_def_id_to_hir_id(local_def_id);
|
||||
let closure_span = self.tcx.hir().span(closure_hir_id);
|
||||
let closure_head_span = self.tcx.sess.source_map().guess_head_span(closure_span);
|
||||
self.tcx.struct_span_lint_hir(
|
||||
lint::builtin::RUST_2021_INCOMPATIBLE_CLOSURE_CAPTURES,
|
||||
closure_hir_id,
|
||||
span,
|
||||
closure_head_span,
|
||||
|lint| {
|
||||
let mut diagnostics_builder = lint.build(
|
||||
format!(
|
||||
|
|
@ -512,6 +514,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||
);
|
||||
for (var_hir_id, diagnostics_info) in need_migrations.iter() {
|
||||
let mut captured_names = format!("");
|
||||
// Label every Span which are responsible for the captured values
|
||||
for (captured_hir_id, captured_name) in diagnostics_info.iter() {
|
||||
if let Some(captured_hir_id) = captured_hir_id {
|
||||
let cause_span = self.tcx.hir().span(*captured_hir_id);
|
||||
|
|
@ -527,6 +530,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||
}
|
||||
}
|
||||
|
||||
// Add a label pointing to where a closure and it's captured variables affected by drop order are dropped
|
||||
if reasons.contains("drop order") {
|
||||
let drop_location_span = drop_location_span(self.tcx, &closure_hir_id);
|
||||
|
||||
|
|
@ -536,13 +540,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||
));
|
||||
}
|
||||
|
||||
if reasons.contains("closure trait implementation") {
|
||||
let closure_body_span = self.tcx.hir().span(body_id.hir_id);
|
||||
let closure_ending_span = self.tcx.sess.source_map().guess_head_span(closure_body_span).shrink_to_lo();
|
||||
// Add a label explaining why a closure no longer implements a trait
|
||||
if reasons.contains("trait implementation") {
|
||||
let missing_trait = &reasons[..reasons.find("trait implementation").unwrap() - 1];
|
||||
|
||||
let missing_trait = &reasons[..reasons.find("closure trait implementation").unwrap() - 1];
|
||||
|
||||
diagnostics_builder.span_label(closure_ending_span, format!("in Rust 2018, this closure would implement {} as `{}` implements {}, but in Rust 2021, this closure will no longer implement {} as {} does not implement {}",
|
||||
diagnostics_builder.span_label(closure_head_span, format!("in Rust 2018, this closure would implement {} as `{}` implements {}, but in Rust 2021, this closure would no longer implement {} as {} does not implement {}",
|
||||
missing_trait,
|
||||
self.tcx.hir().name(*var_hir_id),
|
||||
missing_trait,
|
||||
|
|
@ -598,7 +600,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||
|
||||
if auto_trait_reasons.len() > 0 {
|
||||
reasons = format!(
|
||||
"{} closure trait implementation",
|
||||
"{} trait implementation for closure",
|
||||
auto_trait_reasons.clone().into_iter().collect::<Vec<&str>>().join(", ")
|
||||
);
|
||||
}
|
||||
|
|
@ -1386,24 +1388,19 @@ fn drop_location_span(tcx: TyCtxt<'tcx>, hir_id: &hir::HirId) -> Span {
|
|||
let owner_id = tcx.hir().get_enclosing_scope(*hir_id).unwrap();
|
||||
|
||||
let owner_node = tcx.hir().get(owner_id);
|
||||
match owner_node {
|
||||
let owner_span = match owner_node {
|
||||
hir::Node::Item(item) => match item.kind {
|
||||
hir::ItemKind::Fn(_, _, owner_id) => {
|
||||
let owner_span = tcx.hir().span(owner_id.hir_id);
|
||||
tcx.sess.source_map().end_point(owner_span)
|
||||
}
|
||||
hir::ItemKind::Fn(_, _, owner_id) => tcx.hir().span(owner_id.hir_id),
|
||||
_ => {
|
||||
bug!("Drop location span error: need to handle more ItemKind {:?}", item.kind);
|
||||
}
|
||||
},
|
||||
hir::Node::Block(block) => {
|
||||
let owner_span = tcx.hir().span(block.hir_id);
|
||||
tcx.sess.source_map().end_point(owner_span)
|
||||
}
|
||||
hir::Node::Block(block) => tcx.hir().span(block.hir_id),
|
||||
_ => {
|
||||
bug!("Drop location span error: need to handle more Node {:?}", owner_node);
|
||||
}
|
||||
}
|
||||
};
|
||||
tcx.sess.source_map().end_point(owner_span)
|
||||
}
|
||||
|
||||
struct InferBorrowKind<'a, 'tcx> {
|
||||
|
|
|
|||
|
|
@ -12,8 +12,8 @@ fn test_send_trait() {
|
|||
let mut f = 10;
|
||||
let fptr = SendPointer(&mut f as *mut i32);
|
||||
thread::spawn(move || { let _ = &fptr; unsafe {
|
||||
//~^ ERROR: `Send` closure trait implementation
|
||||
//~| NOTE: in Rust 2018, this closure would implement `Send` as `fptr` implements `Send`, but in Rust 2021, this closure will no longer implement `Send` as `fptr.0` does not implement `Send`
|
||||
//~^ ERROR: `Send` trait implementation for closure
|
||||
//~| NOTE: in Rust 2018, this closure would implement `Send` as `fptr` implements `Send`, but in Rust 2021, this closure would no longer implement `Send` as `fptr.0` does not implement `Send`
|
||||
//~| NOTE: for more information, see
|
||||
//~| HELP: add a dummy let to cause `fptr` to be fully captured
|
||||
*fptr.0 = 20;
|
||||
|
|
@ -32,8 +32,8 @@ 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` closure trait implementation
|
||||
//~| NOTE: in Rust 2018, this closure would implement `Sync`, `Send` as `fptr` implements `Sync`, `Send`, but in Rust 2021, this closure will no longer implement `Sync`, `Send` as `fptr.0.0` does not implement `Sync`, `Send`
|
||||
//~^ ERROR: `Sync`, `Send` trait implementation for closure
|
||||
//~| NOTE: in Rust 2018, this closure would implement `Sync`, `Send` as `fptr` implements `Sync`, `Send`, but in Rust 2021, this closure would no longer implement `Sync`, `Send` as `fptr.0.0` does not implement `Sync`, `Send`
|
||||
//~| NOTE: for more information, see
|
||||
//~| HELP: add a dummy let to cause `fptr` to be fully captured
|
||||
*fptr.0.0 = 20;
|
||||
|
|
@ -56,8 +56,8 @@ impl Clone for U {
|
|||
fn test_clone_trait() {
|
||||
let f = U(S(String::from("Hello World")), T(0));
|
||||
let c = || { let _ = &f;
|
||||
//~^ ERROR: `Clone` closure trait implementation, and drop order
|
||||
//~| NOTE: in Rust 2018, this closure would implement `Clone` as `f` implements `Clone`, but in Rust 2021, this closure will no longer implement `Clone` as `f.1` does not implement `Clone`
|
||||
//~^ 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
|
||||
let f_1 = f.1;
|
||||
|
|
|
|||
|
|
@ -12,8 +12,8 @@ fn test_send_trait() {
|
|||
let mut f = 10;
|
||||
let fptr = SendPointer(&mut f as *mut i32);
|
||||
thread::spawn(move || unsafe {
|
||||
//~^ ERROR: `Send` closure trait implementation
|
||||
//~| NOTE: in Rust 2018, this closure would implement `Send` as `fptr` implements `Send`, but in Rust 2021, this closure will no longer implement `Send` as `fptr.0` does not implement `Send`
|
||||
//~^ ERROR: `Send` trait implementation for closure
|
||||
//~| NOTE: in Rust 2018, this closure would implement `Send` as `fptr` implements `Send`, but in Rust 2021, this closure would no longer implement `Send` as `fptr.0` does not implement `Send`
|
||||
//~| NOTE: for more information, see
|
||||
//~| HELP: add a dummy let to cause `fptr` to be fully captured
|
||||
*fptr.0 = 20;
|
||||
|
|
@ -32,8 +32,8 @@ fn test_sync_trait() {
|
|||
let f = CustomInt(&mut f as *mut i32);
|
||||
let fptr = SyncPointer(f);
|
||||
thread::spawn(move || unsafe {
|
||||
//~^ ERROR: `Sync`, `Send` closure trait implementation
|
||||
//~| NOTE: in Rust 2018, this closure would implement `Sync`, `Send` as `fptr` implements `Sync`, `Send`, but in Rust 2021, this closure will no longer implement `Sync`, `Send` as `fptr.0.0` does not implement `Sync`, `Send`
|
||||
//~^ ERROR: `Sync`, `Send` trait implementation for closure
|
||||
//~| NOTE: in Rust 2018, this closure would implement `Sync`, `Send` as `fptr` implements `Sync`, `Send`, but in Rust 2021, this closure would no longer implement `Sync`, `Send` as `fptr.0.0` does not implement `Sync`, `Send`
|
||||
//~| NOTE: for more information, see
|
||||
//~| HELP: add a dummy let to cause `fptr` to be fully captured
|
||||
*fptr.0.0 = 20;
|
||||
|
|
@ -56,8 +56,8 @@ impl Clone for U {
|
|||
fn test_clone_trait() {
|
||||
let f = U(S(String::from("Hello World")), T(0));
|
||||
let c = || {
|
||||
//~^ ERROR: `Clone` closure trait implementation, and drop order
|
||||
//~| NOTE: in Rust 2018, this closure would implement `Clone` as `f` implements `Clone`, but in Rust 2021, this closure will no longer implement `Clone` as `f.1` does not implement `Clone`
|
||||
//~^ 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
|
||||
let f_1 = f.1;
|
||||
|
|
|
|||
|
|
@ -1,19 +1,11 @@
|
|||
error: changes to closure capture in Rust 2021 will affect `Send` closure trait implementation
|
||||
error: changes to closure capture in Rust 2021 will affect `Send` trait implementation for closure
|
||||
--> $DIR/auto_traits.rs:14:19
|
||||
|
|
||||
LL | thread::spawn(move || unsafe {
|
||||
| ^ - in Rust 2018, this closure would implement `Send` as `fptr` implements `Send`, but in Rust 2021, this closure will no longer implement `Send` as `fptr.0` does not implement `Send`
|
||||
| ___________________|
|
||||
| |
|
||||
LL | |
|
||||
LL | |
|
||||
LL | |
|
||||
LL | |
|
||||
LL | | *fptr.0 = 20;
|
||||
| | ------- in Rust 2018, closure captures all of `fptr`, but in Rust 2021, it only captures `fptr.0`
|
||||
LL | |
|
||||
LL | | });
|
||||
| |_____^
|
||||
LL | thread::spawn(move || unsafe {
|
||||
| ^^^^^^^^^^^^^^ in Rust 2018, this closure would implement `Send` as `fptr` implements `Send`, but in Rust 2021, this closure would no longer implement `Send` as `fptr.0` does not implement `Send`
|
||||
...
|
||||
LL | *fptr.0 = 20;
|
||||
| ------- in Rust 2018, closure captures all of `fptr`, but in Rust 2021, it only captures `fptr.0`
|
||||
|
|
||||
note: the lint level is defined here
|
||||
--> $DIR/auto_traits.rs:2:9
|
||||
|
|
@ -31,22 +23,14 @@ LL |
|
|||
LL | *fptr.0 = 20;
|
||||
...
|
||||
|
||||
error: changes to closure capture in Rust 2021 will affect `Sync`, `Send` closure trait implementation
|
||||
error: changes to closure capture in Rust 2021 will affect `Sync`, `Send` trait implementation for closure
|
||||
--> $DIR/auto_traits.rs:34:19
|
||||
|
|
||||
LL | thread::spawn(move || unsafe {
|
||||
| ^ - in Rust 2018, this closure would implement `Sync`, `Send` as `fptr` implements `Sync`, `Send`, but in Rust 2021, this closure will no longer implement `Sync`, `Send` as `fptr.0.0` does not implement `Sync`, `Send`
|
||||
| ___________________|
|
||||
| |
|
||||
LL | |
|
||||
LL | |
|
||||
LL | |
|
||||
LL | |
|
||||
LL | | *fptr.0.0 = 20;
|
||||
| | --------- in Rust 2018, closure captures all of `fptr`, but in Rust 2021, it only captures `fptr.0.0`
|
||||
LL | |
|
||||
LL | | });
|
||||
| |_____^
|
||||
LL | thread::spawn(move || unsafe {
|
||||
| ^^^^^^^^^^^^^^ in Rust 2018, this closure would implement `Sync`, `Send` as `fptr` implements `Sync`, `Send`, but in Rust 2021, this closure would no longer implement `Sync`, `Send` as `fptr.0.0` does not implement `Sync`, `Send`
|
||||
...
|
||||
LL | *fptr.0.0 = 20;
|
||||
| --------- in Rust 2018, closure captures all of `fptr`, but in Rust 2021, it only captures `fptr.0.0`
|
||||
|
|
||||
= 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
|
||||
|
|
@ -59,26 +43,17 @@ LL |
|
|||
LL | *fptr.0.0 = 20;
|
||||
...
|
||||
|
||||
error: changes to closure capture in Rust 2021 will affect `Clone` closure trait implementation, 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 = || {
|
||||
| ^ - in Rust 2018, this closure would implement `Clone` as `f` implements `Clone`, but in Rust 2021, this closure will no longer implement `Clone` as `f.1` does not implement `Clone`
|
||||
| _____________|
|
||||
| |
|
||||
LL | |
|
||||
LL | |
|
||||
LL | |
|
||||
LL | |
|
||||
LL | | let f_1 = f.1;
|
||||
| | --- in Rust 2018, closure captures all of `f`, but in Rust 2021, it only captures `f.1`
|
||||
LL | |
|
||||
LL | | println!("{:?}", f_1.0);
|
||||
LL | | };
|
||||
| |_____^
|
||||
LL | let c = || {
|
||||
| ^^ 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`
|
||||
...
|
||||
LL | }
|
||||
| - in Rust 2018, `f` would be dropped here, but in Rust 2021, only `f.1` would be dropped here alongside the closure
|
||||
LL | let f_1 = f.1;
|
||||
| --- in Rust 2018, closure captures all of `f`, but in Rust 2021, it only captures `f.1`
|
||||
...
|
||||
LL | }
|
||||
| - in Rust 2018, `f` would be dropped here, but in Rust 2021, only `f.1` 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 `f` to be fully captured
|
||||
|
|
|
|||
|
|
@ -1,30 +1,24 @@
|
|||
error: changes to closure capture in Rust 2021 will affect drop order
|
||||
--> $DIR/insignificant_drop.rs:15:13
|
||||
|
|
||||
LL | let c = || {
|
||||
| _____________^
|
||||
LL | |
|
||||
LL | |
|
||||
LL | |
|
||||
LL | |
|
||||
LL | | let _t = t.0;
|
||||
| | --- in Rust 2018, closure captures all of `t`, but in Rust 2021, it only captures `t.0`
|
||||
LL | |
|
||||
LL | | let _t1 = t1.0;
|
||||
| | ---- in Rust 2018, closure captures all of `t1`, but in Rust 2021, it only captures `t1.0`
|
||||
LL | |
|
||||
LL | | let _t2 = t2.0;
|
||||
| | ---- in Rust 2018, closure captures all of `t2`, but in Rust 2021, it only captures `t2.0`
|
||||
LL | |
|
||||
LL | | };
|
||||
| |_____^
|
||||
LL | let c = || {
|
||||
| ^^
|
||||
...
|
||||
LL | }
|
||||
| -
|
||||
| |
|
||||
| in Rust 2018, `t` would be dropped here, but in Rust 2021, only `t.0` would be dropped here alongside the closure
|
||||
| in Rust 2018, `t1` would be dropped here, but in Rust 2021, only `t1.0` would be dropped here alongside the closure
|
||||
| in Rust 2018, `t2` would be dropped here, but in Rust 2021, only `t2.0` would be dropped here alongside the closure
|
||||
LL | let _t = t.0;
|
||||
| --- in Rust 2018, closure captures all of `t`, but in Rust 2021, it only captures `t.0`
|
||||
LL |
|
||||
LL | let _t1 = t1.0;
|
||||
| ---- in Rust 2018, closure captures all of `t1`, but in Rust 2021, it only captures `t1.0`
|
||||
LL |
|
||||
LL | let _t2 = t2.0;
|
||||
| ---- in Rust 2018, closure captures all of `t2`, but in Rust 2021, it only captures `t2.0`
|
||||
...
|
||||
LL | }
|
||||
| -
|
||||
| |
|
||||
| in Rust 2018, `t` would be dropped here, but in Rust 2021, only `t.0` would be dropped here alongside the closure
|
||||
| in Rust 2018, `t1` would be dropped here, but in Rust 2021, only `t1.0` would be dropped here alongside the closure
|
||||
| in Rust 2018, `t2` would be dropped here, but in Rust 2021, only `t2.0` would be dropped here alongside the closure
|
||||
|
|
||||
note: the lint level is defined here
|
||||
--> $DIR/insignificant_drop.rs:3:9
|
||||
|
|
@ -45,26 +39,20 @@ LL | let _t = t.0;
|
|||
error: changes to closure capture in Rust 2021 will affect drop order
|
||||
--> $DIR/insignificant_drop.rs:41:13
|
||||
|
|
||||
LL | let c = || {
|
||||
| _____________^
|
||||
LL | |
|
||||
LL | |
|
||||
LL | |
|
||||
LL | | let _t = t.0;
|
||||
| | --- in Rust 2018, closure captures all of `t`, but in Rust 2021, it only captures `t.0`
|
||||
LL | |
|
||||
LL | | let _t1 = t1.0;
|
||||
| | ---- in Rust 2018, closure captures all of `t1`, but in Rust 2021, it only captures `t1.0`
|
||||
LL | |
|
||||
LL | | let _t2 = t2;
|
||||
LL | | };
|
||||
| |_____^
|
||||
LL | let c = || {
|
||||
| ^^
|
||||
...
|
||||
LL | }
|
||||
| -
|
||||
| |
|
||||
| in Rust 2018, `t` would be dropped here, but in Rust 2021, only `t.0` would be dropped here alongside the closure
|
||||
| in Rust 2018, `t1` would be dropped here, but in Rust 2021, only `t1.0` would be dropped here alongside the closure
|
||||
LL | let _t = t.0;
|
||||
| --- in Rust 2018, closure captures all of `t`, but in Rust 2021, it only captures `t.0`
|
||||
LL |
|
||||
LL | let _t1 = t1.0;
|
||||
| ---- in Rust 2018, closure captures all of `t1`, but in Rust 2021, it only captures `t1.0`
|
||||
...
|
||||
LL | }
|
||||
| -
|
||||
| |
|
||||
| in Rust 2018, `t` would be dropped here, but in Rust 2021, only `t.0` would be dropped here alongside the closure
|
||||
| in Rust 2018, `t1` would be dropped here, but in Rust 2021, only `t1.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 `t`, `t1` to be fully captured
|
||||
|
|
@ -80,20 +68,14 @@ LL |
|
|||
error: changes to closure capture in Rust 2021 will affect drop order
|
||||
--> $DIR/insignificant_drop.rs:62:13
|
||||
|
|
||||
LL | let c = || {
|
||||
| _____________^
|
||||
LL | |
|
||||
LL | |
|
||||
LL | |
|
||||
LL | | let _t = t.0;
|
||||
| | --- in Rust 2018, closure captures all of `t`, but in Rust 2021, it only captures `t.0`
|
||||
LL | |
|
||||
LL | | println!("{}", t1.1);
|
||||
LL | | };
|
||||
| |_____^
|
||||
LL | let c = || {
|
||||
| ^^
|
||||
...
|
||||
LL | }
|
||||
| - in Rust 2018, `t` would be dropped here, but in Rust 2021, only `t.0` would be dropped here alongside the closure
|
||||
LL | let _t = t.0;
|
||||
| --- in Rust 2018, closure captures all of `t`, but in Rust 2021, it only captures `t.0`
|
||||
...
|
||||
LL | }
|
||||
| - in Rust 2018, `t` would be dropped here, but in Rust 2021, only `t.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 `t` to be fully captured
|
||||
|
|
@ -109,20 +91,14 @@ LL |
|
|||
error: changes to closure capture in Rust 2021 will affect drop order
|
||||
--> $DIR/insignificant_drop.rs:83:13
|
||||
|
|
||||
LL | let c = || {
|
||||
| _____________^
|
||||
LL | |
|
||||
LL | |
|
||||
LL | |
|
||||
LL | | let _t = t.0;
|
||||
| | --- in Rust 2018, closure captures all of `t`, but in Rust 2021, it only captures `t.0`
|
||||
LL | |
|
||||
LL | | let _t1 = t1.0;
|
||||
LL | | };
|
||||
| |_____^
|
||||
LL | let c = || {
|
||||
| ^^
|
||||
...
|
||||
LL | }
|
||||
| - in Rust 2018, `t` would be dropped here, but in Rust 2021, only `t.0` would be dropped here alongside the closure
|
||||
LL | let _t = t.0;
|
||||
| --- in Rust 2018, closure captures all of `t`, but in Rust 2021, it only captures `t.0`
|
||||
...
|
||||
LL | }
|
||||
| - in Rust 2018, `t` would be dropped here, but in Rust 2021, only `t.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 `t` to be fully captured
|
||||
|
|
@ -138,20 +114,14 @@ LL |
|
|||
error: changes to closure capture in Rust 2021 will affect drop order
|
||||
--> $DIR/insignificant_drop.rs:104:13
|
||||
|
|
||||
LL | let c = || {
|
||||
| _____________^
|
||||
LL | |
|
||||
LL | |
|
||||
LL | |
|
||||
LL | | let _t = t.0;
|
||||
| | --- in Rust 2018, closure captures all of `t`, but in Rust 2021, it only captures `t.0`
|
||||
LL | |
|
||||
LL | | let _s = s.0;
|
||||
LL | | };
|
||||
| |_____^
|
||||
LL | let c = || {
|
||||
| ^^
|
||||
...
|
||||
LL | }
|
||||
| - in Rust 2018, `t` would be dropped here, but in Rust 2021, only `t.0` would be dropped here alongside the closure
|
||||
LL | let _t = t.0;
|
||||
| --- in Rust 2018, closure captures all of `t`, but in Rust 2021, it only captures `t.0`
|
||||
...
|
||||
LL | }
|
||||
| - in Rust 2018, `t` would be dropped here, but in Rust 2021, only `t.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 `t` to be fully captured
|
||||
|
|
@ -167,25 +137,19 @@ LL |
|
|||
error: changes to closure capture in Rust 2021 will affect drop order
|
||||
--> $DIR/insignificant_drop.rs:122:13
|
||||
|
|
||||
LL | let c = move || {
|
||||
| _____________^
|
||||
LL | |
|
||||
LL | |
|
||||
LL | |
|
||||
LL | | println!("{} {}", t1.1, t.1);
|
||||
| | ---- --- in Rust 2018, closure captures all of `t`, but in Rust 2021, it only captures `t.1`
|
||||
| | |
|
||||
| | in Rust 2018, closure captures all of `t1`, but in Rust 2021, it only captures `t1.1`
|
||||
LL | |
|
||||
LL | |
|
||||
LL | | };
|
||||
| |_____^
|
||||
LL | let c = move || {
|
||||
| ^^^^^^^
|
||||
...
|
||||
LL | }
|
||||
| -
|
||||
| |
|
||||
| in Rust 2018, `t1` would be dropped here, but in Rust 2021, only `t1.1` would be dropped here alongside the closure
|
||||
| in Rust 2018, `t` would be dropped here, but in Rust 2021, only `t.1` would be dropped here alongside the closure
|
||||
LL | println!("{} {}", t1.1, t.1);
|
||||
| ---- --- in Rust 2018, closure captures all of `t`, but in Rust 2021, it only captures `t.1`
|
||||
| |
|
||||
| in Rust 2018, closure captures all of `t1`, but in Rust 2021, it only captures `t1.1`
|
||||
...
|
||||
LL | }
|
||||
| -
|
||||
| |
|
||||
| in Rust 2018, `t1` would be dropped here, but in Rust 2021, only `t1.1` would be dropped here alongside the closure
|
||||
| in Rust 2018, `t` would be dropped here, but in Rust 2021, only `t.1` 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 `t1`, `t` to be fully captured
|
||||
|
|
@ -201,19 +165,14 @@ LL |
|
|||
error: changes to closure capture in Rust 2021 will affect drop order
|
||||
--> $DIR/insignificant_drop.rs:142:13
|
||||
|
|
||||
LL | let c = || {
|
||||
| _____________^
|
||||
LL | |
|
||||
LL | |
|
||||
LL | |
|
||||
LL | | let _t = t.0;
|
||||
| | --- in Rust 2018, closure captures all of `t`, but in Rust 2021, it only captures `t.0`
|
||||
LL | |
|
||||
LL | | };
|
||||
| |_____^
|
||||
LL | let c = || {
|
||||
| ^^
|
||||
...
|
||||
LL | }
|
||||
| - in Rust 2018, `t` would be dropped here, but in Rust 2021, only `t.0` would be dropped here alongside the closure
|
||||
LL | let _t = t.0;
|
||||
| --- in Rust 2018, closure captures all of `t`, but in Rust 2021, it only captures `t.0`
|
||||
...
|
||||
LL | }
|
||||
| - in Rust 2018, `t` would be dropped here, but in Rust 2021, only `t.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 `t` to be fully captured
|
||||
|
|
|
|||
|
|
@ -1,19 +1,14 @@
|
|||
error: changes to closure capture in Rust 2021 will affect drop order
|
||||
--> $DIR/insignificant_drop_attr_migrations.rs:37:13
|
||||
|
|
||||
LL | let c = || {
|
||||
| _____________^
|
||||
LL | |
|
||||
LL | |
|
||||
LL | |
|
||||
LL | | let _t = t.0;
|
||||
| | --- in Rust 2018, closure captures all of `t`, but in Rust 2021, it only captures `t.0`
|
||||
LL | |
|
||||
LL | | };
|
||||
| |_____^
|
||||
LL | let c = || {
|
||||
| ^^
|
||||
...
|
||||
LL | }
|
||||
| - in Rust 2018, `t` would be dropped here, but in Rust 2021, only `t.0` would be dropped here alongside the closure
|
||||
LL | let _t = t.0;
|
||||
| --- in Rust 2018, closure captures all of `t`, but in Rust 2021, it only captures `t.0`
|
||||
...
|
||||
LL | }
|
||||
| - in Rust 2018, `t` would be dropped here, but in Rust 2021, only `t.0` would be dropped here alongside the closure
|
||||
|
|
||||
note: the lint level is defined here
|
||||
--> $DIR/insignificant_drop_attr_migrations.rs:3:9
|
||||
|
|
@ -34,19 +29,14 @@ LL |
|
|||
error: changes to closure capture in Rust 2021 will affect drop order
|
||||
--> $DIR/insignificant_drop_attr_migrations.rs:57:13
|
||||
|
|
||||
LL | let c = move || {
|
||||
| _____________^
|
||||
LL | |
|
||||
LL | |
|
||||
LL | |
|
||||
LL | | let _t = t.1;
|
||||
| | --- in Rust 2018, closure captures all of `t`, but in Rust 2021, it only captures `t.1`
|
||||
LL | |
|
||||
LL | | };
|
||||
| |_____^
|
||||
LL | let c = move || {
|
||||
| ^^^^^^^
|
||||
...
|
||||
LL | }
|
||||
| - in Rust 2018, `t` would be dropped here, but in Rust 2021, only `t.1` would be dropped here alongside the closure
|
||||
LL | let _t = t.1;
|
||||
| --- in Rust 2018, closure captures all of `t`, but in Rust 2021, it only captures `t.1`
|
||||
...
|
||||
LL | }
|
||||
| - in Rust 2018, `t` would be dropped here, but in Rust 2021, only `t.1` 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 `t` to be fully captured
|
||||
|
|
|
|||
|
|
@ -1,19 +1,14 @@
|
|||
error: changes to closure capture in Rust 2021 will affect drop order
|
||||
--> $DIR/migrations_rustfix.rs:19:13
|
||||
|
|
||||
LL | let c = || {
|
||||
| _____________^
|
||||
LL | |
|
||||
LL | |
|
||||
LL | |
|
||||
LL | | let _t = t.0;
|
||||
| | --- in Rust 2018, closure captures all of `t`, but in Rust 2021, it only captures `t.0`
|
||||
LL | |
|
||||
LL | | };
|
||||
| |_____^
|
||||
LL | let c = || {
|
||||
| ^^
|
||||
...
|
||||
LL | }
|
||||
| - in Rust 2018, `t` would be dropped here, but in Rust 2021, only `t.0` would be dropped here alongside the closure
|
||||
LL | let _t = t.0;
|
||||
| --- in Rust 2018, closure captures all of `t`, but in Rust 2021, it only captures `t.0`
|
||||
...
|
||||
LL | }
|
||||
| - in Rust 2018, `t` would be dropped here, but in Rust 2021, only `t.0` would be dropped here alongside the closure
|
||||
|
|
||||
note: the lint level is defined here
|
||||
--> $DIR/migrations_rustfix.rs:2:9
|
||||
|
|
|
|||
|
|
@ -18,8 +18,8 @@ where
|
|||
{
|
||||
let f = panic::AssertUnwindSafe(f);
|
||||
let result = panic::catch_unwind(move || { let _ = &f;
|
||||
//~^ ERROR: `UnwindSafe`, `RefUnwindSafe` closure trait implementation
|
||||
//~| NOTE: in Rust 2018, this closure would implement `UnwindSafe`, `RefUnwindSafe` as `f` implements `UnwindSafe`, `RefUnwindSafe`, but in Rust 2021, this closure will no longer implement `UnwindSafe`, `RefUnwindSafe` as `f.0` does not implement `UnwindSafe`, `RefUnwindSafe`
|
||||
//~^ ERROR: `UnwindSafe`, `RefUnwindSafe` trait implementation for closure
|
||||
//~| NOTE: in Rust 2018, this closure would implement `UnwindSafe`, `RefUnwindSafe` as `f` implements `UnwindSafe`, `RefUnwindSafe`, but in Rust 2021, this closure would no longer implement `UnwindSafe`, `RefUnwindSafe` as `f.0` does not implement `UnwindSafe`, `RefUnwindSafe`
|
||||
//~| NOTE: for more information, see
|
||||
//~| HELP: add a dummy let to cause `f` to be fully captured
|
||||
f.0()
|
||||
|
|
|
|||
|
|
@ -18,8 +18,8 @@ where
|
|||
{
|
||||
let f = panic::AssertUnwindSafe(f);
|
||||
let result = panic::catch_unwind(move || {
|
||||
//~^ ERROR: `UnwindSafe`, `RefUnwindSafe` closure trait implementation
|
||||
//~| NOTE: in Rust 2018, this closure would implement `UnwindSafe`, `RefUnwindSafe` as `f` implements `UnwindSafe`, `RefUnwindSafe`, but in Rust 2021, this closure will no longer implement `UnwindSafe`, `RefUnwindSafe` as `f.0` does not implement `UnwindSafe`, `RefUnwindSafe`
|
||||
//~^ ERROR: `UnwindSafe`, `RefUnwindSafe` trait implementation for closure
|
||||
//~| NOTE: in Rust 2018, this closure would implement `UnwindSafe`, `RefUnwindSafe` as `f` implements `UnwindSafe`, `RefUnwindSafe`, but in Rust 2021, this closure would no longer implement `UnwindSafe`, `RefUnwindSafe` as `f.0` does not implement `UnwindSafe`, `RefUnwindSafe`
|
||||
//~| NOTE: for more information, see
|
||||
//~| HELP: add a dummy let to cause `f` to be fully captured
|
||||
f.0()
|
||||
|
|
|
|||
|
|
@ -1,19 +1,11 @@
|
|||
error: changes to closure capture in Rust 2021 will affect `UnwindSafe`, `RefUnwindSafe` closure trait implementation
|
||||
error: changes to closure capture in Rust 2021 will affect `UnwindSafe`, `RefUnwindSafe` trait implementation for closure
|
||||
--> $DIR/mir_calls_to_shims.rs:20:38
|
||||
|
|
||||
LL | let result = panic::catch_unwind(move || {
|
||||
| ^ - in Rust 2018, this closure would implement `UnwindSafe`, `RefUnwindSafe` as `f` implements `UnwindSafe`, `RefUnwindSafe`, but in Rust 2021, this closure will no longer implement `UnwindSafe`, `RefUnwindSafe` as `f.0` does not implement `UnwindSafe`, `RefUnwindSafe`
|
||||
| ______________________________________|
|
||||
| |
|
||||
LL | |
|
||||
LL | |
|
||||
LL | |
|
||||
LL | |
|
||||
LL | | f.0()
|
||||
| | --- in Rust 2018, closure captures all of `f`, but in Rust 2021, it only captures `f.0`
|
||||
LL | |
|
||||
LL | | });
|
||||
| |_____^
|
||||
LL | let result = panic::catch_unwind(move || {
|
||||
| ^^^^^^^ in Rust 2018, this closure would implement `UnwindSafe`, `RefUnwindSafe` as `f` implements `UnwindSafe`, `RefUnwindSafe`, but in Rust 2021, this closure would no longer implement `UnwindSafe`, `RefUnwindSafe` as `f.0` does not implement `UnwindSafe`, `RefUnwindSafe`
|
||||
...
|
||||
LL | f.0()
|
||||
| --- in Rust 2018, closure captures all of `f`, but in Rust 2021, it only captures `f.0`
|
||||
|
|
||||
note: the lint level is defined here
|
||||
--> $DIR/mir_calls_to_shims.rs:3:9
|
||||
|
|
|
|||
|
|
@ -1,18 +1,14 @@
|
|||
error: changes to closure capture in Rust 2021 will affect drop order
|
||||
--> $DIR/precise.rs:19:13
|
||||
|
|
||||
LL | let c = || {
|
||||
| _____________^
|
||||
LL | |
|
||||
LL | |
|
||||
LL | | let _t = t.0;
|
||||
| | --- in Rust 2018, closure captures all of `t`, but in Rust 2021, it only captures `t.0`
|
||||
LL | | let _t = &t.1;
|
||||
LL | | };
|
||||
| |_____^
|
||||
LL | let c = || {
|
||||
| ^^
|
||||
...
|
||||
LL | }
|
||||
| - in Rust 2018, `t` would be dropped here, but in Rust 2021, only `t.0` would be dropped here alongside the closure
|
||||
LL | let _t = t.0;
|
||||
| --- in Rust 2018, closure captures all of `t`, but in Rust 2021, it only captures `t.0`
|
||||
...
|
||||
LL | }
|
||||
| - in Rust 2018, `t` would be dropped here, but in Rust 2021, only `t.0` would be dropped here alongside the closure
|
||||
|
|
||||
note: the lint level is defined here
|
||||
--> $DIR/precise.rs:3:9
|
||||
|
|
@ -33,21 +29,18 @@ LL | };
|
|||
error: changes to closure capture in Rust 2021 will affect drop order
|
||||
--> $DIR/precise.rs:41:13
|
||||
|
|
||||
LL | let c = || {
|
||||
| _____________^
|
||||
LL | |
|
||||
LL | |
|
||||
LL | | let _x = u.0.0;
|
||||
| | ----- in Rust 2018, closure captures all of `u`, but in Rust 2021, it only captures `u.0.0`
|
||||
LL | | let _x = u.0.1;
|
||||
| | ----- in Rust 2018, closure captures all of `u`, but in Rust 2021, it only captures `u.0.1`
|
||||
LL | | let _x = u.1.0;
|
||||
| | ----- in Rust 2018, closure captures all of `u`, but in Rust 2021, it only captures `u.1.0`
|
||||
LL | | };
|
||||
| |_____^
|
||||
LL | let c = || {
|
||||
| ^^
|
||||
...
|
||||
LL | }
|
||||
| - in Rust 2018, `u` would be dropped here, but in Rust 2021, only `u.0.1`, `u.0.0`, `u.1.0` would be dropped here alongside the closure
|
||||
LL | let _x = u.0.0;
|
||||
| ----- in Rust 2018, closure captures all of `u`, but in Rust 2021, it only captures `u.0.0`
|
||||
LL | let _x = u.0.1;
|
||||
| ----- in Rust 2018, closure captures all of `u`, but in Rust 2021, it only captures `u.0.1`
|
||||
LL | let _x = u.1.0;
|
||||
| ----- in Rust 2018, closure captures all of `u`, but in Rust 2021, it only captures `u.1.0`
|
||||
...
|
||||
LL | }
|
||||
| - in Rust 2018, `u` would be dropped here, but in Rust 2021, only `u.0.1`, `u.0.0`, `u.1.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 `u` to be fully captured
|
||||
|
|
|
|||
|
|
@ -1,29 +1,24 @@
|
|||
error: changes to closure capture in Rust 2021 will affect drop order
|
||||
--> $DIR/significant_drop.rs:25:13
|
||||
|
|
||||
LL | let c = || {
|
||||
| _____________^
|
||||
LL | |
|
||||
LL | |
|
||||
LL | |
|
||||
LL | | let _t = t.0;
|
||||
| | --- in Rust 2018, closure captures all of `t`, but in Rust 2021, it only captures `t.0`
|
||||
LL | |
|
||||
LL | | let _t1 = t1.0;
|
||||
| | ---- in Rust 2018, closure captures all of `t1`, but in Rust 2021, it only captures `t1.0`
|
||||
LL | |
|
||||
LL | | let _t2 = t2.0;
|
||||
| | ---- in Rust 2018, closure captures all of `t2`, but in Rust 2021, it only captures `t2.0`
|
||||
LL | |
|
||||
LL | | };
|
||||
| |_____^
|
||||
LL | let c = || {
|
||||
| ^^
|
||||
...
|
||||
LL | }
|
||||
| -
|
||||
| |
|
||||
| in Rust 2018, `t` would be dropped here, but in Rust 2021, only `t.0` would be dropped here alongside the closure
|
||||
| in Rust 2018, `t1` would be dropped here, but in Rust 2021, only `t1.0` would be dropped here alongside the closure
|
||||
| in Rust 2018, `t2` would be dropped here, but in Rust 2021, only `t2.0` would be dropped here alongside the closure
|
||||
LL | let _t = t.0;
|
||||
| --- in Rust 2018, closure captures all of `t`, but in Rust 2021, it only captures `t.0`
|
||||
LL |
|
||||
LL | let _t1 = t1.0;
|
||||
| ---- in Rust 2018, closure captures all of `t1`, but in Rust 2021, it only captures `t1.0`
|
||||
LL |
|
||||
LL | let _t2 = t2.0;
|
||||
| ---- in Rust 2018, closure captures all of `t2`, but in Rust 2021, it only captures `t2.0`
|
||||
...
|
||||
LL | }
|
||||
| -
|
||||
| |
|
||||
| in Rust 2018, `t` would be dropped here, but in Rust 2021, only `t.0` would be dropped here alongside the closure
|
||||
| in Rust 2018, `t1` would be dropped here, but in Rust 2021, only `t1.0` would be dropped here alongside the closure
|
||||
| in Rust 2018, `t2` would be dropped here, but in Rust 2021, only `t2.0` would be dropped here alongside the closure
|
||||
|
|
||||
note: the lint level is defined here
|
||||
--> $DIR/significant_drop.rs:2:9
|
||||
|
|
@ -44,26 +39,20 @@ LL |
|
|||
error: changes to closure capture in Rust 2021 will affect drop order
|
||||
--> $DIR/significant_drop.rs:50:13
|
||||
|
|
||||
LL | let c = || {
|
||||
| _____________^
|
||||
LL | |
|
||||
LL | |
|
||||
LL | |
|
||||
LL | | let _t = t.0;
|
||||
| | --- in Rust 2018, closure captures all of `t`, but in Rust 2021, it only captures `t.0`
|
||||
LL | |
|
||||
LL | | let _t1 = t1.0;
|
||||
| | ---- in Rust 2018, closure captures all of `t1`, but in Rust 2021, it only captures `t1.0`
|
||||
LL | |
|
||||
LL | | let _t2 = t2;
|
||||
LL | | };
|
||||
| |_____^
|
||||
LL | let c = || {
|
||||
| ^^
|
||||
...
|
||||
LL | }
|
||||
| -
|
||||
| |
|
||||
| in Rust 2018, `t` would be dropped here, but in Rust 2021, only `t.0` would be dropped here alongside the closure
|
||||
| in Rust 2018, `t1` would be dropped here, but in Rust 2021, only `t1.0` would be dropped here alongside the closure
|
||||
LL | let _t = t.0;
|
||||
| --- in Rust 2018, closure captures all of `t`, but in Rust 2021, it only captures `t.0`
|
||||
LL |
|
||||
LL | let _t1 = t1.0;
|
||||
| ---- in Rust 2018, closure captures all of `t1`, but in Rust 2021, it only captures `t1.0`
|
||||
...
|
||||
LL | }
|
||||
| -
|
||||
| |
|
||||
| in Rust 2018, `t` would be dropped here, but in Rust 2021, only `t.0` would be dropped here alongside the closure
|
||||
| in Rust 2018, `t1` would be dropped here, but in Rust 2021, only `t1.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 `t`, `t1` to be fully captured
|
||||
|
|
@ -79,20 +68,14 @@ LL |
|
|||
error: changes to closure capture in Rust 2021 will affect drop order
|
||||
--> $DIR/significant_drop.rs:71:13
|
||||
|
|
||||
LL | let c = || {
|
||||
| _____________^
|
||||
LL | |
|
||||
LL | |
|
||||
LL | |
|
||||
LL | | let _t = t.0;
|
||||
| | --- in Rust 2018, closure captures all of `t`, but in Rust 2021, it only captures `t.0`
|
||||
LL | |
|
||||
LL | | println!("{:?}", t1.1);
|
||||
LL | | };
|
||||
| |_____^
|
||||
LL | let c = || {
|
||||
| ^^
|
||||
...
|
||||
LL | }
|
||||
| - in Rust 2018, `t` would be dropped here, but in Rust 2021, only `t.0` would be dropped here alongside the closure
|
||||
LL | let _t = t.0;
|
||||
| --- in Rust 2018, closure captures all of `t`, but in Rust 2021, it only captures `t.0`
|
||||
...
|
||||
LL | }
|
||||
| - in Rust 2018, `t` would be dropped here, but in Rust 2021, only `t.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 `t` to be fully captured
|
||||
|
|
@ -108,19 +91,14 @@ LL |
|
|||
error: changes to closure capture in Rust 2021 will affect drop order
|
||||
--> $DIR/significant_drop.rs:91:13
|
||||
|
|
||||
LL | let c = || {
|
||||
| _____________^
|
||||
LL | |
|
||||
LL | |
|
||||
LL | |
|
||||
LL | | let _t = t.0;
|
||||
| | --- in Rust 2018, closure captures all of `t`, but in Rust 2021, it only captures `t.0`
|
||||
LL | |
|
||||
LL | | };
|
||||
| |_____^
|
||||
LL | let c = || {
|
||||
| ^^
|
||||
...
|
||||
LL | }
|
||||
| - in Rust 2018, `t` would be dropped here, but in Rust 2021, only `t.0` would be dropped here alongside the closure
|
||||
LL | let _t = t.0;
|
||||
| --- in Rust 2018, closure captures all of `t`, but in Rust 2021, it only captures `t.0`
|
||||
...
|
||||
LL | }
|
||||
| - in Rust 2018, `t` would be dropped here, but in Rust 2021, only `t.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 `t` to be fully captured
|
||||
|
|
@ -136,19 +114,14 @@ LL |
|
|||
error: changes to closure capture in Rust 2021 will affect drop order
|
||||
--> $DIR/significant_drop.rs:109:13
|
||||
|
|
||||
LL | let c = || {
|
||||
| _____________^
|
||||
LL | |
|
||||
LL | |
|
||||
LL | |
|
||||
LL | | let _t = t.0;
|
||||
| | --- in Rust 2018, closure captures all of `t`, but in Rust 2021, it only captures `t.0`
|
||||
LL | |
|
||||
LL | | };
|
||||
| |_____^
|
||||
LL | let c = || {
|
||||
| ^^
|
||||
...
|
||||
LL | }
|
||||
| - in Rust 2018, `t` would be dropped here, but in Rust 2021, only `t.0` would be dropped here alongside the closure
|
||||
LL | let _t = t.0;
|
||||
| --- in Rust 2018, closure captures all of `t`, but in Rust 2021, it only captures `t.0`
|
||||
...
|
||||
LL | }
|
||||
| - in Rust 2018, `t` would be dropped here, but in Rust 2021, only `t.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 `t` to be fully captured
|
||||
|
|
@ -164,19 +137,14 @@ LL |
|
|||
error: changes to closure capture in Rust 2021 will affect drop order
|
||||
--> $DIR/significant_drop.rs:125:13
|
||||
|
|
||||
LL | let c = || {
|
||||
| _____________^
|
||||
LL | |
|
||||
LL | |
|
||||
LL | |
|
||||
LL | | let _t = t.1;
|
||||
| | --- in Rust 2018, closure captures all of `t`, but in Rust 2021, it only captures `t.1`
|
||||
LL | |
|
||||
LL | | };
|
||||
| |_____^
|
||||
LL | let c = || {
|
||||
| ^^
|
||||
...
|
||||
LL | }
|
||||
| - in Rust 2018, `t` would be dropped here, but in Rust 2021, only `t.1` would be dropped here alongside the closure
|
||||
LL | let _t = t.1;
|
||||
| --- in Rust 2018, closure captures all of `t`, but in Rust 2021, it only captures `t.1`
|
||||
...
|
||||
LL | }
|
||||
| - in Rust 2018, `t` would be dropped here, but in Rust 2021, only `t.1` 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 `t` to be fully captured
|
||||
|
|
@ -192,25 +160,19 @@ LL |
|
|||
error: changes to closure capture in Rust 2021 will affect drop order
|
||||
--> $DIR/significant_drop.rs:143:13
|
||||
|
|
||||
LL | let c = move || {
|
||||
| _____________^
|
||||
LL | |
|
||||
LL | |
|
||||
LL | |
|
||||
LL | | println!("{:?} {:?}", t1.1, t.1);
|
||||
| | ---- --- in Rust 2018, closure captures all of `t`, but in Rust 2021, it only captures `t.1`
|
||||
| | |
|
||||
| | in Rust 2018, closure captures all of `t1`, but in Rust 2021, it only captures `t1.1`
|
||||
LL | |
|
||||
LL | |
|
||||
LL | | };
|
||||
| |_____^
|
||||
LL | let c = move || {
|
||||
| ^^^^^^^
|
||||
...
|
||||
LL | }
|
||||
| -
|
||||
| |
|
||||
| in Rust 2018, `t1` would be dropped here, but in Rust 2021, only `t1.1` would be dropped here alongside the closure
|
||||
| in Rust 2018, `t` would be dropped here, but in Rust 2021, only `t.1` would be dropped here alongside the closure
|
||||
LL | println!("{:?} {:?}", t1.1, t.1);
|
||||
| ---- --- in Rust 2018, closure captures all of `t`, but in Rust 2021, it only captures `t.1`
|
||||
| |
|
||||
| in Rust 2018, closure captures all of `t1`, but in Rust 2021, it only captures `t1.1`
|
||||
...
|
||||
LL | }
|
||||
| -
|
||||
| |
|
||||
| in Rust 2018, `t1` would be dropped here, but in Rust 2021, only `t1.1` would be dropped here alongside the closure
|
||||
| in Rust 2018, `t` would be dropped here, but in Rust 2021, only `t.1` 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 `t1`, `t` to be fully captured
|
||||
|
|
@ -226,19 +188,14 @@ LL |
|
|||
error: changes to closure capture in Rust 2021 will affect drop order
|
||||
--> $DIR/significant_drop.rs:163:21
|
||||
|
|
||||
LL | let c = || {
|
||||
| _____________________^
|
||||
LL | |
|
||||
LL | |
|
||||
LL | |
|
||||
LL | | tuple.0;
|
||||
| | ------- in Rust 2018, closure captures all of `tuple`, but in Rust 2021, it only captures `tuple.0`
|
||||
LL | |
|
||||
LL | | };
|
||||
| |_____________^
|
||||
LL | let c = || {
|
||||
| ^^
|
||||
...
|
||||
LL | }
|
||||
| - in Rust 2018, `tuple` would be dropped here, but in Rust 2021, only `tuple.0` would be dropped here alongside the closure
|
||||
LL | tuple.0;
|
||||
| ------- in Rust 2018, closure captures all of `tuple`, but in Rust 2021, it only captures `tuple.0`
|
||||
...
|
||||
LL | }
|
||||
| - in Rust 2018, `tuple` would be dropped here, but in Rust 2021, only `tuple.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 `tuple` to be fully captured
|
||||
|
|
@ -254,19 +211,14 @@ LL |
|
|||
error: changes to closure capture in Rust 2021 will affect drop order
|
||||
--> $DIR/significant_drop.rs:181:17
|
||||
|
|
||||
LL | let c = || {
|
||||
| _________________^
|
||||
LL | |
|
||||
LL | |
|
||||
LL | |
|
||||
LL | | tuple.0;
|
||||
| | ------- in Rust 2018, closure captures all of `tuple`, but in Rust 2021, it only captures `tuple.0`
|
||||
LL | |
|
||||
LL | | };
|
||||
| |_________^
|
||||
LL | let c = || {
|
||||
| ^^
|
||||
...
|
||||
LL | };
|
||||
| - in Rust 2018, `tuple` would be dropped here, but in Rust 2021, only `tuple.0` would be dropped here alongside the closure
|
||||
LL | tuple.0;
|
||||
| ------- in Rust 2018, closure captures all of `tuple`, but in Rust 2021, it only captures `tuple.0`
|
||||
...
|
||||
LL | };
|
||||
| - in Rust 2018, `tuple` would be dropped here, but in Rust 2021, only `tuple.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 `tuple` to be fully captured
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue