mirror of
https://github.com/rust-lang/rust.git
synced 2025-01-19 03:03:21 +00:00
add thir-print test
This commit is contained in:
parent
7dfb9eda25
commit
b9e991a105
18
tests/ui/thir-print/thir-flat-const-variant.rs
Normal file
18
tests/ui/thir-print/thir-flat-const-variant.rs
Normal file
@ -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() {}
|
399
tests/ui/thir-print/thir-flat-const-variant.stdout
Normal file
399
tests/ui/thir-print/thir-flat-const-variant.stdout
Normal file
@ -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: [],
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user