diff options
| author | Aman Arora <me@aman-arora.com> | 2020-10-13 14:02:38 -0400 |
|---|---|---|
| committer | Aman Arora <me@aman-arora.com> | 2020-11-10 20:58:55 -0500 |
| commit | b16815b58d2f584b0a337a3456c1238a96b3f443 (patch) | |
| tree | 64de0c3c5facdc57d4f1604d0778cdd37d17acc6 | |
| parent | 8f0c0d656d5ca2b17910ec7990691ae5dcd7c1e4 (diff) | |
| download | rust-b16815b58d2f584b0a337a3456c1238a96b3f443.tar.gz rust-b16815b58d2f584b0a337a3456c1238a96b3f443.zip | |
Update tests with min capture information
Co-authored-by: Chris Pardy <chrispardy36@gmail.com> Co-authored-by: Logan Mosier <logmosier@gmail.com>
11 files changed, 454 insertions, 0 deletions
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 index b4142a4fd8e..e0cd06f765e 100644 --- a/src/test/ui/closures/2229_closure_analysis/arrays-completely-captured.stdout +++ b/src/test/ui/closures/2229_closure_analysis/arrays-completely-captured.stdout @@ -18,3 +18,30 @@ For closure=DefId(0:4 ~ arrays_completely_captured[317d]::main::{closure#0}): ca ), }, } +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.stdout b/src/test/ui/closures/2229_closure_analysis/capture-disjoint-field-struct.stdout index ab7bd60e48d..d378b12a235 100644 --- 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 @@ -26,3 +26,38 @@ For closure=DefId(0:7 ~ capture_disjoint_field_struct[317d]::main::{closure#0}): ), }, } +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.stdout b/src/test/ui/closures/2229_closure_analysis/capture-disjoint-field-tuple.stdout index 517d7564c72..9a080c28d4e 100644 --- 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 @@ -26,3 +26,38 @@ For closure=DefId(0:4 ~ capture_disjoint_field_tuple[317d]::main::{closure#0}): ), }, } +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.stdout b/src/test/ui/closures/2229_closure_analysis/feature-gate-capture_disjoint_fields.stdout index 40ac31b4ad9..69722f9d21e 100644 --- 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 @@ -18,3 +18,30 @@ For closure=DefId(0:4 ~ feature_gate_capture_disjoint_fields[317d]::main::{closu ), }, } +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.stdout b/src/test/ui/closures/2229_closure_analysis/filter-on-struct-member.stdout index 560b2aa3b57..44fb88e1520 100644 --- 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 @@ -30,3 +30,42 @@ For closure=DefId(0:12 ~ filter_on_struct_member[317d]::{impl#1}::update::{closu ), }, } +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.stdout b/src/test/ui/closures/2229_closure_analysis/multilevel-path-1.stdout index 525366cb964..63a3669d0a7 100644 --- a/src/test/ui/closures/2229_closure_analysis/multilevel-path-1.stdout +++ b/src/test/ui/closures/2229_closure_analysis/multilevel-path-1.stdout @@ -26,3 +26,38 @@ For closure=DefId(0:9 ~ multilevel_path_1[317d]::main::{closure#0}): capture inf ), }, } +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.stdout b/src/test/ui/closures/2229_closure_analysis/multilevel-path-2.stdout index f89670c8b7f..576d2c36b6f 100644 --- a/src/test/ui/closures/2229_closure_analysis/multilevel-path-2.stdout +++ b/src/test/ui/closures/2229_closure_analysis/multilevel-path-2.stdout @@ -33,3 +33,45 @@ For closure=DefId(0:9 ~ multilevel_path_2[317d]::main::{closure#0}): capture inf ), }, } +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.stdout b/src/test/ui/closures/2229_closure_analysis/nested-closure.stdout index 84d87a75bda..446419c75f5 100644 --- a/src/test/ui/closures/2229_closure_analysis/nested-closure.stdout +++ b/src/test/ui/closures/2229_closure_analysis/nested-closure.stdout @@ -43,6 +43,66 @@ For closure=DefId(0:8 ~ nested_closure[317d]::main::{closure#0}::{closure#0}): c ), }, } +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 { @@ -96,3 +156,66 @@ For closure=DefId(0:7 ~ nested_closure[317d]::main::{closure#0}): capture inform ), }, } +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.stdout b/src/test/ui/closures/2229_closure_analysis/path-with-array-access.stdout index b843b0494b9..73f880c155a 100644 --- 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 @@ -26,3 +26,38 @@ For closure=DefId(0:10 ~ path_with_array_access[317d]::main::{closure#0}): captu ), }, } +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.stdout b/src/test/ui/closures/2229_closure_analysis/simple-struct-min-capture.stdout index 02129f1acb5..c0421852d93 100644 --- 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 @@ -43,3 +43,30 @@ For closure=DefId(0:4 ~ simple_struct_min_capture[317d]::main::{closure#0}): cap ), }, } +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.stdout b/src/test/ui/closures/2229_closure_analysis/slice-pat.stdout index 3e352e2c525..43c43015134 100644 --- a/src/test/ui/closures/2229_closure_analysis/slice-pat.stdout +++ b/src/test/ui/closures/2229_closure_analysis/slice-pat.stdout @@ -25,3 +25,32 @@ For closure=DefId(0:5 ~ slice_pat[317d]::main::{closure#0}): capture information ), }, } +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), + ), + ), + }, + }, + ], +} |
