Skip to content

Commit 2e3221a

Browse files
committed
use correct substs in enum discriminant hack
1 parent 4c4fb71 commit 2e3221a

File tree

1 file changed

+4
-1
lines changed
  • compiler/rustc_mir_build/src/thir/cx

1 file changed

+4
-1
lines changed

compiler/rustc_mir_build/src/thir/cx/expr.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -650,6 +650,9 @@ impl<'tcx> Cx<'tcx> {
650650
} else {
651651
None
652652
};
653+
debug!(?var);
654+
let substs = self.typeck_results.node_substs(source.hir_id);
655+
debug!(?substs);
653656

654657
let source = if let Some((did, offset, var_ty)) = var {
655658
let param_env_ty = self.param_env.and(var_ty);
@@ -671,7 +674,7 @@ impl<'tcx> Cx<'tcx> {
671674
Some(did) => {
672675
// in case we are offsetting from a computed discriminant
673676
// and not the beginning of discriminants (which is always `0`)
674-
let substs = InternalSubsts::identity_for_item(tcx, did);
677+
675678
let kind =
676679
ExprKind::NamedConst { def_id: did, substs, user_ty: None };
677680
let lhs = self.thir.exprs.push(Expr {

0 commit comments

Comments
 (0)