]> git.lizzy.rs Git - rust.git/commitdiff
Update tests with min capture information
authorAman Arora <me@aman-arora.com>
Tue, 13 Oct 2020 18:02:38 +0000 (14:02 -0400)
committerAman Arora <me@aman-arora.com>
Wed, 11 Nov 2020 01:58:55 +0000 (20:58 -0500)
Co-authored-by: Chris Pardy <chrispardy36@gmail.com>
Co-authored-by: Logan Mosier <logmosier@gmail.com>
src/test/ui/closures/2229_closure_analysis/arrays-completely-captured.stdout
src/test/ui/closures/2229_closure_analysis/capture-disjoint-field-struct.stdout
src/test/ui/closures/2229_closure_analysis/capture-disjoint-field-tuple.stdout
src/test/ui/closures/2229_closure_analysis/feature-gate-capture_disjoint_fields.stdout
src/test/ui/closures/2229_closure_analysis/filter-on-struct-member.stdout
src/test/ui/closures/2229_closure_analysis/multilevel-path-1.stdout
src/test/ui/closures/2229_closure_analysis/multilevel-path-2.stdout
src/test/ui/closures/2229_closure_analysis/nested-closure.stdout
src/test/ui/closures/2229_closure_analysis/path-with-array-access.stdout
src/test/ui/closures/2229_closure_analysis/simple-struct-min-capture.stdout
src/test/ui/closures/2229_closure_analysis/slice-pat.stdout

index b4142a4fd8e4638b21a254ef8e91fc310f1949ba..e0cd06f765e077e52e92d16a9a33e036df59b441 100644 (file)
@@ -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),
+                ),
+            },
+        },
+    ],
+}
index ab7bd60e48d1c8573cf0d965111c5eee642841d1..d378b12a235006b02553ab7da1ba0af83583bcb4 100644 (file)
@@ -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),
+                ),
+            },
+        },
+    ],
+}
index 517d7564c72ce9768d061ec4a29d30ad7d7e93a3..9a080c28d4ebf7844691f938a206b9abe2138e50 100644 (file)
@@ -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),
+                ),
+            },
+        },
+    ],
+}
index 40ac31b4ad90bd249fe438cc17ad3abc93789ac8..69722f9d21ec243cf0fbe271f4561abfee109085 100644 (file)
@@ -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),
+                ),
+            },
+        },
+    ],
+}
index 560b2aa3b57b2c322ceb3f10694bd95933f9d83d..44fb88e1520c429d6cb1971f5e00f3958a324ba0 100644 (file)
@@ -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),
+                ),
+            },
+        },
+    ],
+}
index 525366cb964f00851a72dab3d48c65f9dbda08c6..63a3669d0a76dcc35257839d2091c0ed3e7dffb3 100644 (file)
@@ -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),
+                ),
+            },
+        },
+    ],
+}
index f89670c8b7f321c963dcba73849dda7e6c40b22c..576d2c36b6f25b819a1fe5d3da03ba0d172817e3 100644 (file)
@@ -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),
+                ),
+            },
+        },
+    ],
+}
index 84d87a75bda98e07dbe438e5a76778f9c5e46154..446419c75f5eb6f2fe9d7d0962954ff818564170 100644 (file)
@@ -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),
+                ),
+            },
+        },
+    ],
+}
index b843b0494b93cd9d6225e66ea3be60ef3996210a..73f880c155afd905e25bd47fc94b2128099e3c19 100644 (file)
@@ -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),
+                ),
+            },
+        },
+    ],
+}
index 02129f1acb55c60f45cd9543ded42992ee066893..c0421852d93d8580dba9081ff32a1183d20874cc 100644 (file)
@@ -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),
+                ),
+            },
+        },
+    ],
+}
index 3e352e2c52584987f98a69985d54946d0fc754d5..43c43015134ae927c092935e41c3880ccf36008d 100644 (file)
@@ -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),
+                    ),
+                ),
+            },
+        },
+    ],
+}