Skip to content

Commit

Permalink
auto merge of #5556 : nikomatsakis/rust/issues-4904-and-4855, r=nikom…
Browse files Browse the repository at this point in the history
…atsakis

Two small fixes. 

r? @catamorphism
  • Loading branch information
bors committed Mar 26, 2013
2 parents 7f5d7e1 + 0dc6c41 commit d96bbb9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions src/libcore/unstable/lang.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/middle/typeck/check/regionck.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit d96bbb9

Please sign in to comment.