about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2013-03-26 11:16:22 -0700
committerbors <bors@rust-lang.org>2013-03-26 11:16:22 -0700
commitd96bbb907edf803dc2917b3e69d387f5b6657100 (patch)
treee60d00cf788b5ce64e45ed9215c1627ad823178a
parent7f5d7e1c2e7464916694e55ba4f31bf5b8f9a4f9 (diff)
parent0dc6c414af158370b73bfd379bec84a1a8d480f6 (diff)
downloadrust-d96bbb907edf803dc2917b3e69d387f5b6657100.tar.gz
rust-d96bbb907edf803dc2917b3e69d387f5b6657100.zip
auto merge of #5556 : nikomatsakis/rust/issues-4904-and-4855, r=nikomatsakis
Two small fixes. 

r? @catamorphism
-rw-r--r--src/libcore/unstable/lang.rs8
-rw-r--r--src/librustc/middle/typeck/check/regionck.rs2
2 files changed, 7 insertions, 3 deletions
diff --git a/src/libcore/unstable/lang.rs b/src/libcore/unstable/lang.rs
index 5d7920ce820..554083fcdb5 100644
--- a/src/libcore/unstable/lang.rs
+++ b/src/libcore/unstable/lang.rs
@@ -99,8 +99,12 @@ pub unsafe fn borrow_as_imm(a: *u8) {
 #[lang="return_to_mut"]
 #[inline(always)]
 pub unsafe fn return_to_mut(a: *u8) {
-    let a: *mut BoxRepr = transmute(a);
-    (*a).header.ref_count &= !FROZEN_BIT;
+    // Sometimes the box is null, if it is conditionally frozen.
+    // See e.g. #4904.
+    if !a.is_null() {
+        let a: *mut BoxRepr = transmute(a);
+        (*a).header.ref_count &= !FROZEN_BIT;
+    }
 }
 
 #[lang="check_not_borrowed"]
diff --git a/src/librustc/middle/typeck/check/regionck.rs b/src/librustc/middle/typeck/check/regionck.rs
index 3a02c19dbaf..d6a7e6103b1 100644
--- a/src/librustc/middle/typeck/check/regionck.rs
+++ b/src/librustc/middle/typeck/check/regionck.rs
@@ -615,7 +615,7 @@ pub mod guarantor {
         // expressions, both of which always yield a region variable, so
         // mk_subr should never fail.
         let rptr_ty = rcx.resolve_node_type(id);
-        if !ty::type_is_error(rptr_ty) {
+        if !ty::type_is_error(rptr_ty) && !ty::type_is_bot(rptr_ty) {
             let tcx = rcx.fcx.ccx.tcx;
             debug!("rptr_ty=%s", ty_to_str(tcx, rptr_ty));
             let r = ty::ty_region(tcx, span, rptr_ty);