diff options
| author | Roxane Fruytier <roxane.fruytier@hotmail.com> | 2020-10-27 23:41:52 -0400 |
|---|---|---|
| committer | Aman Arora <me@aman-arora.com> | 2020-11-10 20:58:55 -0500 |
| commit | 825e9e45d14694d23fde29fdab2b02d9973a4eb3 (patch) | |
| tree | 2abe5e662ca1ad9064ead909a55d9395e9eba73c /src | |
| parent | b16815b58d2f584b0a337a3456c1238a96b3f443 (diff) | |
| download | rust-825e9e45d14694d23fde29fdab2b02d9973a4eb3.tar.gz rust-825e9e45d14694d23fde29fdab2b02d9973a4eb3.zip | |
Reduce verbosity of capture analysis logs
Co-authored-by: Jenny Wills <wills.jenniferg@gmail.com> Co-authored-by: Aman Arora <me@aman-arora.com>
Diffstat (limited to 'src')
33 files changed, 218 insertions, 876 deletions
diff --git a/src/test/ui/closures/2229_closure_analysis/arrays-completely-captured.rs b/src/test/ui/closures/2229_closure_analysis/arrays-completely-captured.rs index a5dd202bc07..e144cce54ec 100644 --- a/src/test/ui/closures/2229_closure_analysis/arrays-completely-captured.rs +++ b/src/test/ui/closures/2229_closure_analysis/arrays-completely-captured.rs @@ -10,6 +10,8 @@ fn main() { //~^ ERROR: attributes on expressions are experimental || { m[0] += 10; + //~^ ERROR: Capturing m[] -> MutBorrow + //~^^ ERROR: Min Capture m[] -> MutBorrow m[1] += 40; }; diff --git a/src/test/ui/closures/2229_closure_analysis/arrays-completely-captured.stderr b/src/test/ui/closures/2229_closure_analysis/arrays-completely-captured.stderr index 3d3912d0796..228682caad7 100644 --- a/src/test/ui/closures/2229_closure_analysis/arrays-completely-captured.stderr +++ b/src/test/ui/closures/2229_closure_analysis/arrays-completely-captured.stderr @@ -16,6 +16,18 @@ LL | #![feature(capture_disjoint_fields)] = note: `#[warn(incomplete_features)]` on by default = note: see issue #53488 <https://github.com/rust-lang/rust/issues/53488> for more information -error: aborting due to previous error; 1 warning emitted +error: Capturing m[] -> MutBorrow + --> $DIR/arrays-completely-captured.rs:12:9 + | +LL | m[0] += 10; + | ^ + +error: Min Capture m[] -> MutBorrow + --> $DIR/arrays-completely-captured.rs:12:9 + | +LL | m[0] += 10; + | ^ + +error: aborting due to 3 previous errors; 1 warning emitted For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/closures/2229_closure_analysis/arrays-completely-captured.stdout b/src/test/ui/closures/2229_closure_analysis/arrays-completely-captured.stdout deleted file mode 100644 index e0cd06f765e..00000000000 --- a/src/test/ui/closures/2229_closure_analysis/arrays-completely-captured.stdout +++ /dev/null @@ -1,47 +0,0 @@ -For closure=DefId(0:4 ~ arrays_completely_captured[317d]::main::{closure#0}): Using new-style capture analysis -For closure=DefId(0:4 ~ arrays_completely_captured[317d]::main::{closure#0}): capture information: { - Place { - base_ty: [i32; 5], - base: Upvar( - UpvarId(HirId { owner: DefId(0:3 ~ arrays_completely_captured[317d]::main), local_id: 1 };`m`;DefId(0:4 ~ arrays_completely_captured[317d]::main::{closure#0})), - ), - projections: [], - }: CaptureInfo { - expr_id: Some( - HirId { - owner: DefId(0:3 ~ arrays_completely_captured[317d]::main), - local_id: 12, - }, - ), - capture_kind: ByRef( - UpvarBorrow(MutBorrow, '_#6r), - ), - }, -} -For closure=DefId(0:4 ~ arrays_completely_captured[317d]::main::{closure#0}): min_captures={ - HirId { - owner: DefId(0:3 ~ arrays_completely_captured[317d]::main), - local_id: 1, - }: [ - CapturedPlace { - place: Place { - base_ty: [i32; 5], - base: Upvar( - UpvarId(HirId { owner: DefId(0:3 ~ arrays_completely_captured[317d]::main), local_id: 1 };`m`;DefId(0:4 ~ arrays_completely_captured[317d]::main::{closure#0})), - ), - projections: [], - }, - info: CaptureInfo { - expr_id: Some( - HirId { - owner: DefId(0:3 ~ arrays_completely_captured[317d]::main), - local_id: 12, - }, - ), - capture_kind: ByRef( - UpvarBorrow(MutBorrow, '_#6r), - ), - }, - }, - ], -} diff --git a/src/test/ui/closures/2229_closure_analysis/capture-disjoint-field-struct.rs b/src/test/ui/closures/2229_closure_analysis/capture-disjoint-field-struct.rs index a2be21cddb4..3f2e16725dc 100644 --- a/src/test/ui/closures/2229_closure_analysis/capture-disjoint-field-struct.rs +++ b/src/test/ui/closures/2229_closure_analysis/capture-disjoint-field-struct.rs @@ -16,6 +16,8 @@ fn main() { //~^ ERROR: attributes on expressions are experimental || { println!("{}", p.x); + //~^ ERROR: Capturing p[(0, 0)] -> ImmBorrow + //~^^ ERROR: Min Capture p[(0, 0)] -> ImmBorrow }; // `c` should only capture `p.x`, therefore mutating `p.y` is allowed. diff --git a/src/test/ui/closures/2229_closure_analysis/capture-disjoint-field-struct.stderr b/src/test/ui/closures/2229_closure_analysis/capture-disjoint-field-struct.stderr index 9233597c360..41e641f3564 100644 --- a/src/test/ui/closures/2229_closure_analysis/capture-disjoint-field-struct.stderr +++ b/src/test/ui/closures/2229_closure_analysis/capture-disjoint-field-struct.stderr @@ -16,6 +16,18 @@ LL | #![feature(capture_disjoint_fields)] = note: `#[warn(incomplete_features)]` on by default = note: see issue #53488 <https://github.com/rust-lang/rust/issues/53488> for more information -error: aborting due to previous error; 1 warning emitted +error: Capturing p[(0, 0)] -> ImmBorrow + --> $DIR/capture-disjoint-field-struct.rs:18:24 + | +LL | println!("{}", p.x); + | ^^^ + +error: Min Capture p[(0, 0)] -> ImmBorrow + --> $DIR/capture-disjoint-field-struct.rs:18:24 + | +LL | println!("{}", p.x); + | ^^^ + +error: aborting due to 3 previous errors; 1 warning emitted For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/closures/2229_closure_analysis/capture-disjoint-field-struct.stdout b/src/test/ui/closures/2229_closure_analysis/capture-disjoint-field-struct.stdout deleted file mode 100644 index d378b12a235..00000000000 --- a/src/test/ui/closures/2229_closure_analysis/capture-disjoint-field-struct.stdout +++ /dev/null @@ -1,63 +0,0 @@ -For closure=DefId(0:7 ~ capture_disjoint_field_struct[317d]::main::{closure#0}): Using new-style capture analysis -For closure=DefId(0:7 ~ capture_disjoint_field_struct[317d]::main::{closure#0}): capture information: { - Place { - base_ty: Point, - base: Upvar( - UpvarId(HirId { owner: DefId(0:6 ~ capture_disjoint_field_struct[317d]::main), local_id: 1 };`p`;DefId(0:7 ~ capture_disjoint_field_struct[317d]::main::{closure#0})), - ), - projections: [ - Projection { - ty: i32, - kind: Field( - 0, - 0, - ), - }, - ], - }: CaptureInfo { - expr_id: Some( - HirId { - owner: DefId(0:6 ~ capture_disjoint_field_struct[317d]::main), - local_id: 31, - }, - ), - capture_kind: ByRef( - UpvarBorrow(ImmBorrow, '_#35r), - ), - }, -} -For closure=DefId(0:7 ~ capture_disjoint_field_struct[317d]::main::{closure#0}): min_captures={ - HirId { - owner: DefId(0:6 ~ capture_disjoint_field_struct[317d]::main), - local_id: 1, - }: [ - CapturedPlace { - place: Place { - base_ty: Point, - base: Upvar( - UpvarId(HirId { owner: DefId(0:6 ~ capture_disjoint_field_struct[317d]::main), local_id: 1 };`p`;DefId(0:7 ~ capture_disjoint_field_struct[317d]::main::{closure#0})), - ), - projections: [ - Projection { - ty: i32, - kind: Field( - 0, - 0, - ), - }, - ], - }, - info: CaptureInfo { - expr_id: Some( - HirId { - owner: DefId(0:6 ~ capture_disjoint_field_struct[317d]::main), - local_id: 31, - }, - ), - capture_kind: ByRef( - UpvarBorrow(ImmBorrow, '_#35r), - ), - }, - }, - ], -} diff --git a/src/test/ui/closures/2229_closure_analysis/capture-disjoint-field-tuple.rs b/src/test/ui/closures/2229_closure_analysis/capture-disjoint-field-tuple.rs index e06cde73158..5db1c9c0683 100644 --- a/src/test/ui/closures/2229_closure_analysis/capture-disjoint-field-tuple.rs +++ b/src/test/ui/closures/2229_closure_analysis/capture-disjoint-field-tuple.rs @@ -11,6 +11,8 @@ fn main() { //~^ ERROR: attributes on expressions are experimental || { println!("{}", t.0); + //~^ ERROR: Capturing t[(0, 0)] -> ImmBorrow + //~^^ ERROR: Min Capture t[(0, 0)] -> ImmBorrow }; // `c` only captures t.0, therefore mutating t.1 is allowed. diff --git a/src/test/ui/closures/2229_closure_analysis/capture-disjoint-field-tuple.stderr b/src/test/ui/closures/2229_closure_analysis/capture-disjoint-field-tuple.stderr index f83487ecce5..47470bb9646 100644 --- a/src/test/ui/closures/2229_closure_analysis/capture-disjoint-field-tuple.stderr +++ b/src/test/ui/closures/2229_closure_analysis/capture-disjoint-field-tuple.stderr @@ -1,5 +1,5 @@ error[E0658]: attributes on expressions are experimental - --> $DIR/capture-disjoint-field-tuple.rs:8:13 + --> $DIR/capture-disjoint-field-tuple.rs:10:13 | LL | let c = #[rustc_capture_analysis] | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -8,7 +8,7 @@ LL | let c = #[rustc_capture_analysis] = help: add `#![feature(stmt_expr_attributes)]` to the crate attributes to enable warning: the feature `capture_disjoint_fields` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/capture-disjoint-field-tuple.rs:1:12 + --> $DIR/capture-disjoint-field-tuple.rs:3:12 | LL | #![feature(capture_disjoint_fields)] | ^^^^^^^^^^^^^^^^^^^^^^^ @@ -16,6 +16,18 @@ LL | #![feature(capture_disjoint_fields)] = note: `#[warn(incomplete_features)]` on by default = note: see issue #53488 <https://github.com/rust-lang/rust/issues/53488> for more information -error: aborting due to previous error; 1 warning emitted +error: Capturing t[(0, 0)] -> ImmBorrow + --> $DIR/capture-disjoint-field-tuple.rs:13:24 + | +LL | println!("{}", t.0); + | ^^^ + +error: Min Capture t[(0, 0)] -> ImmBorrow + --> $DIR/capture-disjoint-field-tuple.rs:13:24 + | +LL | println!("{}", t.0); + | ^^^ + +error: aborting due to 3 previous errors; 1 warning emitted For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/closures/2229_closure_analysis/capture-disjoint-field-tuple.stdout b/src/test/ui/closures/2229_closure_analysis/capture-disjoint-field-tuple.stdout deleted file mode 100644 index 9a080c28d4e..00000000000 --- a/src/test/ui/closures/2229_closure_analysis/capture-disjoint-field-tuple.stdout +++ /dev/null @@ -1,63 +0,0 @@ -For closure=DefId(0:4 ~ capture_disjoint_field_tuple[317d]::main::{closure#0}): Using new-style capture analysis -For closure=DefId(0:4 ~ capture_disjoint_field_tuple[317d]::main::{closure#0}): capture information: { - Place { - base_ty: (i32, i32), - base: Upvar( - UpvarId(HirId { owner: DefId(0:3 ~ capture_disjoint_field_tuple[317d]::main), local_id: 1 };`t`;DefId(0:4 ~ capture_disjoint_field_tuple[317d]::main::{closure#0})), - ), - projections: [ - Projection { - ty: i32, - kind: Field( - 0, - 0, - ), - }, - ], - }: CaptureInfo { - expr_id: Some( - HirId { - owner: DefId(0:3 ~ capture_disjoint_field_tuple[317d]::main), - local_id: 28, - }, - ), - capture_kind: ByRef( - UpvarBorrow(ImmBorrow, '_#35r), - ), - }, -} -For closure=DefId(0:4 ~ capture_disjoint_field_tuple[317d]::main::{closure#0}): min_captures={ - HirId { - owner: DefId(0:3 ~ capture_disjoint_field_tuple[317d]::main), - local_id: 1, - }: [ - CapturedPlace { - place: Place { - base_ty: (i32, i32), - base: Upvar( - UpvarId(HirId { owner: DefId(0:3 ~ capture_disjoint_field_tuple[317d]::main), local_id: 1 };`t`;DefId(0:4 ~ capture_disjoint_field_tuple[317d]::main::{closure#0})), - ), - projections: [ - Projection { - ty: i32, - kind: Field( - 0, - 0, - ), - }, - ], - }, - info: CaptureInfo { - expr_id: Some( - HirId { - owner: DefId(0:3 ~ capture_disjoint_field_tuple[317d]::main), - local_id: 28, - }, - ), - capture_kind: ByRef( - UpvarBorrow(ImmBorrow, '_#35r), - ), - }, - }, - ], -} diff --git a/src/test/ui/closures/2229_closure_analysis/feature-gate-capture_disjoint_fields.rs b/src/test/ui/closures/2229_closure_analysis/feature-gate-capture_disjoint_fields.rs index 072ed8eeab6..3713abe52df 100644 --- a/src/test/ui/closures/2229_closure_analysis/feature-gate-capture_disjoint_fields.rs +++ b/src/test/ui/closures/2229_closure_analysis/feature-gate-capture_disjoint_fields.rs @@ -9,5 +9,7 @@ fn main() { //~^ ERROR: attributes on expressions are experimental || { println!("This uses new capture analyysis to capture s={}", s); + //~^ ERROR: Capturing s[] -> ImmBorrow + //~^^ ERROR: Min Capture s[] -> ImmBorrow }; } diff --git a/src/test/ui/closures/2229_closure_analysis/feature-gate-capture_disjoint_fields.stderr b/src/test/ui/closures/2229_closure_analysis/feature-gate-capture_disjoint_fields.stderr index 133de1d13e8..6d4d7ee5fbe 100644 --- a/src/test/ui/closures/2229_closure_analysis/feature-gate-capture_disjoint_fields.stderr +++ b/src/test/ui/closures/2229_closure_analysis/feature-gate-capture_disjoint_fields.stderr @@ -16,6 +16,18 @@ LL | #![feature(capture_disjoint_fields)] = note: `#[warn(incomplete_features)]` on by default = note: see issue #53488 <https://github.com/rust-lang/rust/issues/53488> for more information -error: aborting due to previous error; 1 warning emitted +error: Capturing s[] -> ImmBorrow + --> $DIR/feature-gate-capture_disjoint_fields.rs:11:69 + | +LL | println!("This uses new capture analyysis to capture s={}", s); + | ^ + +error: Min Capture s[] -> ImmBorrow + --> $DIR/feature-gate-capture_disjoint_fields.rs:11:69 + | +LL | println!("This uses new capture analyysis to capture s={}", s); + | ^ + +error: aborting due to 3 previous errors; 1 warning emitted For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/closures/2229_closure_analysis/feature-gate-capture_disjoint_fields.stdout b/src/test/ui/closures/2229_closure_analysis/feature-gate-capture_disjoint_fields.stdout deleted file mode 100644 index 69722f9d21e..00000000000 --- a/src/test/ui/closures/2229_closure_analysis/feature-gate-capture_disjoint_fields.stdout +++ /dev/null @@ -1,47 +0,0 @@ -For closure=DefId(0:4 ~ feature_gate_capture_disjoint_fields[317d]::main::{closure#0}): Using new-style capture analysis -For closure=DefId(0:4 ~ feature_gate_capture_disjoint_fields[317d]::main::{closure#0}): capture information: { - Place { - base_ty: std::string::String, - base: Upvar( - UpvarId(HirId { owner: DefId(0:3 ~ feature_gate_capture_disjoint_fields[317d]::main), local_id: 1 };`s`;DefId(0:4 ~ feature_gate_capture_disjoint_fields[317d]::main::{closure#0})), - ), - projections: [], - }: CaptureInfo { - expr_id: Some( - HirId { - owner: DefId(0:3 ~ feature_gate_capture_disjoint_fields[317d]::main), - local_id: 52, - }, - ), - capture_kind: ByRef( - UpvarBorrow(ImmBorrow, '_#50r), - ), - }, -} -For closure=DefId(0:4 ~ feature_gate_capture_disjoint_fields[317d]::main::{closure#0}): min_captures={ - HirId { - owner: DefId(0:3 ~ feature_gate_capture_disjoint_fields[317d]::main), - local_id: 1, - }: [ - CapturedPlace { - place: Place { - base_ty: std::string::String, - base: Upvar( - UpvarId(HirId { owner: DefId(0:3 ~ feature_gate_capture_disjoint_fields[317d]::main), local_id: 1 };`s`;DefId(0:4 ~ feature_gate_capture_disjoint_fields[317d]::main::{closure#0})), - ), - projections: [], - }, - info: CaptureInfo { - expr_id: Some( - HirId { - owner: DefId(0:3 ~ feature_gate_capture_disjoint_fields[317d]::main), - local_id: 52, - }, - ), - capture_kind: ByRef( - UpvarBorrow(ImmBorrow, '_#50r), - ), - }, - }, - ], -} diff --git a/src/test/ui/closures/2229_closure_analysis/filter-on-struct-member.rs b/src/test/ui/closures/2229_closure_analysis/filter-on-struct-member.rs index aa251c4526c..3ef8b4acf97 100644 --- a/src/test/ui/closures/2229_closure_analysis/filter-on-struct-member.rs +++ b/src/test/ui/closures/2229_closure_analysis/filter-on-struct-member.rs @@ -22,9 +22,10 @@ impl Data { // The closure passed to filter only captures self.filter, // therefore mutating self.list is allowed. self.list.retain( - //~^ cannot borrow `self.list` as mutable because it is also borrowed as immutable #[rustc_capture_analysis] |v| self.filter.allowed(*v), + //~^ ERROR: Capturing self[Deref,(0, 0)] -> ImmBorrow + //~^^ ERROR: Min Capture self[Deref,(0, 0)] -> ImmBorrow ); } } diff --git a/src/test/ui/closures/2229_closure_analysis/filter-on-struct-member.stderr b/src/test/ui/closures/2229_closure_analysis/filter-on-struct-member.stderr index 3eb4decdeae..452ba5c6545 100644 --- a/src/test/ui/closures/2229_closure_analysis/filter-on-struct-member.stderr +++ b/src/test/ui/closures/2229_closure_analysis/filter-on-struct-member.stderr @@ -1,5 +1,5 @@ warning: the feature `capture_disjoint_fields` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/filter-on-struct-member.rs:1:12 + --> $DIR/filter-on-struct-member.rs:3:12 | LL | #![feature(capture_disjoint_fields)] | ^^^^^^^^^^^^^^^^^^^^^^^ @@ -7,22 +7,17 @@ LL | #![feature(capture_disjoint_fields)] = note: `#[warn(incomplete_features)]` on by default = note: see issue #53488 <https://github.com/rust-lang/rust/issues/53488> for more information -error[E0502]: cannot borrow `self.list` as mutable because it is also borrowed as immutable - --> $DIR/filter-on-struct-member.rs:22:9 +error: Capturing self[Deref,(0, 0)] -> ImmBorrow + --> $DIR/filter-on-struct-member.rs:26:17 | -LL | self.list.retain( - | ^ ------ immutable borrow later used by call - | _________| - | | -LL | | -LL | | #[rustc_capture_analysis] -LL | | |v| self.filter.allowed(*v), - | | --- ---- first borrow occurs due to use of `self` in closure - | | | - | | immutable borrow occurs here -LL | | ); - | |_________^ mutable borrow occurs here +LL | |v| self.filter.allowed(*v), + | ^^^^^^^^^^^ -error: aborting due to previous error; 1 warning emitted +error: Min Capture self[Deref,(0, 0)] -> ImmBorrow + --> $DIR/filter-on-struct-member.rs:26:17 + | +LL | |v| self.filter.allowed(*v), + | ^^^^^^^^^^^ + +error: aborting due to 2 previous errors; 1 warning emitted -For more information about this error, try `rustc --explain E0502`. diff --git a/src/test/ui/closures/2229_closure_analysis/filter-on-struct-member.stdout b/src/test/ui/closures/2229_closure_analysis/filter-on-struct-member.stdout deleted file mode 100644 index 44fb88e1520..00000000000 --- a/src/test/ui/closures/2229_closure_analysis/filter-on-struct-member.stdout +++ /dev/null @@ -1,71 +0,0 @@ -For closure=DefId(0:12 ~ filter_on_struct_member[317d]::{impl#1}::update::{closure#0}): Using new-style capture analysis -For closure=DefId(0:12 ~ filter_on_struct_member[317d]::{impl#1}::update::{closure#0}): capture information: { - Place { - base_ty: &mut Data, - base: Upvar( - UpvarId(HirId { owner: DefId(0:11 ~ filter_on_struct_member[317d]::{impl#1}::update), local_id: 1 };`self`;DefId(0:12 ~ filter_on_struct_member[317d]::{impl#1}::update::{closure#0})), - ), - projections: [ - Projection { - ty: Data, - kind: Deref, - }, - Projection { - ty: Filter, - kind: Field( - 0, - 0, - ), - }, - ], - }: CaptureInfo { - expr_id: Some( - HirId { - owner: DefId(0:11 ~ filter_on_struct_member[317d]::{impl#1}::update), - local_id: 13, - }, - ), - capture_kind: ByRef( - UpvarBorrow(ImmBorrow, '_#7r), - ), - }, -} -For closure=DefId(0:12 ~ filter_on_struct_member[317d]::{impl#1}::update::{closure#0}): min_captures={ - HirId { - owner: DefId(0:11 ~ filter_on_struct_member[317d]::{impl#1}::update), - local_id: 1, - }: [ - CapturedPlace { - place: Place { - base_ty: &mut Data, - base: Upvar( - UpvarId(HirId { owner: DefId(0:11 ~ filter_on_struct_member[317d]::{impl#1}::update), local_id: 1 };`self`;DefId(0:12 ~ filter_on_struct_member[317d]::{impl#1}::update::{closure#0})), - ), - projections: [ - Projection { - ty: Data, - kind: Deref, - }, - Projection { - ty: Filter, - kind: Field( - 0, - 0, - ), - }, - ], - }, - info: CaptureInfo { - expr_id: Some( - HirId { - owner: DefId(0:11 ~ filter_on_struct_member[317d]::{impl#1}::update), - local_id: 13, - }, - ), - capture_kind: ByRef( - UpvarBorrow(ImmBorrow, '_#7r), - ), - }, - }, - ], -} diff --git a/src/test/ui/closures/2229_closure_analysis/multilevel-path-1.rs b/src/test/ui/closures/2229_closure_analysis/multilevel-path-1.rs index bd8d52d6a3c..a6793a43488 100644 --- a/src/test/ui/closures/2229_closure_analysis/multilevel-path-1.rs +++ b/src/test/ui/closures/2229_closure_analysis/multilevel-path-1.rs @@ -23,6 +23,8 @@ fn main() { //~^ ERROR: attributes on expressions are experimental || { let wp = &w.p; + //~^ ERROR: Capturing w[(0, 0)] -> ImmBorrow + //~^^ ERROR: Min Capture w[(0, 0)] -> ImmBorrow println!("{}", wp.x); }; diff --git a/src/test/ui/closures/2229_closure_analysis/multilevel-path-1.stderr b/src/test/ui/closures/2229_closure_analysis/multilevel-path-1.stderr index bd339a68fa0..e8368201ede 100644 --- a/src/test/ui/closures/2229_closure_analysis/multilevel-path-1.stderr +++ b/src/test/ui/closures/2229_closure_analysis/multilevel-path-1.stderr @@ -16,6 +16,18 @@ LL | #![feature(capture_disjoint_fields)] = note: `#[warn(incomplete_features)]` on by default = note: see issue #53488 <https://github.com/rust-lang/rust/issues/53488> for more information -error: aborting due to previous error; 1 warning emitted +error: Capturing w[(0, 0)] -> ImmBorrow + --> $DIR/multilevel-path-1.rs:25:19 + | +LL | let wp = &w.p; + | ^^^ + +error: Min Capture w[(0, 0)] -> ImmBorrow + --> $DIR/multilevel-path-1.rs:25:19 + | +LL | let wp = &w.p; + | ^^^ + +error: aborting due to 3 previous errors; 1 warning emitted For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/closures/2229_closure_analysis/multilevel-path-1.stdout b/src/test/ui/closures/2229_closure_analysis/multilevel-path-1.stdout deleted file mode 100644 index 63a3669d0a7..00000000000 --- a/src/test/ui/closures/2229_closure_analysis/multilevel-path-1.stdout +++ /dev/null @@ -1,63 +0,0 @@ -For closure=DefId(0:9 ~ multilevel_path_1[317d]::main::{closure#0}): Using new-style capture analysis -For closure=DefId(0:9 ~ multilevel_path_1[317d]::main::{closure#0}): capture information: { - Place { - base_ty: Wrapper, - base: Upvar( - UpvarId(HirId { owner: DefId(0:8 ~ multilevel_path_1[317d]::main), local_id: 1 };`w`;DefId(0:9 ~ multilevel_path_1[317d]::main::{closure#0})), - ), - projections: [ - Projection { - ty: Point, - kind: Field( - 0, - 0, - ), - }, - ], - }: CaptureInfo { - expr_id: Some( - HirId { - owner: DefId(0:8 ~ multilevel_path_1[317d]::main), - local_id: 20, - }, - ), - capture_kind: ByRef( - UpvarBorrow(ImmBorrow, '_#37r), - ), - }, -} -For closure=DefId(0:9 ~ multilevel_path_1[317d]::main::{closure#0}): min_captures={ - HirId { - owner: DefId(0:8 ~ multilevel_path_1[317d]::main), - local_id: 1, - }: [ - CapturedPlace { - place: Place { - base_ty: Wrapper, - base: Upvar( - UpvarId(HirId { owner: DefId(0:8 ~ multilevel_path_1[317d]::main), local_id: 1 };`w`;DefId(0:9 ~ multilevel_path_1[317d]::main::{closure#0})), - ), - projections: [ - Projection { - ty: Point, - kind: Field( - 0, - 0, - ), - }, - ], - }, - info: CaptureInfo { - expr_id: Some( - HirId { - owner: DefId(0:8 ~ multilevel_path_1[317d]::main), - local_id: 20, - }, - ), - capture_kind: ByRef( - UpvarBorrow(ImmBorrow, '_#37r), - ), - }, - }, - ], -} diff --git a/src/test/ui/closures/2229_closure_analysis/multilevel-path-2.rs b/src/test/ui/closures/2229_closure_analysis/multilevel-path-2.rs index a8aca53bc73..994e2530f78 100644 --- a/src/test/ui/closures/2229_closure_analysis/multilevel-path-2.rs +++ b/src/test/ui/closures/2229_closure_analysis/multilevel-path-2.rs @@ -20,6 +20,8 @@ fn main() { //~^ ERROR: attributes on expressions are experimental || { println!("{}", w.p.x); + //~^ ERROR: Capturing w[(0, 0),(0, 0)] -> ImmBorrow + //~^^ ERROR: Min Capture w[(0, 0),(0, 0)] -> ImmBorrow }; // `c` only captures `w.p.x`, therefore it's safe to mutate `w.p.y`. diff --git a/src/test/ui/closures/2229_closure_analysis/multilevel-path-2.stderr b/src/test/ui/closures/2229_closure_analysis/multilevel-path-2.stderr index 772dfd643ea..dfcd2c7a088 100644 --- a/src/test/ui/closures/2229_closure_analysis/multilevel-path-2.stderr +++ b/src/test/ui/closures/2229_closure_analysis/multilevel-path-2.stderr @@ -16,6 +16,18 @@ LL | #![feature(capture_disjoint_fields)] = note: `#[warn(incomplete_features)]` on by default = note: see issue #53488 <https://github.com/rust-lang/rust/issues/53488> for more information -error: aborting due to previous error; 1 warning emitted +error: Capturing w[(0, 0),(0, 0)] -> ImmBorrow + --> $DIR/multilevel-path-2.rs:22:24 + | +LL | println!("{}", w.p.x); + | ^^^^^ + +error: Min Capture w[(0, 0),(0, 0)] -> ImmBorrow + --> $DIR/multilevel-path-2.rs:22:24 + | +LL | println!("{}", w.p.x); + | ^^^^^ + +error: aborting due to 3 previous errors; 1 warning emitted For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/closures/2229_closure_analysis/multilevel-path-2.stdout b/src/test/ui/closures/2229_closure_analysis/multilevel-path-2.stdout deleted file mode 100644 index 576d2c36b6f..00000000000 --- a/src/test/ui/closures/2229_closure_analysis/multilevel-path-2.stdout +++ /dev/null @@ -1,77 +0,0 @@ -For closure=DefId(0:9 ~ multilevel_path_2[317d]::main::{closure#0}): Using new-style capture analysis -For closure=DefId(0:9 ~ multilevel_path_2[317d]::main::{closure#0}): capture information: { - Place { - base_ty: Wrapper, - base: Upvar( - UpvarId(HirId { owner: DefId(0:8 ~ multilevel_path_2[317d]::main), local_id: 1 };`w`;DefId(0:9 ~ multilevel_path_2[317d]::main::{closure#0})), - ), - projections: [ - Projection { - ty: Point, - kind: Field( - 0, - 0, - ), - }, - Projection { - ty: i32, - kind: Field( - 0, - 0, - ), - }, - ], - }: CaptureInfo { - expr_id: Some( - HirId { - owner: DefId(0:8 ~ multilevel_path_2[317d]::main), - local_id: 35, - }, - ), - capture_kind: ByRef( - UpvarBorrow(ImmBorrow, '_#35r), - ), - }, -} -For closure=DefId(0:9 ~ multilevel_path_2[317d]::main::{closure#0}): min_captures={ - HirId { - owner: DefId(0:8 ~ multilevel_path_2[317d]::main), - local_id: 1, - }: [ - CapturedPlace { - place: Place { - base_ty: Wrapper, - base: Upvar( - UpvarId(HirId { owner: DefId(0:8 ~ multilevel_path_2[317d]::main), local_id: 1 };`w`;DefId(0:9 ~ multilevel_path_2[317d]::main::{closure#0})), - ), - projections: [ - Projection { - ty: Point, - kind: Field( - 0, - 0, - ), - }, - Projection { - ty: i32, - kind: Field( - 0, - 0, - ), - }, - ], - }, - info: CaptureInfo { - expr_id: Some( - HirId { - owner: DefId(0:8 ~ multilevel_path_2[317d]::main), - local_id: 35, - }, - ), - capture_kind: ByRef( - UpvarBorrow(ImmBorrow, '_#35r), - ), - }, - }, - ], -} diff --git a/src/test/ui/closures/2229_closure_analysis/nested-closure.rs b/src/test/ui/closures/2229_closure_analysis/nested-closure.rs index 64b69af0f0c..8641d6b4f59 100644 --- a/src/test/ui/closures/2229_closure_analysis/nested-closure.rs +++ b/src/test/ui/closures/2229_closure_analysis/nested-closure.rs @@ -22,10 +22,18 @@ fn main() { //~^ ERROR: attributes on expressions are experimental || { println!("{}", p.x); + //~^ ERROR: Capturing p[(0, 0)] -> ImmBorrow + //~^^ ERROR: Min Capture p[(0, 0)] -> ImmBorrow let incr = 10; let mut c2 = #[rustc_capture_analysis] //~^ ERROR: attributes on expressions are experimental || p.y += incr; + //~^ ERROR: Capturing p[(1, 0)] -> MutBorrow + //~^^ ERROR: Capturing incr[] -> ImmBorrow + //~^^^ ERROR: Min Capture p[(1, 0)] -> MutBorrow + //~^^^^ ERROR: Min Capture incr[] -> ImmBorrow + //~^^^^^ ERROR: Capturing p[(1, 0)] -> MutBorrow + //~^^^^^^ ERROR: Min Capture p[(1, 0)] -> MutBorrow c2(); println!("{}", p.y); }; diff --git a/src/test/ui/closures/2229_closure_analysis/nested-closure.stderr b/src/test/ui/closures/2229_closure_analysis/nested-closure.stderr index dbd9e3655a3..2368a450bc6 100644 --- a/src/test/ui/closures/2229_closure_analysis/nested-closure.stderr +++ b/src/test/ui/closures/2229_closure_analysis/nested-closure.stderr @@ -1,5 +1,5 @@ error[E0658]: attributes on expressions are experimental - --> $DIR/nested-closure.rs:19:18 + --> $DIR/nested-closure.rs:21:18 | LL | let mut c1 = #[rustc_capture_analysis] | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -8,7 +8,7 @@ LL | let mut c1 = #[rustc_capture_analysis] = help: add `#![feature(stmt_expr_attributes)]` to the crate attributes to enable error[E0658]: attributes on expressions are experimental - --> $DIR/nested-closure.rs:24:22 + --> $DIR/nested-closure.rs:28:22 | LL | let mut c2 = #[rustc_capture_analysis] | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -17,7 +17,7 @@ LL | let mut c2 = #[rustc_capture_analysis] = help: add `#![feature(stmt_expr_attributes)]` to the crate attributes to enable warning: the feature `capture_disjoint_fields` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/nested-closure.rs:1:12 + --> $DIR/nested-closure.rs:3:12 | LL | #![feature(capture_disjoint_fields)] | ^^^^^^^^^^^^^^^^^^^^^^^ @@ -25,6 +25,54 @@ LL | #![feature(capture_disjoint_fields)] = note: `#[warn(incomplete_features)]` on by default = note: see issue #53488 <https://github.com/rust-lang/rust/issues/53488> for more information -error: aborting due to 2 previous errors; 1 warning emitted +error: Capturing p[(1, 0)] -> MutBorrow + --> $DIR/nested-closure.rs:30:12 + | +LL | || p.y += incr; + | ^^^ + +error: Capturing incr[] -> ImmBorrow + --> $DIR/nested-closure.rs:30:19 + | +LL | || p.y += incr; + | ^^^^ + +error: Min Capture p[(1, 0)] -> MutBorrow + --> $DIR/nested-closure.rs:30:12 + | +LL | || p.y += incr; + | ^^^ + +error: Min Capture incr[] -> ImmBorrow + --> $DIR/nested-closure.rs:30:19 + | +LL | || p.y += incr; + | ^^^^ + +error: Capturing p[(0, 0)] -> ImmBorrow + --> $DIR/nested-closure.rs:24:24 + | +LL | println!("{}", p.x); + | ^^^ + +error: Capturing p[(1, 0)] -> MutBorrow + --> $DIR/nested-closure.rs:30:12 + | +LL | || p.y += incr; + | ^^^ + +error: Min Capture p[(0, 0)] -> ImmBorrow + --> $DIR/nested-closure.rs:24:24 + | +LL | println!("{}", p.x); + | ^^^ + +error: Min Capture p[(1, 0)] -> MutBorrow + --> $DIR/nested-closure.rs:30:12 + | +LL | || p.y += incr; + | ^^^ + +error: aborting due to 10 previous errors; 1 warning emitted For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/closures/2229_closure_analysis/nested-closure.stdout b/src/test/ui/closures/2229_closure_analysis/nested-closure.stdout deleted file mode 100644 index 446419c75f5..00000000000 --- a/src/test/ui/closures/2229_closure_analysis/nested-closure.stdout +++ /dev/null @@ -1,221 +0,0 @@ -For closure=DefId(0:8 ~ nested_closure[317d]::main::{closure#0}::{closure#0}): Using new-style capture analysis -For closure=DefId(0:8 ~ nested_closure[317d]::main::{closure#0}::{closure#0}): capture information: { - Place { - base_ty: Point, - base: Upvar( - UpvarId(HirId { owner: DefId(0:6 ~ nested_closure[317d]::main), local_id: 1 };`p`;DefId(0:8 ~ nested_closure[317d]::main::{closure#0}::{closure#0})), - ), - projections: [ - Projection { - ty: i32, - kind: Field( - 1, - 0, - ), - }, - ], - }: CaptureInfo { - expr_id: Some( - HirId { - owner: DefId(0:6 ~ nested_closure[317d]::main), - local_id: 70, - }, - ), - capture_kind: ByRef( - UpvarBorrow(MutBorrow, '_#109r), - ), - }, - Place { - base_ty: i32, - base: Upvar( - UpvarId(HirId { owner: DefId(0:6 ~ nested_closure[317d]::main), local_id: 5 };`incr`;DefId(0:8 ~ nested_closure[317d]::main::{closure#0}::{closure#0})), - ), - projections: [], - }: CaptureInfo { - expr_id: Some( - HirId { - owner: DefId(0:6 ~ nested_closure[317d]::main), - local_id: 72, - }, - ), - capture_kind: ByRef( - UpvarBorrow(ImmBorrow, '_#110r), - ), - }, -} -For closure=DefId(0:8 ~ nested_closure[317d]::main::{closure#0}::{closure#0}): min_captures={ - HirId { - owner: DefId(0:6 ~ nested_closure[317d]::main), - local_id: 1, - }: [ - CapturedPlace { - place: Place { - base_ty: Point, - base: Upvar( - UpvarId(HirId { owner: DefId(0:6 ~ nested_closure[317d]::main), local_id: 1 };`p`;DefId(0:8 ~ nested_closure[317d]::main::{closure#0}::{closure#0})), - ), - projections: [ - Projection { - ty: i32, - kind: Field( - 1, - 0, - ), - }, - ], - }, - info: CaptureInfo { - expr_id: Some( - HirId { - owner: DefId(0:6 ~ nested_closure[317d]::main), - local_id: 70, - }, - ), - capture_kind: ByRef( - UpvarBorrow(MutBorrow, '_#109r), - ), - }, - }, - ], - HirId { - owner: DefId(0:6 ~ nested_closure[317d]::main), - local_id: 5, - }: [ - CapturedPlace { - place: Place { - base_ty: i32, - base: Upvar( - UpvarId(HirId { owner: DefId(0:6 ~ nested_closure[317d]::main), local_id: 5 };`incr`;DefId(0:8 ~ nested_closure[317d]::main::{closure#0}::{closure#0})), - ), - projections: [], - }, - info: CaptureInfo { - expr_id: Some( - HirId { - owner: DefId(0:6 ~ nested_closure[317d]::main), - local_id: 72, - }, - ), - capture_kind: ByRef( - UpvarBorrow(ImmBorrow, '_#110r), - ), - }, - }, - ], -} -For closure=DefId(0:7 ~ nested_closure[317d]::main::{closure#0}): Using new-style capture analysis -For closure=DefId(0:7 ~ nested_closure[317d]::main::{closure#0}): capture information: { - Place { - base_ty: Point, - base: Upvar( - UpvarId(HirId { owner: DefId(0:6 ~ nested_closure[317d]::main), local_id: 1 };`p`;DefId(0:7 ~ nested_closure[317d]::main::{closure#0})), - ), - projections: [ - Projection { - ty: i32, - kind: Field( - 0, - 0, - ), - }, - ], - }: CaptureInfo { - expr_id: Some( - HirId { - owner: DefId(0:6 ~ nested_closure[317d]::main), - local_id: 37, - }, - ), - capture_kind: ByRef( - UpvarBorrow(ImmBorrow, '_#114r), - ), - }, - Place { - base_ty: Point, - base: Upvar( - UpvarId(HirId { owner: DefId(0:6 ~ nested_closure[317d]::main), local_id: 1 };`p`;DefId(0:7 ~ nested_closure[317d]::main::{closure#0})), - ), - projections: [ - Projection { - ty: i32, - kind: Field( - 1, - 0, - ), - }, - ], - }: CaptureInfo { - expr_id: Some( - HirId { - owner: DefId(0:6 ~ nested_closure[317d]::main), - local_id: 70, - }, - ), - capture_kind: ByRef( - UpvarBorrow(MutBorrow, '_#115r), - ), - }, -} -For closure=DefId(0:7 ~ nested_closure[317d]::main::{closure#0}): min_captures={ - HirId { - owner: DefId(0:6 ~ nested_closure[317d]::main), - local_id: 1, - }: [ - CapturedPlace { - place: Place { - base_ty: Point, - base: Upvar( - UpvarId(HirId { owner: DefId(0:6 ~ nested_closure[317d]::main), local_id: 1 };`p`;DefId(0:7 ~ nested_closure[317d]::main::{closure#0})), - ), - projections: [ - Projection { - ty: i32, - kind: Field( - 0, - 0, - ), - }, - ], - }, - info: CaptureInfo { - expr_id: Some( - HirId { - owner: DefId(0:6 ~ nested_closure[317d]::main), - local_id: 37, - }, - ), - capture_kind: ByRef( - UpvarBorrow(ImmBorrow, '_#114r), - ), - }, - }, - CapturedPlace { - place: Place { - base_ty: Point, - base: Upvar( - UpvarId(HirId { owner: DefId(0:6 ~ nested_closure[317d]::main), local_id: 1 };`p`;DefId(0:7 ~ nested_closure[317d]::main::{closure#0})), - ), - projections: [ - Projection { - ty: i32, - kind: Field( - 1, - 0, - ), - }, - ], - }, - info: CaptureInfo { - expr_id: Some( - HirId { - owner: DefId(0:6 ~ nested_closure[317d]::main), - local_id: 70, - }, - ), - capture_kind: ByRef( - UpvarBorrow(MutBorrow, '_#115r), - ), - }, - }, - ], -} diff --git a/src/test/ui/closures/2229_closure_analysis/path-with-array-access.rs b/src/test/ui/closures/2229_closure_analysis/path-with-array-access.rs index c967c0b72d4..48e0698b4a7 100644 --- a/src/test/ui/closures/2229_closure_analysis/path-with-array-access.rs +++ b/src/test/ui/closures/2229_closure_analysis/path-with-array-access.rs @@ -24,5 +24,7 @@ fn main() { //~^ ERROR: attributes on expressions are experimental || { println!("{}", pent.points[5].x); + //~^ ERROR: Capturing pent[(0, 0)] -> ImmBorrow + //~^^ ERROR: Min Capture pent[(0, 0)] -> ImmBorrow }; } diff --git a/src/test/ui/closures/2229_closure_analysis/path-with-array-access.stderr b/src/test/ui/closures/2229_closure_analysis/path-with-array-access.stderr index 84bcc55d99c..7507e550ade 100644 --- a/src/test/ui/closures/2229_closure_analysis/path-with-array-access.stderr +++ b/src/test/ui/closures/2229_closure_analysis/path-with-array-access.stderr @@ -16,6 +16,18 @@ LL | #![feature(capture_disjoint_fields)] = note: `#[warn(incomplete_features)]` on by default = note: see issue #53488 <https://github.com/rust-lang/rust/issues/53488> for more information -error: aborting due to previous error; 1 warning emitted +error: Capturing pent[(0, 0)] -> ImmBorrow + --> $DIR/path-with-array-access.rs:26:24 + | +LL | println!("{}", pent.points[5].x); + | ^^^^^^^^^^^ + +error: Min Capture pent[(0, 0)] -> ImmBorrow + --> $DIR/path-with-array-access.rs:26:24 + | +LL | println!("{}", pent.points[5].x); + | ^^^^^^^^^^^ + +error: aborting due to 3 previous errors; 1 warning emitted For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/closures/2229_closure_analysis/path-with-array-access.stdout b/src/test/ui/closures/2229_closure_analysis/path-with-array-access.stdout deleted file mode 100644 index 73f880c155a..00000000000 --- a/src/test/ui/closures/2229_closure_analysis/path-with-array-access.stdout +++ /dev/null @@ -1,63 +0,0 @@ -For closure=DefId(0:10 ~ path_with_array_access[317d]::main::{closure#0}): Using new-style capture analysis -For closure=DefId(0:10 ~ path_with_array_access[317d]::main::{closure#0}): capture information: { - Place { - base_ty: Pentagon, - base: Upvar( - UpvarId(HirId { owner: DefId(0:9 ~ path_with_array_access[317d]::main), local_id: 6 };`pent`;DefId(0:10 ~ path_with_array_access[317d]::main::{closure#0})), - ), - projections: [ - Projection { - ty: [Point; 5], - kind: Field( - 0, - 0, - ), - }, - ], - }: CaptureInfo { - expr_id: Some( - HirId { - owner: DefId(0:9 ~ path_with_array_access[317d]::main), - local_id: 83, - }, - ), - capture_kind: ByRef( - UpvarBorrow(ImmBorrow, '_#34r), - ), - }, -} -For closure=DefId(0:10 ~ path_with_array_access[317d]::main::{closure#0}): min_captures={ - HirId { - owner: DefId(0:9 ~ path_with_array_access[317d]::main), - local_id: 6, - }: [ - CapturedPlace { - place: Place { - base_ty: Pentagon, - base: Upvar( - UpvarId(HirId { owner: DefId(0:9 ~ path_with_array_access[317d]::main), local_id: 6 };`pent`;DefId(0:10 ~ path_with_array_access[317d]::main::{closure#0})), - ), - projections: [ - Projection { - ty: [Point; 5], - kind: Field( - 0, - 0, - ), - }, - ], - }, - info: CaptureInfo { - expr_id: Some( - HirId { - owner: DefId(0:9 ~ path_with_array_access[317d]::main), - local_id: 83, - }, - ), - capture_kind: ByRef( - UpvarBorrow(ImmBorrow, '_#34r), - ), - }, - }, - ], -} diff --git a/src/test/ui/closures/2229_closure_analysis/simple-struct-min-capture.rs b/src/test/ui/closures/2229_closure_analysis/simple-struct-min-capture.rs index 27ab9d6b735..3d5a08344b7 100644 --- a/src/test/ui/closures/2229_closure_analysis/simple-struct-min-capture.rs +++ b/src/test/ui/closures/2229_closure_analysis/simple-struct-min-capture.rs @@ -26,7 +26,10 @@ fn main() { //~^ ERROR: attributes on expressions are experimental || { p.x += 10; + //~^ ERROR: Capturing p[(0, 0)] -> MutBorrow + //~^^ ERROR: Min Capture p[] -> MutBorrow println!("{:?}", p); + //~^ ERROR: Capturing p[] -> ImmBorrow }; c(); diff --git a/src/test/ui/closures/2229_closure_analysis/simple-struct-min-capture.stderr b/src/test/ui/closures/2229_closure_analysis/simple-struct-min-capture.stderr index 002d2aaab89..53cc681969a 100644 --- a/src/test/ui/closures/2229_closure_analysis/simple-struct-min-capture.stderr +++ b/src/test/ui/closures/2229_closure_analysis/simple-struct-min-capture.stderr @@ -16,6 +16,24 @@ LL | #![feature(capture_disjoint_fields)] = note: `#[warn(incomplete_features)]` on by default = note: see issue #53488 <https://github.com/rust-lang/rust/issues/53488> for more information -error: aborting due to previous error; 1 warning emitted +error: Capturing p[(0, 0)] -> MutBorrow + --> $DIR/simple-struct-min-capture.rs:28:9 + | +LL | p.x += 10; + | ^^^ + +error: Capturing p[] -> ImmBorrow + --> $DIR/simple-struct-min-capture.rs:31:26 + | +LL | println!("{:?}", p); + | ^ + +error: Min Capture p[] -> MutBorrow + --> $DIR/simple-struct-min-capture.rs:28:9 + | +LL | p.x += 10; + | ^^^ + +error: aborting due to 4 previous errors; 1 warning emitted For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/closures/2229_closure_analysis/simple-struct-min-capture.stdout b/src/test/ui/closures/2229_closure_analysis/simple-struct-min-capture.stdout deleted file mode 100644 index c0421852d93..00000000000 --- a/src/test/ui/closures/2229_closure_analysis/simple-struct-min-capture.stdout +++ /dev/null @@ -1,72 +0,0 @@ -For closure=DefId(0:4 ~ simple_struct_min_capture[317d]::main::{closure#0}): Using new-style capture analysis -For closure=DefId(0:4 ~ simple_struct_min_capture[317d]::main::{closure#0}): capture information: { - Place { - base_ty: Point, - base: Upvar( - UpvarId(HirId { owner: DefId(0:3 ~ simple_struct_min_capture[317d]::main), local_id: 1 };`p`;DefId(0:4 ~ simple_struct_min_capture[317d]::main::{closure#0})), - ), - projections: [ - Projection { - ty: i32, - kind: Field( - 0, - 0, - ), - }, - ], - }: CaptureInfo { - expr_id: Some( - HirId { - owner: DefId(0:3 ~ simple_struct_min_capture[317d]::main), - local_id: 15, - }, - ), - capture_kind: ByRef( - UpvarBorrow(MutBorrow, '_#34r), - ), - }, - Place { - base_ty: Point, - base: Upvar( - UpvarId(HirId { owner: DefId(0:3 ~ simple_struct_min_capture[317d]::main), local_id: 1 };`p`;DefId(0:4 ~ simple_struct_min_capture[317d]::main::{closure#0})), - ), - projections: [], - }: CaptureInfo { - expr_id: Some( - HirId { - owner: DefId(0:3 ~ simple_struct_min_capture[317d]::main), - local_id: 35, - }, - ), - capture_kind: ByRef( - UpvarBorrow(ImmBorrow, '_#35r), - ), - }, -} -For closure=DefId(0:4 ~ simple_struct_min_capture[317d]::main::{closure#0}): min_captures={ - HirId { - owner: DefId(0:3 ~ simple_struct_min_capture[317d]::main), - local_id: 1, - }: [ - CapturedPlace { - place: Place { - base_ty: Point, - base: Upvar( - UpvarId(HirId { owner: DefId(0:3 ~ simple_struct_min_capture[317d]::main), local_id: 1 };`p`;DefId(0:4 ~ simple_struct_min_capture[317d]::main::{closure#0})), - ), - projections: [], - }, - info: CaptureInfo { - expr_id: Some( - HirId { - owner: DefId(0:3 ~ simple_struct_min_capture[317d]::main), - local_id: 15, - }, - ), - capture_kind: ByRef( - UpvarBorrow(MutBorrow, '_#34r), - ), - }, - }, - ], -} diff --git a/src/test/ui/closures/2229_closure_analysis/slice-pat.rs b/src/test/ui/closures/2229_closure_analysis/slice-pat.rs index fc966c4193e..4e30194b17e 100644 --- a/src/test/ui/closures/2229_closure_analysis/slice-pat.rs +++ b/src/test/ui/closures/2229_closure_analysis/slice-pat.rs @@ -19,6 +19,8 @@ fn main() { //~^ ERROR: attributes on expressions are experimental || { let [a, b, .., e] = arr; + //~^ ERROR: Capturing arr[Index] -> ByValue + //~^^ ERROR: Min Capture arr[] -> ByValue assert_eq!(a, "A"); assert_eq!(b, "B"); assert_eq!(e, "E"); diff --git a/src/test/ui/closures/2229_closure_analysis/slice-pat.stderr b/src/test/ui/closures/2229_closure_analysis/slice-pat.stderr index 5c6b505d64f..2547322a8ab 100644 --- a/src/test/ui/closures/2229_closure_analysis/slice-pat.stderr +++ b/src/test/ui/closures/2229_closure_analysis/slice-pat.stderr @@ -16,6 +16,18 @@ LL | #![feature(capture_disjoint_fields)] = note: `#[warn(incomplete_features)]` on by default = note: see issue #53488 <https://github.com/rust-lang/rust/issues/53488> for more information -error: aborting due to previous error; 1 warning emitted +error: Capturing arr[Index] -> ByValue + --> $DIR/slice-pat.rs:21:33 + | +LL | let [a, b, .., e] = arr; + | ^^^ + +error: Min Capture arr[] -> ByValue + --> $DIR/slice-pat.rs:21:33 + | +LL | let [a, b, .., e] = arr; + | ^^^ + +error: aborting due to 3 previous errors; 1 warning emitted For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/closures/2229_closure_analysis/slice-pat.stdout b/src/test/ui/closures/2229_closure_analysis/slice-pat.stdout deleted file mode 100644 index 43c43015134..00000000000 --- a/src/test/ui/closures/2229_closure_analysis/slice-pat.stdout +++ /dev/null @@ -1,56 +0,0 @@ -For closure=DefId(0:5 ~ slice_pat[317d]::main::{closure#0}): Using new-style capture analysis -For closure=DefId(0:5 ~ slice_pat[317d]::main::{closure#0}): capture information: { - Place { - base_ty: [std::string::String; 5], - base: Upvar( - UpvarId(HirId { owner: DefId(0:3 ~ slice_pat[317d]::main), local_id: 1 };`arr`;DefId(0:5 ~ slice_pat[317d]::main::{closure#0})), - ), - projections: [ - Projection { - ty: std::string::String, - kind: Index, - }, - ], - }: CaptureInfo { - expr_id: Some( - HirId { - owner: DefId(0:3 ~ slice_pat[317d]::main), - local_id: 179, - }, - ), - capture_kind: ByValue( - Some( - $DIR/slice-pat.rs:21:33: 21:36 (#0), - ), - ), - }, -} -For closure=DefId(0:5 ~ slice_pat[317d]::main::{closure#0}): min_captures={ - HirId { - owner: DefId(0:3 ~ slice_pat[317d]::main), - local_id: 1, - }: [ - CapturedPlace { - place: Place { - base_ty: [std::string::String; 5], - base: Upvar( - UpvarId(HirId { owner: DefId(0:3 ~ slice_pat[317d]::main), local_id: 1 };`arr`;DefId(0:5 ~ slice_pat[317d]::main::{closure#0})), - ), - projections: [], - }, - info: CaptureInfo { - expr_id: Some( - HirId { - owner: DefId(0:3 ~ slice_pat[317d]::main), - local_id: 179, - }, - ), - capture_kind: ByValue( - Some( - $DIR/slice-pat.rs:21:33: 21:36 (#0), - ), - ), - }, - }, - ], -} |
