]> git.lizzy.rs Git - rust.git/commitdiff
address review
authorb-naber <bn263@gmx.de>
Fri, 27 Jan 2023 21:13:55 +0000 (22:13 +0100)
committerb-naber <bn263@gmx.de>
Fri, 27 Jan 2023 21:13:55 +0000 (22:13 +0100)
12 files changed:
compiler/rustc_middle/src/thir/print.rs
compiler/rustc_middle/src/ty/adt.rs
tests/ui/thir-print/thir-flat.rs [new file with mode: 0644]
tests/ui/thir-print/thir-flat.stdout [new file with mode: 0644]
tests/ui/thir-print/thir-tree-match.rs [new file with mode: 0644]
tests/ui/thir-print/thir-tree-match.stdout [new file with mode: 0644]
tests/ui/thir-print/thir-tree.rs [new file with mode: 0644]
tests/ui/thir-print/thir-tree.stdout [new file with mode: 0644]
tests/ui/thir-tree-match.rs [deleted file]
tests/ui/thir-tree-match.stdout [deleted file]
tests/ui/thir-tree.rs [deleted file]
tests/ui/thir-tree.stdout [deleted file]

index 28ef768ade6f73ead4d84ee07929657848fa2f23..60b903e99066b6d4ef8b5127f2dec7d768c05583 100644 (file)
@@ -522,7 +522,7 @@ fn print_expr_kind(&mut self, expr_kind: &ExprKind<'tcx>, depth_lvl: usize) {
 
     fn print_adt_expr(&mut self, adt_expr: &AdtExpr<'tcx>, depth_lvl: usize) {
         print_indented!(self, "adt_def:", depth_lvl);
-        self.print_adt_def(&*adt_expr.adt_def.0, depth_lvl + 1);
+        self.print_adt_def(adt_expr.adt_def, depth_lvl + 1);
         print_indented!(
             self,
             format!("variant_index: {:?}", adt_expr.variant_index),
@@ -544,12 +544,12 @@ fn print_adt_expr(&mut self, adt_expr: &AdtExpr<'tcx>, depth_lvl: usize) {
         }
     }
 
-    fn print_adt_def(&mut self, adt_def: &ty::AdtDefData, depth_lvl: usize) {
+    fn print_adt_def(&mut self, adt_def: ty::AdtDef<'tcx>, depth_lvl: usize) {
         print_indented!(self, "AdtDef {", depth_lvl);
-        print_indented!(self, format!("did: {:?}", adt_def.did), depth_lvl + 1);
-        print_indented!(self, format!("variants: {:?}", adt_def.variants), depth_lvl + 1);
-        print_indented!(self, format!("flags: {:?}", adt_def.flags), depth_lvl + 1);
-        print_indented!(self, format!("repr: {:?}", adt_def.repr), depth_lvl + 1);
+        print_indented!(self, format!("did: {:?}", adt_def.did()), depth_lvl + 1);
+        print_indented!(self, format!("variants: {:?}", adt_def.variants()), depth_lvl + 1);
+        print_indented!(self, format!("flags: {:?}", adt_def.flags()), depth_lvl + 1);
+        print_indented!(self, format!("repr: {:?}", adt_def.repr()), depth_lvl + 1);
     }
 
     fn print_fru_info(&mut self, fru_info: &FruInfo<'tcx>, depth_lvl: usize) {
@@ -633,7 +633,7 @@ fn print_pat_kind(&mut self, pat_kind: &PatKind<'tcx>, depth_lvl: usize) {
             PatKind::Variant { adt_def, substs, variant_index, subpatterns } => {
                 print_indented!(self, "Variant {", depth_lvl + 1);
                 print_indented!(self, "adt_def: ", depth_lvl + 2);
-                self.print_adt_def(&*adt_def.0, depth_lvl + 3);
+                self.print_adt_def(*adt_def, depth_lvl + 3);
                 print_indented!(self, format!("substs: {:?}", substs), depth_lvl + 2);
                 print_indented!(self, format!("variant_index: {:?}", variant_index), depth_lvl + 2);
 
index 3d6da7fe792e7707c9e765f7388e0d552e04dce7..d3d667f68407fde123e0407e22ba4caa1d0a1095 100644 (file)
@@ -90,11 +90,11 @@ pub struct AdtDefData {
     /// The `DefId` of the struct, enum or union item.
     pub did: DefId,
     /// Variants of the ADT. If this is a struct or union, then there will be a single variant.
-    pub(crate) variants: IndexVec<VariantIdx, VariantDef>,
+    variants: IndexVec<VariantIdx, VariantDef>,
     /// Flags of the ADT (e.g., is this a struct? is this non-exhaustive?).
-    pub(crate) flags: AdtFlags,
+    flags: AdtFlags,
     /// Repr options provided by the user.
-    pub(crate) repr: ReprOptions,
+    repr: ReprOptions,
 }
 
 impl PartialOrd for AdtDefData {
diff --git a/tests/ui/thir-print/thir-flat.rs b/tests/ui/thir-print/thir-flat.rs
new file mode 100644 (file)
index 0000000..8fa95ce
--- /dev/null
@@ -0,0 +1,4 @@
+// compile-flags: -Z unpretty=thir-flat
+// check-pass
+
+pub fn main() {}
diff --git a/tests/ui/thir-print/thir-flat.stdout b/tests/ui/thir-print/thir-flat.stdout
new file mode 100644 (file)
index 0000000..c399fa6
--- /dev/null
@@ -0,0 +1,56 @@
+DefId(0:3 ~ thir_flat[45a6]::main):
+Thir {
+    arms: [],
+    blocks: [
+        Block {
+            targeted_by_break: false,
+            region_scope: Node(1),
+            opt_destruction_scope: None,
+            span: $DIR/thir-flat.rs:4:15: 4:17 (#0),
+            stmts: [],
+            expr: None,
+            safety_mode: Safe,
+        },
+    ],
+    exprs: [
+        Expr {
+            ty: (),
+            temp_lifetime: Some(
+                Node(2),
+            ),
+            span: $DIR/thir-flat.rs:4:15: 4:17 (#0),
+            kind: Block {
+                block: b0,
+            },
+        },
+        Expr {
+            ty: (),
+            temp_lifetime: Some(
+                Node(2),
+            ),
+            span: $DIR/thir-flat.rs:4:15: 4:17 (#0),
+            kind: Scope {
+                region_scope: Node(2),
+                lint_level: Explicit(
+                    HirId(DefId(0:3 ~ thir_flat[45a6]::main).2),
+                ),
+                value: e0,
+            },
+        },
+        Expr {
+            ty: (),
+            temp_lifetime: Some(
+                Node(2),
+            ),
+            span: $DIR/thir-flat.rs:4:15: 4:17 (#0),
+            kind: Scope {
+                region_scope: Destruction(2),
+                lint_level: Inherited,
+                value: e1,
+            },
+        },
+    ],
+    stmts: [],
+    params: [],
+}
+
diff --git a/tests/ui/thir-print/thir-tree-match.rs b/tests/ui/thir-print/thir-tree-match.rs
new file mode 100644 (file)
index 0000000..a5511ec
--- /dev/null
@@ -0,0 +1,23 @@
+// check-pass
+// compile-flags: -Zunpretty=thir-tree
+
+enum Bar {
+    First,
+    Second,
+    Third,
+}
+
+enum Foo {
+    FooOne(Bar),
+    FooTwo,
+}
+
+fn has_match(foo: Foo) -> bool {
+    match foo {
+        Foo::FooOne(Bar::First) => true,
+        Foo::FooOne(_) => false,
+        Foo::FooTwo => true,
+    }
+}
+
+fn main() {}
diff --git a/tests/ui/thir-print/thir-tree-match.stdout b/tests/ui/thir-print/thir-tree-match.stdout
new file mode 100644 (file)
index 0000000..d6174ec
--- /dev/null
@@ -0,0 +1,342 @@
+DefId(0:16 ~ thir_tree_match[3c9a]::has_match):
+params: [
+    Param {
+        ty: Foo
+        ty_span: Some($DIR/thir-tree-match.rs:15:19: 15:22 (#0))
+        self_kind: None
+        hir_id: Some(HirId(DefId(0:16 ~ thir_tree_match[3c9a]::has_match).1))
+        param: Some( 
+            Pat: {
+                ty: Foo
+                span: $DIR/thir-tree-match.rs:15:14: 15:17 (#0)
+                kind: PatKind {
+                    Binding {
+                        mutability: Not
+                        name: "foo"
+                        mode: ByValue
+                        var: LocalVarId(HirId(DefId(0:16 ~ thir_tree_match[3c9a]::has_match).2))
+                        ty: Foo
+                        is_primary: true
+                        subpattern: None
+                    }
+                }
+            }
+        )
+    }
+]
+body:
+    Expr {
+        ty: bool
+        temp_lifetime: Some(Node(26))
+        span: $DIR/thir-tree-match.rs:15:32: 21:2 (#0)
+        kind: 
+            Scope {
+                region_scope: Destruction(26)
+                lint_level: Inherited
+                value:
+                    Expr {
+                        ty: bool
+                        temp_lifetime: Some(Node(26))
+                        span: $DIR/thir-tree-match.rs:15:32: 21:2 (#0)
+                        kind: 
+                            Scope {
+                                region_scope: Node(26)
+                                lint_level: Explicit(HirId(DefId(0:16 ~ thir_tree_match[3c9a]::has_match).26))
+                                value:
+                                    Expr {
+                                        ty: bool
+                                        temp_lifetime: Some(Node(26))
+                                        span: $DIR/thir-tree-match.rs:15:32: 21:2 (#0)
+                                        kind: 
+                                            Block {
+                                                targeted_by_break: false
+                                                opt_destruction_scope: None
+                                                span: $DIR/thir-tree-match.rs:15:32: 21:2 (#0)
+                                                region_scope: Node(25)
+                                                safety_mode: Safe
+                                                stmts: []
+                                                expr:
+                                                    Expr {
+                                                        ty: bool
+                                                        temp_lifetime: Some(Node(26))
+                                                        span: $DIR/thir-tree-match.rs:16:5: 20:6 (#0)
+                                                        kind: 
+                                                            Scope {
+                                                                region_scope: Node(3)
+                                                                lint_level: Explicit(HirId(DefId(0:16 ~ thir_tree_match[3c9a]::has_match).3))
+                                                                value:
+                                                                    Expr {
+                                                                        ty: bool
+                                                                        temp_lifetime: Some(Node(26))
+                                                                        span: $DIR/thir-tree-match.rs:16:5: 20:6 (#0)
+                                                                        kind: 
+                                                                            Match {
+                                                                                scrutinee:
+                                                                                    Expr {
+                                                                                        ty: Foo
+                                                                                        temp_lifetime: Some(Node(26))
+                                                                                        span: $DIR/thir-tree-match.rs:16:11: 16:14 (#0)
+                                                                                        kind: 
+                                                                                            Scope {
+                                                                                                region_scope: Node(4)
+                                                                                                lint_level: Explicit(HirId(DefId(0:16 ~ thir_tree_match[3c9a]::has_match).4))
+                                                                                                value:
+                                                                                                    Expr {
+                                                                                                        ty: Foo
+                                                                                                        temp_lifetime: Some(Node(26))
+                                                                                                        span: $DIR/thir-tree-match.rs:16:11: 16:14 (#0)
+                                                                                                        kind: 
+                                                                                                            VarRef {
+                                                                                                                id: LocalVarId(HirId(DefId(0:16 ~ thir_tree_match[3c9a]::has_match).2))
+                                                                                                            }
+                                                                                                    }
+                                                                                            }
+                                                                                    }
+                                                                                arms: [
+                                                                                    Arm {
+                                                                                        pattern: 
+                                                                                            Pat: {
+                                                                                                ty: Foo
+                                                                                                span: $DIR/thir-tree-match.rs:17:9: 17:32 (#0)
+                                                                                                kind: PatKind {
+                                                                                                    Variant {
+                                                                                                        adt_def: 
+                                                                                                            AdtDef {
+                                                                                                                did: DefId(0:10 ~ thir_tree_match[3c9a]::Foo)
+                                                                                                                variants: [VariantDef { def_id: DefId(0:11 ~ thir_tree_match[3c9a]::Foo::FooOne), ctor: Some((Fn, DefId(0:12 ~ thir_tree_match[3c9a]::Foo::FooOne::{constructor#0}))), name: "FooOne", discr: Relative(0), fields: [FieldDef { did: DefId(0:13 ~ thir_tree_match[3c9a]::Foo::FooOne::0), name: "0", vis: Restricted(DefId(0:0 ~ thir_tree_match[3c9a])) }], flags: NO_VARIANT_FLAGS }, VariantDef { def_id: DefId(0:14 ~ thir_tree_match[3c9a]::Foo::FooTwo), ctor: Some((Const, DefId(0:15 ~ thir_tree_match[3c9a]::Foo::FooTwo::{constructor#0}))), name: "FooTwo", discr: Relative(1), fields: [], flags: NO_VARIANT_FLAGS }]
+                                                                                                                flags: IS_ENUM
+                                                                                                                repr: ReprOptions { int: None, align: None, pack: None, flags: (empty), field_shuffle_seed: 11573694388057581 }
+                                                                                                        substs: []
+                                                                                                        variant_index: 0
+                                                                                                        subpatterns: [
+                                                                                                            Pat: {
+                                                                                                                ty: Bar
+                                                                                                                span: $DIR/thir-tree-match.rs:17:21: 17:31 (#0)
+                                                                                                                kind: PatKind {
+                                                                                                                    Variant {
+                                                                                                                        adt_def: 
+                                                                                                                            AdtDef {
+                                                                                                                                did: DefId(0:3 ~ thir_tree_match[3c9a]::Bar)
+                                                                                                                                variants: [VariantDef { def_id: DefId(0:4 ~ thir_tree_match[3c9a]::Bar::First), ctor: Some((Const, DefId(0:5 ~ thir_tree_match[3c9a]::Bar::First::{constructor#0}))), name: "First", discr: Relative(0), fields: [], flags: NO_VARIANT_FLAGS }, VariantDef { def_id: DefId(0:6 ~ thir_tree_match[3c9a]::Bar::Second), ctor: Some((Const, DefId(0:7 ~ thir_tree_match[3c9a]::Bar::Second::{constructor#0}))), name: "Second", discr: Relative(1), fields: [], flags: NO_VARIANT_FLAGS }, VariantDef { def_id: DefId(0:8 ~ thir_tree_match[3c9a]::Bar::Third), ctor: Some((Const, DefId(0:9 ~ thir_tree_match[3c9a]::Bar::Third::{constructor#0}))), name: "Third", discr: Relative(2), fields: [], flags: NO_VARIANT_FLAGS }]
+                                                                                                                                flags: IS_ENUM
+                                                                                                                                repr: ReprOptions { int: None, align: None, pack: None, flags: (empty), field_shuffle_seed: 3125160937860410723 }
+                                                                                                                        substs: []
+                                                                                                                        variant_index: 0
+                                                                                                                        subpatterns: []
+                                                                                                                    }
+                                                                                                                }
+                                                                                                            }
+                                                                                                        ]
+                                                                                                    }
+                                                                                                }
+                                                                                            }
+                                                                                        guard: None
+                                                                                        body: 
+                                                                                            Expr {
+                                                                                                ty: bool
+                                                                                                temp_lifetime: Some(Node(13))
+                                                                                                span: $DIR/thir-tree-match.rs:17:36: 17:40 (#0)
+                                                                                                kind: 
+                                                                                                    Scope {
+                                                                                                        region_scope: Destruction(13)
+                                                                                                        lint_level: Inherited
+                                                                                                        value:
+                                                                                                            Expr {
+                                                                                                                ty: bool
+                                                                                                                temp_lifetime: Some(Node(13))
+                                                                                                                span: $DIR/thir-tree-match.rs:17:36: 17:40 (#0)
+                                                                                                                kind: 
+                                                                                                                    Scope {
+                                                                                                                        region_scope: Node(13)
+                                                                                                                        lint_level: Explicit(HirId(DefId(0:16 ~ thir_tree_match[3c9a]::has_match).13))
+                                                                                                                        value:
+                                                                                                                            Expr {
+                                                                                                                                ty: bool
+                                                                                                                                temp_lifetime: Some(Node(13))
+                                                                                                                                span: $DIR/thir-tree-match.rs:17:36: 17:40 (#0)
+                                                                                                                                kind: 
+                                                                                                                                    Literal( lit: Spanned { node: Bool(true), span: $DIR/thir-tree-match.rs:17:36: 17:40 (#0) }, neg: false)
+
+                                                                                                                            }
+                                                                                                                    }
+                                                                                                            }
+                                                                                                    }
+                                                                                            }
+                                                                                        lint_level: Explicit(HirId(DefId(0:16 ~ thir_tree_match[3c9a]::has_match).12))
+                                                                                        scope: Node(12)
+                                                                                        span: $DIR/thir-tree-match.rs:17:9: 17:40 (#0)
+                                                                                    }
+                                                                                    Arm {
+                                                                                        pattern: 
+                                                                                            Pat: {
+                                                                                                ty: Foo
+                                                                                                span: $DIR/thir-tree-match.rs:18:9: 18:23 (#0)
+                                                                                                kind: PatKind {
+                                                                                                    Variant {
+                                                                                                        adt_def: 
+                                                                                                            AdtDef {
+                                                                                                                did: DefId(0:10 ~ thir_tree_match[3c9a]::Foo)
+                                                                                                                variants: [VariantDef { def_id: DefId(0:11 ~ thir_tree_match[3c9a]::Foo::FooOne), ctor: Some((Fn, DefId(0:12 ~ thir_tree_match[3c9a]::Foo::FooOne::{constructor#0}))), name: "FooOne", discr: Relative(0), fields: [FieldDef { did: DefId(0:13 ~ thir_tree_match[3c9a]::Foo::FooOne::0), name: "0", vis: Restricted(DefId(0:0 ~ thir_tree_match[3c9a])) }], flags: NO_VARIANT_FLAGS }, VariantDef { def_id: DefId(0:14 ~ thir_tree_match[3c9a]::Foo::FooTwo), ctor: Some((Const, DefId(0:15 ~ thir_tree_match[3c9a]::Foo::FooTwo::{constructor#0}))), name: "FooTwo", discr: Relative(1), fields: [], flags: NO_VARIANT_FLAGS }]
+                                                                                                                flags: IS_ENUM
+                                                                                                                repr: ReprOptions { int: None, align: None, pack: None, flags: (empty), field_shuffle_seed: 11573694388057581 }
+                                                                                                        substs: []
+                                                                                                        variant_index: 0
+                                                                                                        subpatterns: [
+                                                                                                            Pat: {
+                                                                                                                ty: Bar
+                                                                                                                span: $DIR/thir-tree-match.rs:18:21: 18:22 (#0)
+                                                                                                                kind: PatKind {
+                                                                                                                    Wild
+                                                                                                                }
+                                                                                                            }
+                                                                                                        ]
+                                                                                                    }
+                                                                                                }
+                                                                                            }
+                                                                                        guard: None
+                                                                                        body: 
+                                                                                            Expr {
+                                                                                                ty: bool
+                                                                                                temp_lifetime: Some(Node(19))
+                                                                                                span: $DIR/thir-tree-match.rs:18:27: 18:32 (#0)
+                                                                                                kind: 
+                                                                                                    Scope {
+                                                                                                        region_scope: Destruction(19)
+                                                                                                        lint_level: Inherited
+                                                                                                        value:
+                                                                                                            Expr {
+                                                                                                                ty: bool
+                                                                                                                temp_lifetime: Some(Node(19))
+                                                                                                                span: $DIR/thir-tree-match.rs:18:27: 18:32 (#0)
+                                                                                                                kind: 
+                                                                                                                    Scope {
+                                                                                                                        region_scope: Node(19)
+                                                                                                                        lint_level: Explicit(HirId(DefId(0:16 ~ thir_tree_match[3c9a]::has_match).19))
+                                                                                                                        value:
+                                                                                                                            Expr {
+                                                                                                                                ty: bool
+                                                                                                                                temp_lifetime: Some(Node(19))
+                                                                                                                                span: $DIR/thir-tree-match.rs:18:27: 18:32 (#0)
+                                                                                                                                kind: 
+                                                                                                                                    Literal( lit: Spanned { node: Bool(false), span: $DIR/thir-tree-match.rs:18:27: 18:32 (#0) }, neg: false)
+
+                                                                                                                            }
+                                                                                                                    }
+                                                                                                            }
+                                                                                                    }
+                                                                                            }
+                                                                                        lint_level: Explicit(HirId(DefId(0:16 ~ thir_tree_match[3c9a]::has_match).18))
+                                                                                        scope: Node(18)
+                                                                                        span: $DIR/thir-tree-match.rs:18:9: 18:32 (#0)
+                                                                                    }
+                                                                                    Arm {
+                                                                                        pattern: 
+                                                                                            Pat: {
+                                                                                                ty: Foo
+                                                                                                span: $DIR/thir-tree-match.rs:19:9: 19:20 (#0)
+                                                                                                kind: PatKind {
+                                                                                                    Variant {
+                                                                                                        adt_def: 
+                                                                                                            AdtDef {
+                                                                                                                did: DefId(0:10 ~ thir_tree_match[3c9a]::Foo)
+                                                                                                                variants: [VariantDef { def_id: DefId(0:11 ~ thir_tree_match[3c9a]::Foo::FooOne), ctor: Some((Fn, DefId(0:12 ~ thir_tree_match[3c9a]::Foo::FooOne::{constructor#0}))), name: "FooOne", discr: Relative(0), fields: [FieldDef { did: DefId(0:13 ~ thir_tree_match[3c9a]::Foo::FooOne::0), name: "0", vis: Restricted(DefId(0:0 ~ thir_tree_match[3c9a])) }], flags: NO_VARIANT_FLAGS }, VariantDef { def_id: DefId(0:14 ~ thir_tree_match[3c9a]::Foo::FooTwo), ctor: Some((Const, DefId(0:15 ~ thir_tree_match[3c9a]::Foo::FooTwo::{constructor#0}))), name: "FooTwo", discr: Relative(1), fields: [], flags: NO_VARIANT_FLAGS }]
+                                                                                                                flags: IS_ENUM
+                                                                                                                repr: ReprOptions { int: None, align: None, pack: None, flags: (empty), field_shuffle_seed: 11573694388057581 }
+                                                                                                        substs: []
+                                                                                                        variant_index: 1
+                                                                                                        subpatterns: []
+                                                                                                    }
+                                                                                                }
+                                                                                            }
+                                                                                        guard: None
+                                                                                        body: 
+                                                                                            Expr {
+                                                                                                ty: bool
+                                                                                                temp_lifetime: Some(Node(24))
+                                                                                                span: $DIR/thir-tree-match.rs:19:24: 19:28 (#0)
+                                                                                                kind: 
+                                                                                                    Scope {
+                                                                                                        region_scope: Destruction(24)
+                                                                                                        lint_level: Inherited
+                                                                                                        value:
+                                                                                                            Expr {
+                                                                                                                ty: bool
+                                                                                                                temp_lifetime: Some(Node(24))
+                                                                                                                span: $DIR/thir-tree-match.rs:19:24: 19:28 (#0)
+                                                                                                                kind: 
+                                                                                                                    Scope {
+                                                                                                                        region_scope: Node(24)
+                                                                                                                        lint_level: Explicit(HirId(DefId(0:16 ~ thir_tree_match[3c9a]::has_match).24))
+                                                                                                                        value:
+                                                                                                                            Expr {
+                                                                                                                                ty: bool
+                                                                                                                                temp_lifetime: Some(Node(24))
+                                                                                                                                span: $DIR/thir-tree-match.rs:19:24: 19:28 (#0)
+                                                                                                                                kind: 
+                                                                                                                                    Literal( lit: Spanned { node: Bool(true), span: $DIR/thir-tree-match.rs:19:24: 19:28 (#0) }, neg: false)
+
+                                                                                                                            }
+                                                                                                                    }
+                                                                                                            }
+                                                                                                    }
+                                                                                            }
+                                                                                        lint_level: Explicit(HirId(DefId(0:16 ~ thir_tree_match[3c9a]::has_match).23))
+                                                                                        scope: Node(23)
+                                                                                        span: $DIR/thir-tree-match.rs:19:9: 19:28 (#0)
+                                                                                    }
+                                                                                ]
+                                                                            }
+                                                                    }
+                                                            }
+                                                    }
+                                            }
+                                    }
+                            }
+                    }
+            }
+    }
+
+
+DefId(0:17 ~ thir_tree_match[3c9a]::main):
+params: [
+]
+body:
+    Expr {
+        ty: ()
+        temp_lifetime: Some(Node(2))
+        span: $DIR/thir-tree-match.rs:23:11: 23:13 (#0)
+        kind: 
+            Scope {
+                region_scope: Destruction(2)
+                lint_level: Inherited
+                value:
+                    Expr {
+                        ty: ()
+                        temp_lifetime: Some(Node(2))
+                        span: $DIR/thir-tree-match.rs:23:11: 23:13 (#0)
+                        kind: 
+                            Scope {
+                                region_scope: Node(2)
+                                lint_level: Explicit(HirId(DefId(0:17 ~ thir_tree_match[3c9a]::main).2))
+                                value:
+                                    Expr {
+                                        ty: ()
+                                        temp_lifetime: Some(Node(2))
+                                        span: $DIR/thir-tree-match.rs:23:11: 23:13 (#0)
+                                        kind: 
+                                            Block {
+                                                targeted_by_break: false
+                                                opt_destruction_scope: None
+                                                span: $DIR/thir-tree-match.rs:23:11: 23:13 (#0)
+                                                region_scope: Node(1)
+                                                safety_mode: Safe
+                                                stmts: []
+                                                expr: []
+                                            }
+                                    }
+                            }
+                    }
+            }
+    }
+
+
diff --git a/tests/ui/thir-print/thir-tree.rs b/tests/ui/thir-print/thir-tree.rs
new file mode 100644 (file)
index 0000000..32df790
--- /dev/null
@@ -0,0 +1,4 @@
+// compile-flags: -Z unpretty=thir-tree
+// check-pass
+
+pub fn main() {}
diff --git a/tests/ui/thir-print/thir-tree.stdout b/tests/ui/thir-print/thir-tree.stdout
new file mode 100644 (file)
index 0000000..0a35d9f
--- /dev/null
@@ -0,0 +1,43 @@
+DefId(0:3 ~ thir_tree[8f1d]::main):
+params: [
+]
+body:
+    Expr {
+        ty: ()
+        temp_lifetime: Some(Node(2))
+        span: $DIR/thir-tree.rs:4:15: 4:17 (#0)
+        kind: 
+            Scope {
+                region_scope: Destruction(2)
+                lint_level: Inherited
+                value:
+                    Expr {
+                        ty: ()
+                        temp_lifetime: Some(Node(2))
+                        span: $DIR/thir-tree.rs:4:15: 4:17 (#0)
+                        kind: 
+                            Scope {
+                                region_scope: Node(2)
+                                lint_level: Explicit(HirId(DefId(0:3 ~ thir_tree[8f1d]::main).2))
+                                value:
+                                    Expr {
+                                        ty: ()
+                                        temp_lifetime: Some(Node(2))
+                                        span: $DIR/thir-tree.rs:4:15: 4:17 (#0)
+                                        kind: 
+                                            Block {
+                                                targeted_by_break: false
+                                                opt_destruction_scope: None
+                                                span: $DIR/thir-tree.rs:4:15: 4:17 (#0)
+                                                region_scope: Node(1)
+                                                safety_mode: Safe
+                                                stmts: []
+                                                expr: []
+                                            }
+                                    }
+                            }
+                    }
+            }
+    }
+
+
diff --git a/tests/ui/thir-tree-match.rs b/tests/ui/thir-tree-match.rs
deleted file mode 100644 (file)
index a5511ec..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-// check-pass
-// compile-flags: -Zunpretty=thir-tree
-
-enum Bar {
-    First,
-    Second,
-    Third,
-}
-
-enum Foo {
-    FooOne(Bar),
-    FooTwo,
-}
-
-fn has_match(foo: Foo) -> bool {
-    match foo {
-        Foo::FooOne(Bar::First) => true,
-        Foo::FooOne(_) => false,
-        Foo::FooTwo => true,
-    }
-}
-
-fn main() {}
diff --git a/tests/ui/thir-tree-match.stdout b/tests/ui/thir-tree-match.stdout
deleted file mode 100644 (file)
index d6174ec..0000000
+++ /dev/null
@@ -1,342 +0,0 @@
-DefId(0:16 ~ thir_tree_match[3c9a]::has_match):
-params: [
-    Param {
-        ty: Foo
-        ty_span: Some($DIR/thir-tree-match.rs:15:19: 15:22 (#0))
-        self_kind: None
-        hir_id: Some(HirId(DefId(0:16 ~ thir_tree_match[3c9a]::has_match).1))
-        param: Some( 
-            Pat: {
-                ty: Foo
-                span: $DIR/thir-tree-match.rs:15:14: 15:17 (#0)
-                kind: PatKind {
-                    Binding {
-                        mutability: Not
-                        name: "foo"
-                        mode: ByValue
-                        var: LocalVarId(HirId(DefId(0:16 ~ thir_tree_match[3c9a]::has_match).2))
-                        ty: Foo
-                        is_primary: true
-                        subpattern: None
-                    }
-                }
-            }
-        )
-    }
-]
-body:
-    Expr {
-        ty: bool
-        temp_lifetime: Some(Node(26))
-        span: $DIR/thir-tree-match.rs:15:32: 21:2 (#0)
-        kind: 
-            Scope {
-                region_scope: Destruction(26)
-                lint_level: Inherited
-                value:
-                    Expr {
-                        ty: bool
-                        temp_lifetime: Some(Node(26))
-                        span: $DIR/thir-tree-match.rs:15:32: 21:2 (#0)
-                        kind: 
-                            Scope {
-                                region_scope: Node(26)
-                                lint_level: Explicit(HirId(DefId(0:16 ~ thir_tree_match[3c9a]::has_match).26))
-                                value:
-                                    Expr {
-                                        ty: bool
-                                        temp_lifetime: Some(Node(26))
-                                        span: $DIR/thir-tree-match.rs:15:32: 21:2 (#0)
-                                        kind: 
-                                            Block {
-                                                targeted_by_break: false
-                                                opt_destruction_scope: None
-                                                span: $DIR/thir-tree-match.rs:15:32: 21:2 (#0)
-                                                region_scope: Node(25)
-                                                safety_mode: Safe
-                                                stmts: []
-                                                expr:
-                                                    Expr {
-                                                        ty: bool
-                                                        temp_lifetime: Some(Node(26))
-                                                        span: $DIR/thir-tree-match.rs:16:5: 20:6 (#0)
-                                                        kind: 
-                                                            Scope {
-                                                                region_scope: Node(3)
-                                                                lint_level: Explicit(HirId(DefId(0:16 ~ thir_tree_match[3c9a]::has_match).3))
-                                                                value:
-                                                                    Expr {
-                                                                        ty: bool
-                                                                        temp_lifetime: Some(Node(26))
-                                                                        span: $DIR/thir-tree-match.rs:16:5: 20:6 (#0)
-                                                                        kind: 
-                                                                            Match {
-                                                                                scrutinee:
-                                                                                    Expr {
-                                                                                        ty: Foo
-                                                                                        temp_lifetime: Some(Node(26))
-                                                                                        span: $DIR/thir-tree-match.rs:16:11: 16:14 (#0)
-                                                                                        kind: 
-                                                                                            Scope {
-                                                                                                region_scope: Node(4)
-                                                                                                lint_level: Explicit(HirId(DefId(0:16 ~ thir_tree_match[3c9a]::has_match).4))
-                                                                                                value:
-                                                                                                    Expr {
-                                                                                                        ty: Foo
-                                                                                                        temp_lifetime: Some(Node(26))
-                                                                                                        span: $DIR/thir-tree-match.rs:16:11: 16:14 (#0)
-                                                                                                        kind: 
-                                                                                                            VarRef {
-                                                                                                                id: LocalVarId(HirId(DefId(0:16 ~ thir_tree_match[3c9a]::has_match).2))
-                                                                                                            }
-                                                                                                    }
-                                                                                            }
-                                                                                    }
-                                                                                arms: [
-                                                                                    Arm {
-                                                                                        pattern: 
-                                                                                            Pat: {
-                                                                                                ty: Foo
-                                                                                                span: $DIR/thir-tree-match.rs:17:9: 17:32 (#0)
-                                                                                                kind: PatKind {
-                                                                                                    Variant {
-                                                                                                        adt_def: 
-                                                                                                            AdtDef {
-                                                                                                                did: DefId(0:10 ~ thir_tree_match[3c9a]::Foo)
-                                                                                                                variants: [VariantDef { def_id: DefId(0:11 ~ thir_tree_match[3c9a]::Foo::FooOne), ctor: Some((Fn, DefId(0:12 ~ thir_tree_match[3c9a]::Foo::FooOne::{constructor#0}))), name: "FooOne", discr: Relative(0), fields: [FieldDef { did: DefId(0:13 ~ thir_tree_match[3c9a]::Foo::FooOne::0), name: "0", vis: Restricted(DefId(0:0 ~ thir_tree_match[3c9a])) }], flags: NO_VARIANT_FLAGS }, VariantDef { def_id: DefId(0:14 ~ thir_tree_match[3c9a]::Foo::FooTwo), ctor: Some((Const, DefId(0:15 ~ thir_tree_match[3c9a]::Foo::FooTwo::{constructor#0}))), name: "FooTwo", discr: Relative(1), fields: [], flags: NO_VARIANT_FLAGS }]
-                                                                                                                flags: IS_ENUM
-                                                                                                                repr: ReprOptions { int: None, align: None, pack: None, flags: (empty), field_shuffle_seed: 11573694388057581 }
-                                                                                                        substs: []
-                                                                                                        variant_index: 0
-                                                                                                        subpatterns: [
-                                                                                                            Pat: {
-                                                                                                                ty: Bar
-                                                                                                                span: $DIR/thir-tree-match.rs:17:21: 17:31 (#0)
-                                                                                                                kind: PatKind {
-                                                                                                                    Variant {
-                                                                                                                        adt_def: 
-                                                                                                                            AdtDef {
-                                                                                                                                did: DefId(0:3 ~ thir_tree_match[3c9a]::Bar)
-                                                                                                                                variants: [VariantDef { def_id: DefId(0:4 ~ thir_tree_match[3c9a]::Bar::First), ctor: Some((Const, DefId(0:5 ~ thir_tree_match[3c9a]::Bar::First::{constructor#0}))), name: "First", discr: Relative(0), fields: [], flags: NO_VARIANT_FLAGS }, VariantDef { def_id: DefId(0:6 ~ thir_tree_match[3c9a]::Bar::Second), ctor: Some((Const, DefId(0:7 ~ thir_tree_match[3c9a]::Bar::Second::{constructor#0}))), name: "Second", discr: Relative(1), fields: [], flags: NO_VARIANT_FLAGS }, VariantDef { def_id: DefId(0:8 ~ thir_tree_match[3c9a]::Bar::Third), ctor: Some((Const, DefId(0:9 ~ thir_tree_match[3c9a]::Bar::Third::{constructor#0}))), name: "Third", discr: Relative(2), fields: [], flags: NO_VARIANT_FLAGS }]
-                                                                                                                                flags: IS_ENUM
-                                                                                                                                repr: ReprOptions { int: None, align: None, pack: None, flags: (empty), field_shuffle_seed: 3125160937860410723 }
-                                                                                                                        substs: []
-                                                                                                                        variant_index: 0
-                                                                                                                        subpatterns: []
-                                                                                                                    }
-                                                                                                                }
-                                                                                                            }
-                                                                                                        ]
-                                                                                                    }
-                                                                                                }
-                                                                                            }
-                                                                                        guard: None
-                                                                                        body: 
-                                                                                            Expr {
-                                                                                                ty: bool
-                                                                                                temp_lifetime: Some(Node(13))
-                                                                                                span: $DIR/thir-tree-match.rs:17:36: 17:40 (#0)
-                                                                                                kind: 
-                                                                                                    Scope {
-                                                                                                        region_scope: Destruction(13)
-                                                                                                        lint_level: Inherited
-                                                                                                        value:
-                                                                                                            Expr {
-                                                                                                                ty: bool
-                                                                                                                temp_lifetime: Some(Node(13))
-                                                                                                                span: $DIR/thir-tree-match.rs:17:36: 17:40 (#0)
-                                                                                                                kind: 
-                                                                                                                    Scope {
-                                                                                                                        region_scope: Node(13)
-                                                                                                                        lint_level: Explicit(HirId(DefId(0:16 ~ thir_tree_match[3c9a]::has_match).13))
-                                                                                                                        value:
-                                                                                                                            Expr {
-                                                                                                                                ty: bool
-                                                                                                                                temp_lifetime: Some(Node(13))
-                                                                                                                                span: $DIR/thir-tree-match.rs:17:36: 17:40 (#0)
-                                                                                                                                kind: 
-                                                                                                                                    Literal( lit: Spanned { node: Bool(true), span: $DIR/thir-tree-match.rs:17:36: 17:40 (#0) }, neg: false)
-
-                                                                                                                            }
-                                                                                                                    }
-                                                                                                            }
-                                                                                                    }
-                                                                                            }
-                                                                                        lint_level: Explicit(HirId(DefId(0:16 ~ thir_tree_match[3c9a]::has_match).12))
-                                                                                        scope: Node(12)
-                                                                                        span: $DIR/thir-tree-match.rs:17:9: 17:40 (#0)
-                                                                                    }
-                                                                                    Arm {
-                                                                                        pattern: 
-                                                                                            Pat: {
-                                                                                                ty: Foo
-                                                                                                span: $DIR/thir-tree-match.rs:18:9: 18:23 (#0)
-                                                                                                kind: PatKind {
-                                                                                                    Variant {
-                                                                                                        adt_def: 
-                                                                                                            AdtDef {
-                                                                                                                did: DefId(0:10 ~ thir_tree_match[3c9a]::Foo)
-                                                                                                                variants: [VariantDef { def_id: DefId(0:11 ~ thir_tree_match[3c9a]::Foo::FooOne), ctor: Some((Fn, DefId(0:12 ~ thir_tree_match[3c9a]::Foo::FooOne::{constructor#0}))), name: "FooOne", discr: Relative(0), fields: [FieldDef { did: DefId(0:13 ~ thir_tree_match[3c9a]::Foo::FooOne::0), name: "0", vis: Restricted(DefId(0:0 ~ thir_tree_match[3c9a])) }], flags: NO_VARIANT_FLAGS }, VariantDef { def_id: DefId(0:14 ~ thir_tree_match[3c9a]::Foo::FooTwo), ctor: Some((Const, DefId(0:15 ~ thir_tree_match[3c9a]::Foo::FooTwo::{constructor#0}))), name: "FooTwo", discr: Relative(1), fields: [], flags: NO_VARIANT_FLAGS }]
-                                                                                                                flags: IS_ENUM
-                                                                                                                repr: ReprOptions { int: None, align: None, pack: None, flags: (empty), field_shuffle_seed: 11573694388057581 }
-                                                                                                        substs: []
-                                                                                                        variant_index: 0
-                                                                                                        subpatterns: [
-                                                                                                            Pat: {
-                                                                                                                ty: Bar
-                                                                                                                span: $DIR/thir-tree-match.rs:18:21: 18:22 (#0)
-                                                                                                                kind: PatKind {
-                                                                                                                    Wild
-                                                                                                                }
-                                                                                                            }
-                                                                                                        ]
-                                                                                                    }
-                                                                                                }
-                                                                                            }
-                                                                                        guard: None
-                                                                                        body: 
-                                                                                            Expr {
-                                                                                                ty: bool
-                                                                                                temp_lifetime: Some(Node(19))
-                                                                                                span: $DIR/thir-tree-match.rs:18:27: 18:32 (#0)
-                                                                                                kind: 
-                                                                                                    Scope {
-                                                                                                        region_scope: Destruction(19)
-                                                                                                        lint_level: Inherited
-                                                                                                        value:
-                                                                                                            Expr {
-                                                                                                                ty: bool
-                                                                                                                temp_lifetime: Some(Node(19))
-                                                                                                                span: $DIR/thir-tree-match.rs:18:27: 18:32 (#0)
-                                                                                                                kind: 
-                                                                                                                    Scope {
-                                                                                                                        region_scope: Node(19)
-                                                                                                                        lint_level: Explicit(HirId(DefId(0:16 ~ thir_tree_match[3c9a]::has_match).19))
-                                                                                                                        value:
-                                                                                                                            Expr {
-                                                                                                                                ty: bool
-                                                                                                                                temp_lifetime: Some(Node(19))
-                                                                                                                                span: $DIR/thir-tree-match.rs:18:27: 18:32 (#0)
-                                                                                                                                kind: 
-                                                                                                                                    Literal( lit: Spanned { node: Bool(false), span: $DIR/thir-tree-match.rs:18:27: 18:32 (#0) }, neg: false)
-
-                                                                                                                            }
-                                                                                                                    }
-                                                                                                            }
-                                                                                                    }
-                                                                                            }
-                                                                                        lint_level: Explicit(HirId(DefId(0:16 ~ thir_tree_match[3c9a]::has_match).18))
-                                                                                        scope: Node(18)
-                                                                                        span: $DIR/thir-tree-match.rs:18:9: 18:32 (#0)
-                                                                                    }
-                                                                                    Arm {
-                                                                                        pattern: 
-                                                                                            Pat: {
-                                                                                                ty: Foo
-                                                                                                span: $DIR/thir-tree-match.rs:19:9: 19:20 (#0)
-                                                                                                kind: PatKind {
-                                                                                                    Variant {
-                                                                                                        adt_def: 
-                                                                                                            AdtDef {
-                                                                                                                did: DefId(0:10 ~ thir_tree_match[3c9a]::Foo)
-                                                                                                                variants: [VariantDef { def_id: DefId(0:11 ~ thir_tree_match[3c9a]::Foo::FooOne), ctor: Some((Fn, DefId(0:12 ~ thir_tree_match[3c9a]::Foo::FooOne::{constructor#0}))), name: "FooOne", discr: Relative(0), fields: [FieldDef { did: DefId(0:13 ~ thir_tree_match[3c9a]::Foo::FooOne::0), name: "0", vis: Restricted(DefId(0:0 ~ thir_tree_match[3c9a])) }], flags: NO_VARIANT_FLAGS }, VariantDef { def_id: DefId(0:14 ~ thir_tree_match[3c9a]::Foo::FooTwo), ctor: Some((Const, DefId(0:15 ~ thir_tree_match[3c9a]::Foo::FooTwo::{constructor#0}))), name: "FooTwo", discr: Relative(1), fields: [], flags: NO_VARIANT_FLAGS }]
-                                                                                                                flags: IS_ENUM
-                                                                                                                repr: ReprOptions { int: None, align: None, pack: None, flags: (empty), field_shuffle_seed: 11573694388057581 }
-                                                                                                        substs: []
-                                                                                                        variant_index: 1
-                                                                                                        subpatterns: []
-                                                                                                    }
-                                                                                                }
-                                                                                            }
-                                                                                        guard: None
-                                                                                        body: 
-                                                                                            Expr {
-                                                                                                ty: bool
-                                                                                                temp_lifetime: Some(Node(24))
-                                                                                                span: $DIR/thir-tree-match.rs:19:24: 19:28 (#0)
-                                                                                                kind: 
-                                                                                                    Scope {
-                                                                                                        region_scope: Destruction(24)
-                                                                                                        lint_level: Inherited
-                                                                                                        value:
-                                                                                                            Expr {
-                                                                                                                ty: bool
-                                                                                                                temp_lifetime: Some(Node(24))
-                                                                                                                span: $DIR/thir-tree-match.rs:19:24: 19:28 (#0)
-                                                                                                                kind: 
-                                                                                                                    Scope {
-                                                                                                                        region_scope: Node(24)
-                                                                                                                        lint_level: Explicit(HirId(DefId(0:16 ~ thir_tree_match[3c9a]::has_match).24))
-                                                                                                                        value:
-                                                                                                                            Expr {
-                                                                                                                                ty: bool
-                                                                                                                                temp_lifetime: Some(Node(24))
-                                                                                                                                span: $DIR/thir-tree-match.rs:19:24: 19:28 (#0)
-                                                                                                                                kind: 
-                                                                                                                                    Literal( lit: Spanned { node: Bool(true), span: $DIR/thir-tree-match.rs:19:24: 19:28 (#0) }, neg: false)
-
-                                                                                                                            }
-                                                                                                                    }
-                                                                                                            }
-                                                                                                    }
-                                                                                            }
-                                                                                        lint_level: Explicit(HirId(DefId(0:16 ~ thir_tree_match[3c9a]::has_match).23))
-                                                                                        scope: Node(23)
-                                                                                        span: $DIR/thir-tree-match.rs:19:9: 19:28 (#0)
-                                                                                    }
-                                                                                ]
-                                                                            }
-                                                                    }
-                                                            }
-                                                    }
-                                            }
-                                    }
-                            }
-                    }
-            }
-    }
-
-
-DefId(0:17 ~ thir_tree_match[3c9a]::main):
-params: [
-]
-body:
-    Expr {
-        ty: ()
-        temp_lifetime: Some(Node(2))
-        span: $DIR/thir-tree-match.rs:23:11: 23:13 (#0)
-        kind: 
-            Scope {
-                region_scope: Destruction(2)
-                lint_level: Inherited
-                value:
-                    Expr {
-                        ty: ()
-                        temp_lifetime: Some(Node(2))
-                        span: $DIR/thir-tree-match.rs:23:11: 23:13 (#0)
-                        kind: 
-                            Scope {
-                                region_scope: Node(2)
-                                lint_level: Explicit(HirId(DefId(0:17 ~ thir_tree_match[3c9a]::main).2))
-                                value:
-                                    Expr {
-                                        ty: ()
-                                        temp_lifetime: Some(Node(2))
-                                        span: $DIR/thir-tree-match.rs:23:11: 23:13 (#0)
-                                        kind: 
-                                            Block {
-                                                targeted_by_break: false
-                                                opt_destruction_scope: None
-                                                span: $DIR/thir-tree-match.rs:23:11: 23:13 (#0)
-                                                region_scope: Node(1)
-                                                safety_mode: Safe
-                                                stmts: []
-                                                expr: []
-                                            }
-                                    }
-                            }
-                    }
-            }
-    }
-
-
diff --git a/tests/ui/thir-tree.rs b/tests/ui/thir-tree.rs
deleted file mode 100644 (file)
index 32df790..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-// compile-flags: -Z unpretty=thir-tree
-// check-pass
-
-pub fn main() {}
diff --git a/tests/ui/thir-tree.stdout b/tests/ui/thir-tree.stdout
deleted file mode 100644 (file)
index 0a35d9f..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-DefId(0:3 ~ thir_tree[8f1d]::main):
-params: [
-]
-body:
-    Expr {
-        ty: ()
-        temp_lifetime: Some(Node(2))
-        span: $DIR/thir-tree.rs:4:15: 4:17 (#0)
-        kind: 
-            Scope {
-                region_scope: Destruction(2)
-                lint_level: Inherited
-                value:
-                    Expr {
-                        ty: ()
-                        temp_lifetime: Some(Node(2))
-                        span: $DIR/thir-tree.rs:4:15: 4:17 (#0)
-                        kind: 
-                            Scope {
-                                region_scope: Node(2)
-                                lint_level: Explicit(HirId(DefId(0:3 ~ thir_tree[8f1d]::main).2))
-                                value:
-                                    Expr {
-                                        ty: ()
-                                        temp_lifetime: Some(Node(2))
-                                        span: $DIR/thir-tree.rs:4:15: 4:17 (#0)
-                                        kind: 
-                                            Block {
-                                                targeted_by_break: false
-                                                opt_destruction_scope: None
-                                                span: $DIR/thir-tree.rs:4:15: 4:17 (#0)
-                                                region_scope: Node(1)
-                                                safety_mode: Safe
-                                                stmts: []
-                                                expr: []
-                                            }
-                                    }
-                            }
-                    }
-            }
-    }
-
-