From 94d20635779d83f4f3267ef8a65b9bf5201dd554 Mon Sep 17 00:00:00 2001 From: Tim Chevalier Date: Thu, 19 Jan 2012 14:28:58 -0800 Subject: Handle log expressions with a _|_-typed level If we have log(foo, quux) where foo:_|_, just translate foo and ignore the rest of the expression. Closes #1459 --- src/comp/middle/trans.rs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/comp') diff --git a/src/comp/middle/trans.rs b/src/comp/middle/trans.rs index 9f75d0d1c77..7435c30c5bf 100644 --- a/src/comp/middle/trans.rs +++ b/src/comp/middle/trans.rs @@ -3700,7 +3700,13 @@ fn load_if_immediate(cx: @block_ctxt, v: ValueRef, t: ty::t) -> ValueRef { fn trans_log(lvl: @ast::expr, cx: @block_ctxt, e: @ast::expr) -> @block_ctxt { let ccx = bcx_ccx(cx); let lcx = cx.fcx.lcx; + let tcx = ccx.tcx; let modname = str::connect(lcx.module_path, "::"); + + if ty::type_is_bot(tcx, ty::expr_ty(tcx, lvl)) { + ret trans_expr(cx, lvl, ignore); + } + let global = if lcx.ccx.module_data.contains_key(modname) { lcx.ccx.module_data.get(modname) } else { -- cgit 1.4.1-3-g733a5