- dbg!(item.ident);
- if_chain! {
- if let ItemKind::Struct(data, _generics) = &item.kind;
- if let VariantData::Struct(field_defs, _) = data;
- if let Some(last_field) = field_defs.last();
- if let TyKind::Array(_, aconst) = last_field.ty.kind;
- let aconst_def_id = cx.tcx.hir().body_owner_def_id(aconst.body).to_def_id();
- let ty = cx.tcx.type_of(aconst_def_id);
- let constant = cx
- .tcx
- .const_eval_poly(aconst_def_id) // NOTE: maybe const_eval_resolve? seems especially cursed to be using a const expr which resolves to 0 to create a zero-sized array, tho
- .ok()
- .map(|val| rustc_middle::ty::Const::from_value(cx.tcx, val, ty));
- if let Some(Constant::Int(val)) = constant.and_then(miri_to_const);
- if val == 0;
- then {
- eprintln!("true");
- true
- } else {
- // dbg!(aconst);
- eprintln!("false");
- false
+ if let ItemKind::Struct(data, _generics) = &item.kind {
+ if let VariantData::Struct(field_defs, _) = data {
+ if let Some(last_field) = field_defs.last() {
+ if let TyKind::Array(_, aconst) = last_field.ty.kind {
+ let aconst_def_id = cx.tcx.hir().body_owner_def_id(aconst.body).to_def_id();
+ let ty = cx.tcx.type_of(aconst_def_id);
+ let constant = cx
+ .tcx
+ // NOTE: maybe const_eval_resolve? seems especially cursed to be using a const expr which
+ // resolves to 0 to create a zero-sized array, tho
+ .const_eval_poly(aconst_def_id)
+ .ok()
+ .map(|val| rustc_middle::ty::Const::from_value(cx.tcx, val, ty));
+ if let Some(Constant::Int(val)) = constant.and_then(miri_to_const) {
+ if val == 0 {
+ eprintln!("trailing: true");
+ return true;
+ }
+ }
+ }
+ }