address review

This commit is contained in:
b-naber 2023-01-27 22:13:55 +01:00
parent 9438126fd1
commit 92f2d27d1b
8 changed files with 70 additions and 10 deletions

View 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);

View 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 {

View File

@ -0,0 +1,4 @@
// compile-flags: -Z unpretty=thir-flat
// check-pass
pub fn main() {}

View File

@ -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: [],
}