Skip to content

Commit 293b577

Browse files
committed
Add missing case for pointer -> int when translating constant cast expressions
Closes issue rust-lang#17458
1 parent 0c66796 commit 293b577

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/librustc/middle/trans/consts.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -547,6 +547,9 @@ fn const_expr_unadjusted(cx: &CrateContext, e: &ast::Expr,
547547
(expr::cast_integral, expr::cast_pointer) => {
548548
llvm::LLVMConstIntToPtr(v, llty.to_ref())
549549
}
550+
(expr::cast_pointer, expr::cast_integral) => {
551+
llvm::LLVMConstPtrToInt(v, llty.to_ref())
552+
}
550553
_ => {
551554
cx.sess().impossible_case(e.span,
552555
"bad combination of types for cast")

0 commit comments

Comments
 (0)