Skip to content

Commit

Permalink
use correct substs in enum discriminant hack
Browse files Browse the repository at this point in the history
  • Loading branch information
b-naber committed Jun 24, 2022
1 parent 4c4fb71 commit 2e3221a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion compiler/rustc_mir_build/src/thir/cx/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -650,6 +650,9 @@ impl<'tcx> Cx<'tcx> {
} else {
None
};
debug!(?var);
let substs = self.typeck_results.node_substs(source.hir_id);
debug!(?substs);

let source = if let Some((did, offset, var_ty)) = var {
let param_env_ty = self.param_env.and(var_ty);
Expand All @@ -671,7 +674,7 @@ impl<'tcx> Cx<'tcx> {
Some(did) => {
// in case we are offsetting from a computed discriminant
// and not the beginning of discriminants (which is always `0`)
let substs = InternalSubsts::identity_for_item(tcx, did);

let kind =
ExprKind::NamedConst { def_id: did, substs, user_ty: None };
let lhs = self.thir.exprs.push(Expr {
Expand Down

0 comments on commit 2e3221a

Please sign in to comment.