Skip to content

Commit f7c7bb7

Browse files
committed
Fix for #31267 - associated const related ICE.
1 parent 0f196bc commit f7c7bb7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/librustc_trans/trans/expr.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ pub fn trans_into<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
160160
match expr.node {
161161
hir::ExprPath(..) => {
162162
match bcx.def(expr.id) {
163-
Def::Const(did) => {
163+
Def::Const(did) | Def::AssociatedConst(did) => {
164164
let empty_substs = bcx.tcx().mk_substs(Substs::trans_empty());
165165
let const_expr = consts::get_const_expr(bcx.ccx(), did, expr,
166166
empty_substs);
@@ -896,7 +896,7 @@ fn trans_def<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
896896
let lval = Lvalue::new("expr::trans_def");
897897
DatumBlock::new(bcx, Datum::new(val, const_ty, LvalueExpr(lval)))
898898
}
899-
Def::Const(_) => {
899+
Def::Const(_) | Def::AssociatedConst(_) => {
900900
bcx.sess().span_bug(ref_expr.span,
901901
"constant expression should not reach expr::trans_def")
902902
}

0 commit comments

Comments
 (0)