From 7c7980196c35023631500ef1e44e4833f60a6c64 Mon Sep 17 00:00:00 2001 From: Josh Matthews Date: Sun, 21 Oct 2012 03:42:53 -0400 Subject: [PATCH] Fix ICE stemming from use of unique pointers in unreachable blocks. --- src/rustc/middle/trans/base.rs | 2 +- src/test/run-fail/doublefail.rs | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 src/test/run-fail/doublefail.rs diff --git a/src/rustc/middle/trans/base.rs b/src/rustc/middle/trans/base.rs index 4c9a006007e..d0fe4dec687 100644 --- a/src/rustc/middle/trans/base.rs +++ b/src/rustc/middle/trans/base.rs @@ -267,7 +267,7 @@ fn malloc_raw_dyn(bcx: block, t: ty::t, heap: heap, fn non_gc_box_cast(bcx: block, val: ValueRef) -> ValueRef { debug!("non_gc_box_cast"); add_comment(bcx, ~"non_gc_box_cast"); - assert(llvm::LLVMGetPointerAddressSpace(val_ty(val)) == gc_box_addrspace); + assert(llvm::LLVMGetPointerAddressSpace(val_ty(val)) == gc_box_addrspace || bcx.unreachable); let non_gc_t = T_ptr(llvm::LLVMGetElementType(val_ty(val))); PointerCast(bcx, val, non_gc_t) } diff --git a/src/test/run-fail/doublefail.rs b/src/test/run-fail/doublefail.rs new file mode 100644 index 00000000000..37beb7b895e --- /dev/null +++ b/src/test/run-fail/doublefail.rs @@ -0,0 +1,5 @@ +//error-pattern:One +fn main() { + fail ~"One"; + fail ~"Two"; +} \ No newline at end of file