Skip to content

Commit 432d53a

Browse files
committed
---
yaml --- r: 49575 b: refs/heads/master c: 624a685 h: refs/heads/master i: 49573: 890ef27 49571: c6bda98 49567: 82b04cb v: v3
1 parent 99eca51 commit 432d53a

File tree

6 files changed

+22
-30
lines changed

6 files changed

+22
-30
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 74fb263f7a8d385635e0861593ce6d72d0e5ec10
2+
refs/heads/master: 624a685283f66afcb40ee3c235624aedebc2f08f
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: f7a2371c176663d59062ec5158f39faecba45768
55
refs/heads/try: 2a8fb58d79e685d5ca07b039badcf2ae3ef077ea

trunk/src/libcore/num/strconv.rs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,13 @@ impl_NumStrConv_Integer!(u16)
130130
impl_NumStrConv_Integer!(u32)
131131
impl_NumStrConv_Integer!(u64)
132132

133+
134+
// Special value strings as [u8] consts.
135+
const inf_buf: [u8*3] = ['i' as u8, 'n' as u8, 'f' as u8];
136+
const positive_inf_buf: [u8*4] = ['+' as u8, 'i' as u8, 'n' as u8, 'f' as u8];
137+
const negative_inf_buf: [u8*4] = ['-' as u8, 'i' as u8, 'n' as u8, 'f' as u8];
138+
const nan_buf: [u8*3] = ['N' as u8, 'a' as u8, 'N' as u8];
139+
133140
/**
134141
* Converts a number to its string representation as a byte vector.
135142
* This is meant to be a common base implementation for all numeric string
@@ -479,15 +486,15 @@ pub fn from_str_bytes_common<T:NumCast+Zero+One+Ord+Copy+Div<T,T>+
479486
}
480487

481488
if special {
482-
if buf == str::inf_buf || buf == str::positive_inf_buf {
489+
if buf == inf_buf || buf == positive_inf_buf {
483490
return NumStrConv::inf();
484-
} else if buf == str::negative_inf_buf {
491+
} else if buf == negative_inf_buf {
485492
if negative {
486493
return NumStrConv::neg_inf();
487494
} else {
488495
return None;
489496
}
490-
} else if buf == str::nan_buf {
497+
} else if buf == nan_buf {
491498
return NumStrConv::NaN();
492499
}
493500
}

trunk/src/libcore/str.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1919,14 +1919,6 @@ static tag_five_b: uint = 248u;
19191919
static max_five_b: uint = 67108864u;
19201920
static tag_six_b: uint = 252u;
19211921

1922-
// Constants used for converting strs to floats
1923-
pub static inf_buf: [u8*3] = ['i' as u8, 'n' as u8, 'f' as u8];
1924-
pub static positive_inf_buf: [u8*4] = ['+' as u8, 'i' as u8,
1925-
'n' as u8, 'f' as u8];
1926-
pub static negative_inf_buf: [u8*4] = ['-' as u8, 'i' as u8,
1927-
'n' as u8, 'f' as u8];
1928-
pub static nan_buf: [u8*3] = ['N' as u8, 'a' as u8, 'N' as u8];
1929-
19301922
/**
19311923
* Work with the byte buffer of a string.
19321924
*

trunk/src/librustc/middle/borrowck/gather_loans.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ fn req_loans_in_expr(ex: @ast::expr,
145145

146146
// make sure that the thing we are pointing out stays valid
147147
// for the lifetime `scope_r` of the resulting ptr:
148-
let scope_r = ty_region(tcx, ex.span, tcx.ty(ex));
148+
let scope_r = ty_region(tcx.ty(ex));
149149
self.guarantee_valid(base_cmt, mutbl, scope_r);
150150
visit::visit_expr(ex, self, vt);
151151
}
@@ -599,8 +599,7 @@ pub impl GatherLoanCtxt {
599599
// find the region of the resulting pointer (note that
600600
// the type of such a pattern will *always* be a
601601
// region pointer)
602-
let scope_r = ty_region(self.tcx(), pat.span,
603-
self.tcx().ty(pat));
602+
let scope_r = ty_region(self.tcx().ty(pat));
604603

605604
// if the scope of the region ptr turns out to be
606605
// specific to this arm, wrap the categorization with

trunk/src/librustc/middle/ty.rs

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2794,18 +2794,13 @@ pub fn ty_vstore(ty: t) -> vstore {
27942794
}
27952795
}
27962796

2797-
pub fn ty_region(tcx: ctxt,
2798-
span: span,
2799-
ty: t) -> Region {
2797+
pub fn ty_region(ty: t) -> Region {
28002798
match get(ty).sty {
2801-
ty_rptr(r, _) => r,
2802-
ty_evec(_, vstore_slice(r)) => r,
2803-
ty_estr(vstore_slice(r)) => r,
2804-
ref s => {
2805-
tcx.sess.span_bug(
2806-
span,
2807-
fmt!("ty_region() invoked on in appropriate ty: %?", s));
2808-
}
2799+
ty_rptr(r, _) => r,
2800+
ty_evec(_, vstore_slice(r)) => r,
2801+
ty_estr(vstore_slice(r)) => r,
2802+
ref s => fail!(fmt!("ty_region() invoked on in appropriate ty: %?",
2803+
(*s)))
28092804
}
28102805
}
28112806

trunk/src/librustc/middle/typeck/check/regionck.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -616,9 +616,8 @@ pub mod guarantor {
616616
// mk_subr should never fail.
617617
let rptr_ty = rcx.resolve_node_type(id);
618618
if !ty::type_is_error(rptr_ty) {
619-
let tcx = rcx.fcx.ccx.tcx;
620-
debug!("rptr_ty=%s", ty_to_str(tcx, rptr_ty));
621-
let r = ty::ty_region(tcx, span, rptr_ty);
619+
debug!("rptr_ty=%s", ty_to_str(rcx.fcx.ccx.tcx, rptr_ty));
620+
let r = ty::ty_region(rptr_ty);
622621
infallibly_mk_subr(rcx, true, span, r, bound);
623622
}
624623
}
@@ -891,7 +890,7 @@ pub mod guarantor {
891890
ast::pat_region(p) => {
892891
let rptr_ty = rcx.resolve_node_type(pat.id);
893892
if !ty::type_is_error(rptr_ty) {
894-
let r = ty::ty_region(rcx.fcx.tcx(), pat.span, rptr_ty);
893+
let r = ty::ty_region(rptr_ty);
895894
link_ref_bindings_in_pat(rcx, p, Some(r));
896895
}
897896
}

0 commit comments

Comments
 (0)