auto merge of #5556 : nikomatsakis/rust/issues-4904-and-4855, r=nikomatsakis

Two small fixes. 

r? @catamorphism
This commit is contained in:
bors 2013-03-26 11:16:22 -07:00
commit d96bbb907e
2 changed files with 7 additions and 3 deletions

View File

@ -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"]

View File

@ -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);