From 76a7772759247e00365a90be936504289c359165 Mon Sep 17 00:00:00 2001 From: Eric Mark Martin Date: Fri, 30 Jun 2023 08:26:56 -0400 Subject: [PATCH 1/6] resolve typerelative ctors to adt --- compiler/rustc_mir_build/src/thir/cx/expr.rs | 39 +++++++++++++------ .../user-annotations/normalization-2.stderr | 2 +- 2 files changed, 28 insertions(+), 13 deletions(-) diff --git a/compiler/rustc_mir_build/src/thir/cx/expr.rs b/compiler/rustc_mir_build/src/thir/cx/expr.rs index 791c10c1748..26192c8e3c6 100644 --- a/compiler/rustc_mir_build/src/thir/cx/expr.rs +++ b/compiler/rustc_mir_build/src/thir/cx/expr.rs @@ -351,19 +351,34 @@ impl<'tcx> Cx<'tcx> { }); } } - let adt_data = - if let hir::ExprKind::Path(hir::QPath::Resolved(_, ref path)) = fun.kind { + let adt_data = if let hir::ExprKind::Path(qpath) = fun.kind { + match qpath { // Tuple-like ADTs are represented as ExprKind::Call. We convert them here. - expr_ty.ty_adt_def().and_then(|adt_def| match path.res { - Res::Def(DefKind::Ctor(_, CtorKind::Fn), ctor_id) => { - Some((adt_def, adt_def.variant_index_with_ctor_id(ctor_id))) - } - Res::SelfCtor(..) => Some((adt_def, FIRST_VARIANT)), - _ => None, - }) - } else { - None - }; + hir::QPath::Resolved(_, ref path) => { + expr_ty.ty_adt_def().and_then(|adt_def| match path.res { + Res::Def(DefKind::Ctor(_, CtorKind::Fn), ctor_id) => { + Some((adt_def, adt_def.variant_index_with_ctor_id(ctor_id))) + } + Res::SelfCtor(..) => Some((adt_def, FIRST_VARIANT)), + _ => None, + }) + } + hir::QPath::TypeRelative(_ty, _) => { + expr_ty.ty_adt_def().and_then(|adt_def| { + if let Some((DefKind::Ctor(_, CtorKind::Fn), ctor_id)) = + self.typeck_results().type_dependent_def(fun.hir_id) + { + Some((adt_def, adt_def.variant_index_with_ctor_id(ctor_id))) + } else { + None + } + }) + } + _ => None, + } + } else { + None + }; if let Some((adt_def, index)) = adt_data { let substs = self.typeck_results().node_substs(fun.hir_id); let user_provided_types = self.typeck_results().user_provided_types(); diff --git a/tests/ui/nll/user-annotations/normalization-2.stderr b/tests/ui/nll/user-annotations/normalization-2.stderr index 5299282ea15..6b0dcb414ae 100644 --- a/tests/ui/nll/user-annotations/normalization-2.stderr +++ b/tests/ui/nll/user-annotations/normalization-2.stderr @@ -147,7 +147,7 @@ LL | fn test_variants<'a, 'b, 'c>() { | -- lifetime `'b` defined here ... LL | >::Tuple(); - | ^^^^^^^^^^^^^^^ requires that `'b` must outlive `'static` + | ^^^^^^^^^^^^^^^^^ requires that `'b` must outlive `'static` error: lifetime may not live long enough --> $DIR/normalization-2.rs:93:5 From 7dfb9eda25d1973fd8b70f95174e31c1443dde6a Mon Sep 17 00:00:00 2001 From: Eric Mark Martin Date: Sat, 1 Jul 2023 02:28:15 -0400 Subject: [PATCH 2/6] add regression test --- tests/ui/pattern/issue-110508.rs | 38 ++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 tests/ui/pattern/issue-110508.rs diff --git a/tests/ui/pattern/issue-110508.rs b/tests/ui/pattern/issue-110508.rs new file mode 100644 index 00000000000..1024ff05578 --- /dev/null +++ b/tests/ui/pattern/issue-110508.rs @@ -0,0 +1,38 @@ +// run-pass + +#[derive(PartialEq, Eq)] +pub enum Foo { + FooA(()), + FooB(Vec<()>), +} + +impl Foo { + const A1: Foo = Foo::FooA(()); + const A2: Foo = Self::FooA(()); + const A3: Self = Foo::FooA(()); + const A4: Self = Self::FooA(()); +} + +fn main() { + let foo = Foo::FooA(()); + + match foo { + Foo::A1 => {}, + _ => {}, + } + + match foo { + Foo::A2 => {}, + _ => {}, + } + + match foo { + Foo::A3 => {}, + _ => {}, + } + + match foo { + Foo::A4 => {}, + _ => {}, + } +} From b9e991a105f36060a7ed501aa7f5897cc43685ae Mon Sep 17 00:00:00 2001 From: Eric Mark Martin Date: Sat, 1 Jul 2023 15:15:22 -0400 Subject: [PATCH 3/6] add thir-print test --- .../ui/thir-print/thir-flat-const-variant.rs | 18 + .../thir-print/thir-flat-const-variant.stdout | 399 ++++++++++++++++++ 2 files changed, 417 insertions(+) create mode 100644 tests/ui/thir-print/thir-flat-const-variant.rs create mode 100644 tests/ui/thir-print/thir-flat-const-variant.stdout diff --git a/tests/ui/thir-print/thir-flat-const-variant.rs b/tests/ui/thir-print/thir-flat-const-variant.rs new file mode 100644 index 00000000000..2cd87a5cbb2 --- /dev/null +++ b/tests/ui/thir-print/thir-flat-const-variant.rs @@ -0,0 +1,18 @@ +// compile-flags: -Z unpretty=thir-flat +// check-pass + +// Previously, the constants with `Self::Bar(())` would be `Call`s instead of +// `Adt`s in THIR. + +pub enum Foo { + Bar(()), +} + +impl Foo { + const BAR1: Foo = Foo::Bar(()); + const BAR2: Foo = Self::Bar(()); + const BAR3: Self = Foo::Bar(()); + const BAR4: Self = Self::Bar(()); +} + +fn main() {} diff --git a/tests/ui/thir-print/thir-flat-const-variant.stdout b/tests/ui/thir-print/thir-flat-const-variant.stdout new file mode 100644 index 00000000000..1b76f07c318 --- /dev/null +++ b/tests/ui/thir-print/thir-flat-const-variant.stdout @@ -0,0 +1,399 @@ +DefId(0:8 ~ thir_flat_const_variant[1f54]::{impl#0}::BAR1): +Thir { + body_type: Const( + Foo, + ), + arms: [], + blocks: [], + exprs: [ + Expr { + kind: Tuple { + fields: [], + }, + ty: (), + temp_lifetime: Some( + Node(3), + ), + span: $DIR/thir-flat-const-variant.rs:12:32: 12:34 (#0), + }, + Expr { + kind: Scope { + region_scope: Node(7), + lint_level: Explicit( + HirId(DefId(0:8 ~ thir_flat_const_variant[1f54]::{impl#0}::BAR1).7), + ), + value: e0, + }, + ty: (), + temp_lifetime: Some( + Node(3), + ), + span: $DIR/thir-flat-const-variant.rs:12:32: 12:34 (#0), + }, + Expr { + kind: Adt( + AdtExpr { + adt_def: Foo, + variant_index: 0, + substs: [], + user_ty: None, + fields: [ + FieldExpr { + name: 0, + expr: e1, + }, + ], + base: None, + }, + ), + ty: Foo, + temp_lifetime: Some( + Node(3), + ), + span: $DIR/thir-flat-const-variant.rs:12:23: 12:35 (#0), + }, + Expr { + kind: Scope { + region_scope: Node(3), + lint_level: Explicit( + HirId(DefId(0:8 ~ thir_flat_const_variant[1f54]::{impl#0}::BAR1).3), + ), + value: e2, + }, + ty: Foo, + temp_lifetime: Some( + Node(3), + ), + span: $DIR/thir-flat-const-variant.rs:12:23: 12:35 (#0), + }, + Expr { + kind: Scope { + region_scope: Destruction(3), + lint_level: Inherited, + value: e3, + }, + ty: Foo, + temp_lifetime: Some( + Node(3), + ), + span: $DIR/thir-flat-const-variant.rs:12:23: 12:35 (#0), + }, + ], + stmts: [], + params: [], +} + +DefId(0:9 ~ thir_flat_const_variant[1f54]::{impl#0}::BAR2): +Thir { + body_type: Const( + Foo, + ), + arms: [], + blocks: [], + exprs: [ + Expr { + kind: Tuple { + fields: [], + }, + ty: (), + temp_lifetime: Some( + Node(3), + ), + span: $DIR/thir-flat-const-variant.rs:13:33: 13:35 (#0), + }, + Expr { + kind: Scope { + region_scope: Node(8), + lint_level: Explicit( + HirId(DefId(0:9 ~ thir_flat_const_variant[1f54]::{impl#0}::BAR2).8), + ), + value: e0, + }, + ty: (), + temp_lifetime: Some( + Node(3), + ), + span: $DIR/thir-flat-const-variant.rs:13:33: 13:35 (#0), + }, + Expr { + kind: Adt( + AdtExpr { + adt_def: Foo, + variant_index: 0, + substs: [], + user_ty: None, + fields: [ + FieldExpr { + name: 0, + expr: e1, + }, + ], + base: None, + }, + ), + ty: Foo, + temp_lifetime: Some( + Node(3), + ), + span: $DIR/thir-flat-const-variant.rs:13:23: 13:36 (#0), + }, + Expr { + kind: Scope { + region_scope: Node(3), + lint_level: Explicit( + HirId(DefId(0:9 ~ thir_flat_const_variant[1f54]::{impl#0}::BAR2).3), + ), + value: e2, + }, + ty: Foo, + temp_lifetime: Some( + Node(3), + ), + span: $DIR/thir-flat-const-variant.rs:13:23: 13:36 (#0), + }, + Expr { + kind: Scope { + region_scope: Destruction(3), + lint_level: Inherited, + value: e3, + }, + ty: Foo, + temp_lifetime: Some( + Node(3), + ), + span: $DIR/thir-flat-const-variant.rs:13:23: 13:36 (#0), + }, + ], + stmts: [], + params: [], +} + +DefId(0:10 ~ thir_flat_const_variant[1f54]::{impl#0}::BAR3): +Thir { + body_type: Const( + Foo, + ), + arms: [], + blocks: [], + exprs: [ + Expr { + kind: Tuple { + fields: [], + }, + ty: (), + temp_lifetime: Some( + Node(3), + ), + span: $DIR/thir-flat-const-variant.rs:14:33: 14:35 (#0), + }, + Expr { + kind: Scope { + region_scope: Node(7), + lint_level: Explicit( + HirId(DefId(0:10 ~ thir_flat_const_variant[1f54]::{impl#0}::BAR3).7), + ), + value: e0, + }, + ty: (), + temp_lifetime: Some( + Node(3), + ), + span: $DIR/thir-flat-const-variant.rs:14:33: 14:35 (#0), + }, + Expr { + kind: Adt( + AdtExpr { + adt_def: Foo, + variant_index: 0, + substs: [], + user_ty: None, + fields: [ + FieldExpr { + name: 0, + expr: e1, + }, + ], + base: None, + }, + ), + ty: Foo, + temp_lifetime: Some( + Node(3), + ), + span: $DIR/thir-flat-const-variant.rs:14:24: 14:36 (#0), + }, + Expr { + kind: Scope { + region_scope: Node(3), + lint_level: Explicit( + HirId(DefId(0:10 ~ thir_flat_const_variant[1f54]::{impl#0}::BAR3).3), + ), + value: e2, + }, + ty: Foo, + temp_lifetime: Some( + Node(3), + ), + span: $DIR/thir-flat-const-variant.rs:14:24: 14:36 (#0), + }, + Expr { + kind: Scope { + region_scope: Destruction(3), + lint_level: Inherited, + value: e3, + }, + ty: Foo, + temp_lifetime: Some( + Node(3), + ), + span: $DIR/thir-flat-const-variant.rs:14:24: 14:36 (#0), + }, + ], + stmts: [], + params: [], +} + +DefId(0:11 ~ thir_flat_const_variant[1f54]::{impl#0}::BAR4): +Thir { + body_type: Const( + Foo, + ), + arms: [], + blocks: [], + exprs: [ + Expr { + kind: Tuple { + fields: [], + }, + ty: (), + temp_lifetime: Some( + Node(3), + ), + span: $DIR/thir-flat-const-variant.rs:15:34: 15:36 (#0), + }, + Expr { + kind: Scope { + region_scope: Node(8), + lint_level: Explicit( + HirId(DefId(0:11 ~ thir_flat_const_variant[1f54]::{impl#0}::BAR4).8), + ), + value: e0, + }, + ty: (), + temp_lifetime: Some( + Node(3), + ), + span: $DIR/thir-flat-const-variant.rs:15:34: 15:36 (#0), + }, + Expr { + kind: Adt( + AdtExpr { + adt_def: Foo, + variant_index: 0, + substs: [], + user_ty: None, + fields: [ + FieldExpr { + name: 0, + expr: e1, + }, + ], + base: None, + }, + ), + ty: Foo, + temp_lifetime: Some( + Node(3), + ), + span: $DIR/thir-flat-const-variant.rs:15:24: 15:37 (#0), + }, + Expr { + kind: Scope { + region_scope: Node(3), + lint_level: Explicit( + HirId(DefId(0:11 ~ thir_flat_const_variant[1f54]::{impl#0}::BAR4).3), + ), + value: e2, + }, + ty: Foo, + temp_lifetime: Some( + Node(3), + ), + span: $DIR/thir-flat-const-variant.rs:15:24: 15:37 (#0), + }, + Expr { + kind: Scope { + region_scope: Destruction(3), + lint_level: Inherited, + value: e3, + }, + ty: Foo, + temp_lifetime: Some( + Node(3), + ), + span: $DIR/thir-flat-const-variant.rs:15:24: 15:37 (#0), + }, + ], + stmts: [], + params: [], +} + +DefId(0:12 ~ thir_flat_const_variant[1f54]::main): +Thir { + body_type: Fn( + fn(), + ), + arms: [], + blocks: [ + Block { + targeted_by_break: false, + region_scope: Node(1), + opt_destruction_scope: None, + span: $DIR/thir-flat-const-variant.rs:18:11: 18:13 (#0), + stmts: [], + expr: None, + safety_mode: Safe, + }, + ], + exprs: [ + Expr { + kind: Block { + block: b0, + }, + ty: (), + temp_lifetime: Some( + Node(2), + ), + span: $DIR/thir-flat-const-variant.rs:18:11: 18:13 (#0), + }, + Expr { + kind: Scope { + region_scope: Node(2), + lint_level: Explicit( + HirId(DefId(0:12 ~ thir_flat_const_variant[1f54]::main).2), + ), + value: e0, + }, + ty: (), + temp_lifetime: Some( + Node(2), + ), + span: $DIR/thir-flat-const-variant.rs:18:11: 18:13 (#0), + }, + Expr { + kind: Scope { + region_scope: Destruction(2), + lint_level: Inherited, + value: e1, + }, + ty: (), + temp_lifetime: Some( + Node(2), + ), + span: $DIR/thir-flat-const-variant.rs:18:11: 18:13 (#0), + }, + ], + stmts: [], + params: [], +} + From 07b1912acc54949b4077138b6f1adac376b94e92 Mon Sep 17 00:00:00 2001 From: Eric Mark Martin Date: Sun, 2 Jul 2023 18:44:26 -0400 Subject: [PATCH 4/6] refactor --- compiler/rustc_mir_build/src/thir/cx/expr.rs | 36 +++++++++++--------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/compiler/rustc_mir_build/src/thir/cx/expr.rs b/compiler/rustc_mir_build/src/thir/cx/expr.rs index 26192c8e3c6..dc1c0966fe7 100644 --- a/compiler/rustc_mir_build/src/thir/cx/expr.rs +++ b/compiler/rustc_mir_build/src/thir/cx/expr.rs @@ -208,17 +208,18 @@ impl<'tcx> Cx<'tcx> { // so we wouldn't have to compute and store the actual value let hir::ExprKind::Path(ref qpath) = source.kind else { - return ExprKind::Cast { source: self.mirror_expr(source)}; + return ExprKind::Cast { source: self.mirror_expr(source) }; }; let res = self.typeck_results().qpath_res(qpath, source.hir_id); let ty = self.typeck_results().node_type(source.hir_id); let ty::Adt(adt_def, substs) = ty.kind() else { - return ExprKind::Cast { source: self.mirror_expr(source)}; + return ExprKind::Cast { source: self.mirror_expr(source) }; }; - let Res::Def(DefKind::Ctor(CtorOf::Variant, CtorKind::Const), variant_ctor_id) = res else { - return ExprKind::Cast { source: self.mirror_expr(source)}; + let Res::Def(DefKind::Ctor(CtorOf::Variant, CtorKind::Const), variant_ctor_id) = res + else { + return ExprKind::Cast { source: self.mirror_expr(source) }; }; let idx = adt_def.variant_index_with_ctor_id(variant_ctor_id); @@ -351,28 +352,29 @@ impl<'tcx> Cx<'tcx> { }); } } - let adt_data = if let hir::ExprKind::Path(qpath) = fun.kind { + + // Tuple-like ADTs are represented as ExprKind::Call. We convert them here. + let adt_data = if let hir::ExprKind::Path(ref qpath) = fun.kind + && let Some(adt_def) = expr_ty.ty_adt_def() { match qpath { - // Tuple-like ADTs are represented as ExprKind::Call. We convert them here. hir::QPath::Resolved(_, ref path) => { - expr_ty.ty_adt_def().and_then(|adt_def| match path.res { + match path.res { Res::Def(DefKind::Ctor(_, CtorKind::Fn), ctor_id) => { Some((adt_def, adt_def.variant_index_with_ctor_id(ctor_id))) } Res::SelfCtor(..) => Some((adt_def, FIRST_VARIANT)), _ => None, - }) + } } hir::QPath::TypeRelative(_ty, _) => { - expr_ty.ty_adt_def().and_then(|adt_def| { - if let Some((DefKind::Ctor(_, CtorKind::Fn), ctor_id)) = - self.typeck_results().type_dependent_def(fun.hir_id) - { - Some((adt_def, adt_def.variant_index_with_ctor_id(ctor_id))) - } else { - None - } - }) + if let Some((DefKind::Ctor(_, CtorKind::Fn), ctor_id)) = + self.typeck_results().type_dependent_def(fun.hir_id) + { + Some((adt_def, adt_def.variant_index_with_ctor_id(ctor_id))) + } else { + None + } + } _ => None, } From afccc444022f17fea184c65758827f9d5e64922b Mon Sep 17 00:00:00 2001 From: Eric Mark Martin Date: Wed, 5 Jul 2023 02:19:44 +0000 Subject: [PATCH 5/6] add mir dump test --- tests/mir-opt/building/issue_110508.rs | 13 +++++++++++++ .../issue_110508.{impl#0}-BAR1.built.after.mir | 14 ++++++++++++++ .../issue_110508.{impl#0}-BAR2.built.after.mir | 14 ++++++++++++++ 3 files changed, 41 insertions(+) create mode 100644 tests/mir-opt/building/issue_110508.rs create mode 100644 tests/mir-opt/building/issue_110508.{impl#0}-BAR1.built.after.mir create mode 100644 tests/mir-opt/building/issue_110508.{impl#0}-BAR2.built.after.mir diff --git a/tests/mir-opt/building/issue_110508.rs b/tests/mir-opt/building/issue_110508.rs new file mode 100644 index 00000000000..120b026a70f --- /dev/null +++ b/tests/mir-opt/building/issue_110508.rs @@ -0,0 +1,13 @@ +// EMIT_MIR issue_110508.{impl#0}-BAR1.built.after.mir +// EMIT_MIR issue_110508.{impl#0}-BAR2.built.after.mir + +enum Foo { + Bar(()), +} + +impl Foo { + const BAR1: Foo = Foo::Bar(()); + const BAR2: Foo = Self::Bar(()); +} + +fn main() {} diff --git a/tests/mir-opt/building/issue_110508.{impl#0}-BAR1.built.after.mir b/tests/mir-opt/building/issue_110508.{impl#0}-BAR1.built.after.mir new file mode 100644 index 00000000000..6adcdcae762 --- /dev/null +++ b/tests/mir-opt/building/issue_110508.{impl#0}-BAR1.built.after.mir @@ -0,0 +1,14 @@ +// MIR for `::BAR1` after built + +const ::BAR1: Foo = { + let mut _0: Foo; + let mut _1: (); + + bb0: { + StorageLive(_1); + _1 = (); + _0 = Foo::Bar(move _1); + StorageDead(_1); + return; + } +} diff --git a/tests/mir-opt/building/issue_110508.{impl#0}-BAR2.built.after.mir b/tests/mir-opt/building/issue_110508.{impl#0}-BAR2.built.after.mir new file mode 100644 index 00000000000..d1bd45fba26 --- /dev/null +++ b/tests/mir-opt/building/issue_110508.{impl#0}-BAR2.built.after.mir @@ -0,0 +1,14 @@ +// MIR for `::BAR2` after built + +const ::BAR2: Foo = { + let mut _0: Foo; + let mut _1: (); + + bb0: { + StorageLive(_1); + _1 = (); + _0 = Foo::Bar(move _1); + StorageDead(_1); + return; + } +} From 261c0231232287dec32329ceb67d61249ffc8d5e Mon Sep 17 00:00:00 2001 From: Eric Mark Martin Date: Wed, 5 Jul 2023 04:28:45 +0000 Subject: [PATCH 6/6] rename constants in mir dump test --- tests/mir-opt/building/issue_110508.rs | 8 ++++---- ...fter.mir => issue_110508.{impl#0}-BAR.built.after.mir} | 4 ++-- ...mir => issue_110508.{impl#0}-SELF_BAR.built.after.mir} | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) rename tests/mir-opt/building/{issue_110508.{impl#0}-BAR1.built.after.mir => issue_110508.{impl#0}-BAR.built.after.mir} (57%) rename tests/mir-opt/building/{issue_110508.{impl#0}-BAR2.built.after.mir => issue_110508.{impl#0}-SELF_BAR.built.after.mir} (55%) diff --git a/tests/mir-opt/building/issue_110508.rs b/tests/mir-opt/building/issue_110508.rs index 120b026a70f..bcbb1c29830 100644 --- a/tests/mir-opt/building/issue_110508.rs +++ b/tests/mir-opt/building/issue_110508.rs @@ -1,13 +1,13 @@ -// EMIT_MIR issue_110508.{impl#0}-BAR1.built.after.mir -// EMIT_MIR issue_110508.{impl#0}-BAR2.built.after.mir +// EMIT_MIR issue_110508.{impl#0}-BAR.built.after.mir +// EMIT_MIR issue_110508.{impl#0}-SELF_BAR.built.after.mir enum Foo { Bar(()), } impl Foo { - const BAR1: Foo = Foo::Bar(()); - const BAR2: Foo = Self::Bar(()); + const BAR: Foo = Foo::Bar(()); + const SELF_BAR: Foo = Self::Bar(()); } fn main() {} diff --git a/tests/mir-opt/building/issue_110508.{impl#0}-BAR1.built.after.mir b/tests/mir-opt/building/issue_110508.{impl#0}-BAR.built.after.mir similarity index 57% rename from tests/mir-opt/building/issue_110508.{impl#0}-BAR1.built.after.mir rename to tests/mir-opt/building/issue_110508.{impl#0}-BAR.built.after.mir index 6adcdcae762..5fc6d911af3 100644 --- a/tests/mir-opt/building/issue_110508.{impl#0}-BAR1.built.after.mir +++ b/tests/mir-opt/building/issue_110508.{impl#0}-BAR.built.after.mir @@ -1,6 +1,6 @@ -// MIR for `::BAR1` after built +// MIR for `::BAR` after built -const ::BAR1: Foo = { +const ::BAR: Foo = { let mut _0: Foo; let mut _1: (); diff --git a/tests/mir-opt/building/issue_110508.{impl#0}-BAR2.built.after.mir b/tests/mir-opt/building/issue_110508.{impl#0}-SELF_BAR.built.after.mir similarity index 55% rename from tests/mir-opt/building/issue_110508.{impl#0}-BAR2.built.after.mir rename to tests/mir-opt/building/issue_110508.{impl#0}-SELF_BAR.built.after.mir index d1bd45fba26..1a892559971 100644 --- a/tests/mir-opt/building/issue_110508.{impl#0}-BAR2.built.after.mir +++ b/tests/mir-opt/building/issue_110508.{impl#0}-SELF_BAR.built.after.mir @@ -1,6 +1,6 @@ -// MIR for `::BAR2` after built +// MIR for `::SELF_BAR` after built -const ::BAR2: Foo = { +const ::SELF_BAR: Foo = { let mut _0: Foo; let mut _1: ();