Skip to content

Commit b16815b

Browse files
arora-amanChrisPardylogmosier
committed
Update tests with min capture information
Co-authored-by: Chris Pardy <chrispardy36@gmail.com> Co-authored-by: Logan Mosier <logmosier@gmail.com>
1 parent 8f0c0d6 commit b16815b

11 files changed

+454
-0
lines changed

src/test/ui/closures/2229_closure_analysis/arrays-completely-captured.stdout

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,30 @@ For closure=DefId(0:4 ~ arrays_completely_captured[317d]::main::{closure#0}): ca
1818
),
1919
},
2020
}
21+
For closure=DefId(0:4 ~ arrays_completely_captured[317d]::main::{closure#0}): min_captures={
22+
HirId {
23+
owner: DefId(0:3 ~ arrays_completely_captured[317d]::main),
24+
local_id: 1,
25+
}: [
26+
CapturedPlace {
27+
place: Place {
28+
base_ty: [i32; 5],
29+
base: Upvar(
30+
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})),
31+
),
32+
projections: [],
33+
},
34+
info: CaptureInfo {
35+
expr_id: Some(
36+
HirId {
37+
owner: DefId(0:3 ~ arrays_completely_captured[317d]::main),
38+
local_id: 12,
39+
},
40+
),
41+
capture_kind: ByRef(
42+
UpvarBorrow(MutBorrow, '_#6r),
43+
),
44+
},
45+
},
46+
],
47+
}

src/test/ui/closures/2229_closure_analysis/capture-disjoint-field-struct.stdout

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,38 @@ For closure=DefId(0:7 ~ capture_disjoint_field_struct[317d]::main::{closure#0}):
2626
),
2727
},
2828
}
29+
For closure=DefId(0:7 ~ capture_disjoint_field_struct[317d]::main::{closure#0}): min_captures={
30+
HirId {
31+
owner: DefId(0:6 ~ capture_disjoint_field_struct[317d]::main),
32+
local_id: 1,
33+
}: [
34+
CapturedPlace {
35+
place: Place {
36+
base_ty: Point,
37+
base: Upvar(
38+
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})),
39+
),
40+
projections: [
41+
Projection {
42+
ty: i32,
43+
kind: Field(
44+
0,
45+
0,
46+
),
47+
},
48+
],
49+
},
50+
info: CaptureInfo {
51+
expr_id: Some(
52+
HirId {
53+
owner: DefId(0:6 ~ capture_disjoint_field_struct[317d]::main),
54+
local_id: 31,
55+
},
56+
),
57+
capture_kind: ByRef(
58+
UpvarBorrow(ImmBorrow, '_#35r),
59+
),
60+
},
61+
},
62+
],
63+
}

src/test/ui/closures/2229_closure_analysis/capture-disjoint-field-tuple.stdout

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,38 @@ For closure=DefId(0:4 ~ capture_disjoint_field_tuple[317d]::main::{closure#0}):
2626
),
2727
},
2828
}
29+
For closure=DefId(0:4 ~ capture_disjoint_field_tuple[317d]::main::{closure#0}): min_captures={
30+
HirId {
31+
owner: DefId(0:3 ~ capture_disjoint_field_tuple[317d]::main),
32+
local_id: 1,
33+
}: [
34+
CapturedPlace {
35+
place: Place {
36+
base_ty: (i32, i32),
37+
base: Upvar(
38+
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})),
39+
),
40+
projections: [
41+
Projection {
42+
ty: i32,
43+
kind: Field(
44+
0,
45+
0,
46+
),
47+
},
48+
],
49+
},
50+
info: CaptureInfo {
51+
expr_id: Some(
52+
HirId {
53+
owner: DefId(0:3 ~ capture_disjoint_field_tuple[317d]::main),
54+
local_id: 28,
55+
},
56+
),
57+
capture_kind: ByRef(
58+
UpvarBorrow(ImmBorrow, '_#35r),
59+
),
60+
},
61+
},
62+
],
63+
}

src/test/ui/closures/2229_closure_analysis/feature-gate-capture_disjoint_fields.stdout

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,30 @@ For closure=DefId(0:4 ~ feature_gate_capture_disjoint_fields[317d]::main::{closu
1818
),
1919
},
2020
}
21+
For closure=DefId(0:4 ~ feature_gate_capture_disjoint_fields[317d]::main::{closure#0}): min_captures={
22+
HirId {
23+
owner: DefId(0:3 ~ feature_gate_capture_disjoint_fields[317d]::main),
24+
local_id: 1,
25+
}: [
26+
CapturedPlace {
27+
place: Place {
28+
base_ty: std::string::String,
29+
base: Upvar(
30+
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})),
31+
),
32+
projections: [],
33+
},
34+
info: CaptureInfo {
35+
expr_id: Some(
36+
HirId {
37+
owner: DefId(0:3 ~ feature_gate_capture_disjoint_fields[317d]::main),
38+
local_id: 52,
39+
},
40+
),
41+
capture_kind: ByRef(
42+
UpvarBorrow(ImmBorrow, '_#50r),
43+
),
44+
},
45+
},
46+
],
47+
}

src/test/ui/closures/2229_closure_analysis/filter-on-struct-member.stdout

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,42 @@ For closure=DefId(0:12 ~ filter_on_struct_member[317d]::{impl#1}::update::{closu
3030
),
3131
},
3232
}
33+
For closure=DefId(0:12 ~ filter_on_struct_member[317d]::{impl#1}::update::{closure#0}): min_captures={
34+
HirId {
35+
owner: DefId(0:11 ~ filter_on_struct_member[317d]::{impl#1}::update),
36+
local_id: 1,
37+
}: [
38+
CapturedPlace {
39+
place: Place {
40+
base_ty: &mut Data,
41+
base: Upvar(
42+
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})),
43+
),
44+
projections: [
45+
Projection {
46+
ty: Data,
47+
kind: Deref,
48+
},
49+
Projection {
50+
ty: Filter,
51+
kind: Field(
52+
0,
53+
0,
54+
),
55+
},
56+
],
57+
},
58+
info: CaptureInfo {
59+
expr_id: Some(
60+
HirId {
61+
owner: DefId(0:11 ~ filter_on_struct_member[317d]::{impl#1}::update),
62+
local_id: 13,
63+
},
64+
),
65+
capture_kind: ByRef(
66+
UpvarBorrow(ImmBorrow, '_#7r),
67+
),
68+
},
69+
},
70+
],
71+
}

src/test/ui/closures/2229_closure_analysis/multilevel-path-1.stdout

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,38 @@ For closure=DefId(0:9 ~ multilevel_path_1[317d]::main::{closure#0}): capture inf
2626
),
2727
},
2828
}
29+
For closure=DefId(0:9 ~ multilevel_path_1[317d]::main::{closure#0}): min_captures={
30+
HirId {
31+
owner: DefId(0:8 ~ multilevel_path_1[317d]::main),
32+
local_id: 1,
33+
}: [
34+
CapturedPlace {
35+
place: Place {
36+
base_ty: Wrapper,
37+
base: Upvar(
38+
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})),
39+
),
40+
projections: [
41+
Projection {
42+
ty: Point,
43+
kind: Field(
44+
0,
45+
0,
46+
),
47+
},
48+
],
49+
},
50+
info: CaptureInfo {
51+
expr_id: Some(
52+
HirId {
53+
owner: DefId(0:8 ~ multilevel_path_1[317d]::main),
54+
local_id: 20,
55+
},
56+
),
57+
capture_kind: ByRef(
58+
UpvarBorrow(ImmBorrow, '_#37r),
59+
),
60+
},
61+
},
62+
],
63+
}

src/test/ui/closures/2229_closure_analysis/multilevel-path-2.stdout

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,45 @@ For closure=DefId(0:9 ~ multilevel_path_2[317d]::main::{closure#0}): capture inf
3333
),
3434
},
3535
}
36+
For closure=DefId(0:9 ~ multilevel_path_2[317d]::main::{closure#0}): min_captures={
37+
HirId {
38+
owner: DefId(0:8 ~ multilevel_path_2[317d]::main),
39+
local_id: 1,
40+
}: [
41+
CapturedPlace {
42+
place: Place {
43+
base_ty: Wrapper,
44+
base: Upvar(
45+
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})),
46+
),
47+
projections: [
48+
Projection {
49+
ty: Point,
50+
kind: Field(
51+
0,
52+
0,
53+
),
54+
},
55+
Projection {
56+
ty: i32,
57+
kind: Field(
58+
0,
59+
0,
60+
),
61+
},
62+
],
63+
},
64+
info: CaptureInfo {
65+
expr_id: Some(
66+
HirId {
67+
owner: DefId(0:8 ~ multilevel_path_2[317d]::main),
68+
local_id: 35,
69+
},
70+
),
71+
capture_kind: ByRef(
72+
UpvarBorrow(ImmBorrow, '_#35r),
73+
),
74+
},
75+
},
76+
],
77+
}

0 commit comments

Comments
 (0)