This commit is contained in:
b-naber 2022-06-24 16:43:38 +02:00
parent f39c0d6b0a
commit bf48b622a5
2 changed files with 7 additions and 9 deletions

View File

@ -203,14 +203,12 @@ fn mirror_expr_cast(
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)};
};
let Res::Def(
DefKind::Ctor(CtorOf::Variant, CtorKind::Const),
variant_ctor_id,
) = res 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 idx = adt_def.variant_index_with_ctor_id(variant_ctor_id);
let (discr_did, discr_offset) = adt_def.discriminant_def_for_variant(idx);

View File

@ -1,4 +1,4 @@
//build-pass
// build-pass
pub enum Register<const N: u16> {
Field0 = 40,