Skip to content

Commit 459fcb6

Browse files
committed
---
yaml --- r: 59279 b: refs/heads/snap-stage3 c: d9c7d0b h: refs/heads/master i: 59277: 4bd0027 59275: c29e2b6 59271: 16648a8 59263: bbe4bb3 v: v3
1 parent c7c7efd commit 459fcb6

File tree

17 files changed

+35
-110
lines changed

17 files changed

+35
-110
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: c081ffbd1e845687202a975ea2e698b623e5722f
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 2e3e0c0892d6fc9d20374d31db994eee4d083366
4+
refs/heads/snap-stage3: d9c7d0bc938dd7a1d14e0d86fa0df439faa1ed3f
55
refs/heads/try: c50a9d5b664478e533ba1d1d353213d70c8ad589
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/src/libcore/bool.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,6 @@ mod tests {
108108

109109
#[test]
110110
fn test_bool_from_str() {
111-
use from_str::FromStr;
112-
113111
do all_values |v| {
114112
assert!(Some(v) == FromStr::from_str(to_str(v)))
115113
}

branches/snap-stage3/src/libcore/cast.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010

1111
//! Unsafe casting functions
1212
13+
#[cfg(not(stage0))]
1314
use sys;
15+
#[cfg(not(stage0))]
1416
use unstable;
1517

1618
pub mod rusti {

branches/snap-stage3/src/libcore/core.rc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ pub use num::{Bitwise, BitCount, Bounded};
111111
pub use num::{Primitive, Int, Float};
112112

113113
pub use ptr::Ptr;
114+
pub use from_str::FromStr;
114115
pub use to_str::ToStr;
115116
pub use clone::Clone;
116117

branches/snap-stage3/src/libcore/flate.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ Simple compression
1616

1717
use libc;
1818
use libc::{c_void, size_t, c_int};
19-
use ptr;
2019
use vec;
2120

2221
#[cfg(test)] use rand;

branches/snap-stage3/src/libcore/num/f32.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
//! Operations and constants for `f32`
1212
13-
use from_str;
1413
use num::{Zero, One, strconv};
1514
use prelude::*;
1615

@@ -798,7 +797,7 @@ pub fn from_str_radix(num: &str, rdx: uint) -> Option<f32> {
798797
strconv::ExpNone, false, false)
799798
}
800799
801-
impl from_str::FromStr for f32 {
800+
impl FromStr for f32 {
802801
#[inline(always)]
803802
fn from_str(val: &str) -> Option<f32> { from_str(val) }
804803
}

branches/snap-stage3/src/libcore/num/f64.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
//! Operations and constants for `f64`
1212
13-
use from_str;
1413
use libc::c_int;
1514
use num::{Zero, One, strconv};
1615
use prelude::*;
@@ -840,7 +839,7 @@ pub fn from_str_radix(num: &str, rdx: uint) -> Option<f64> {
840839
strconv::ExpNone, false, false)
841840
}
842841
843-
impl from_str::FromStr for f64 {
842+
impl FromStr for f64 {
844843
#[inline(always)]
845844
fn from_str(val: &str) -> Option<f64> { from_str(val) }
846845
}

branches/snap-stage3/src/libcore/num/float.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020

2121
// PORT this must match in width according to architecture
2222

23-
use from_str;
2423
use libc::c_int;
2524
use num::{Zero, One, strconv};
2625
use prelude::*;
@@ -289,7 +288,7 @@ pub fn from_str_radix(num: &str, radix: uint) -> Option<float> {
289288
strconv::ExpNone, false, false)
290289
}
291290
292-
impl from_str::FromStr for float {
291+
impl FromStr for float {
293292
#[inline(always)]
294293
fn from_str(val: &str) -> Option<float> { from_str(val) }
295294
}

branches/snap-stage3/src/libcore/num/int-template.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
use T = self::inst::T;
1212

13-
use from_str::FromStr;
1413
use num::{ToStrRadix, FromStrRadix};
1514
use num::{Zero, One, strconv};
1615
use prelude::*;

branches/snap-stage3/src/libcore/num/uint-template.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
use T = self::inst::T;
1212
use T_SIGNED = self::inst::T_SIGNED;
1313

14-
use from_str::FromStr;
1514
use num::{ToStrRadix, FromStrRadix};
1615
use num::{Zero, One, strconv};
1716
use prelude::*;

branches/snap-stage3/src/libcore/pipes.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ struct BufferResource<T> {
303303
}
304304
305305
#[unsafe_destructor]
306-
impl<T> ::ops::Drop for BufferResource<T> {
306+
impl<T> Drop for BufferResource<T> {
307307
fn finalize(&self) {
308308
unsafe {
309309
let b = move_it!(self.buffer);
@@ -639,7 +639,7 @@ pub struct SendPacketBuffered<T, Tbuffer> {
639639
}
640640
641641
#[unsafe_destructor]
642-
impl<T:Owned,Tbuffer:Owned> ::ops::Drop for SendPacketBuffered<T,Tbuffer> {
642+
impl<T:Owned,Tbuffer:Owned> Drop for SendPacketBuffered<T,Tbuffer> {
643643
fn finalize(&self) {
644644
//if self.p != none {
645645
// debug!("drop send %?", option::get(self.p));
@@ -708,7 +708,7 @@ pub struct RecvPacketBuffered<T, Tbuffer> {
708708
}
709709
710710
#[unsafe_destructor]
711-
impl<T:Owned,Tbuffer:Owned> ::ops::Drop for RecvPacketBuffered<T,Tbuffer> {
711+
impl<T:Owned,Tbuffer:Owned> Drop for RecvPacketBuffered<T,Tbuffer> {
712712
fn finalize(&self) {
713713
//if self.p != none {
714714
// debug!("drop recv %?", option::get(self.p));

branches/snap-stage3/src/libcore/prelude.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ pub use path::WindowsPath;
5151
pub use ptr::Ptr;
5252
pub use ascii::{Ascii, AsciiCast, OwnedAsciiCast, AsciiStr};
5353
pub use str::{StrSlice, OwnedStr};
54+
pub use from_str::{FromStr};
5455
pub use to_bytes::IterBytes;
5556
pub use to_str::{ToStr, ToStrConsume};
5657
pub use tuple::{CopyableTuple, ImmutableTuple, ExtendedTupleOps};

branches/snap-stage3/src/librustc/middle/ty.rs

Lines changed: 9 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -1808,15 +1808,6 @@ pub impl TypeContents {
18081808
if cx.vecs_implicitly_copyable {base} else {base + TC_OWNED_VEC}
18091809
}
18101810
1811-
fn is_safe_for_default_mode(&self, cx: ctxt) -> bool {
1812-
!self.intersects(TypeContents::nondefault_mode(cx))
1813-
}
1814-
1815-
fn nondefault_mode(cx: ctxt) -> TypeContents {
1816-
let tc = TypeContents::nonimplicitly_copyable(cx);
1817-
tc + TC_BIG + TC_OWNED_VEC // disregard cx.vecs_implicitly_copyable
1818-
}
1819-
18201811
fn needs_drop(&self, cx: ctxt) -> bool {
18211812
let tc = TC_MANAGED + TC_DTOR + TypeContents::owned(cx);
18221813
self.intersects(tc)
@@ -1876,9 +1867,6 @@ static TC_MUTABLE: TypeContents = TypeContents{bits:0b000010000000};
18761867
/// Mutable content, whether owned or by ref
18771868
static TC_ONCE_CLOSURE: TypeContents = TypeContents{bits:0b000100000000};
18781869
1879-
/// Something we estimate to be "big"
1880-
static TC_BIG: TypeContents = TypeContents{bits:0b001000000000};
1881-
18821870
/// An enum with no variants.
18831871
static TC_EMPTY_ENUM: TypeContents = TypeContents{bits:0b010000000000};
18841872
@@ -2099,10 +2087,6 @@ pub fn type_contents(cx: ctxt, ty: t) -> TypeContents {
20992087
}
21002088
};
21012089
2102-
if type_size(cx, ty) > 4 {
2103-
result = result + TC_BIG;
2104-
}
2105-
21062090
cache.insert(ty_id, result);
21072091
return result;
21082092
}
@@ -2178,68 +2162,6 @@ pub fn type_contents(cx: ctxt, ty: t) -> TypeContents {
21782162
debug!("result = %s", r.to_str());
21792163
return r;
21802164
}
2181-
2182-
/// gives a rough estimate of how much space it takes to represent
2183-
/// an instance of `ty`. Used for the mode transition.
2184-
fn type_size(cx: ctxt, ty: t) -> uint {
2185-
match get(ty).sty {
2186-
ty_nil | ty_bot | ty_bool | ty_int(_) | ty_uint(_) | ty_float(_) |
2187-
ty_ptr(_) | ty_box(_) | ty_uniq(_) | ty_estr(vstore_uniq) |
2188-
ty_trait(*) | ty_rptr(*) | ty_evec(_, vstore_uniq) |
2189-
ty_evec(_, vstore_box) | ty_estr(vstore_box) => {
2190-
1
2191-
}
2192-
2193-
ty_evec(_, vstore_slice(_)) |
2194-
ty_estr(vstore_slice(_)) |
2195-
ty_bare_fn(*) |
2196-
ty_closure(*) => {
2197-
2
2198-
}
2199-
2200-
ty_evec(t, vstore_fixed(n)) => {
2201-
type_size(cx, t.ty) * n
2202-
}
2203-
2204-
ty_estr(vstore_fixed(n)) => {
2205-
n
2206-
}
2207-
2208-
ty_struct(did, ref substs) => {
2209-
let flds = struct_fields(cx, did, substs);
2210-
flds.foldl(0, |s, f| *s + type_size(cx, f.mt.ty))
2211-
}
2212-
2213-
ty_tup(ref tys) => {
2214-
tys.foldl(0, |s, t| *s + type_size(cx, *t))
2215-
}
2216-
2217-
ty_enum(did, ref substs) => {
2218-
let variants = substd_enum_variants(cx, did, substs);
2219-
variants.foldl( // find max size of any variant
2220-
0,
2221-
|m, v| uint::max(
2222-
*m,
2223-
// find size of this variant:
2224-
v.args.foldl(0, |s, a| *s + type_size(cx, *a))))
2225-
}
2226-
2227-
ty_param(_) | ty_self(_) => {
2228-
1
2229-
}
2230-
2231-
ty_infer(_) => {
2232-
cx.sess.bug(~"Asked to compute kind of a type variable");
2233-
}
2234-
ty_type => 1,
2235-
ty_opaque_closure_ptr(_) => 1,
2236-
ty_opaque_box => 1,
2237-
ty_unboxed_vec(_) => 10,
2238-
ty_err => {
2239-
cx.sess.bug(~"Asked to compute kind of fictitious type");
2240-
}
2241-
}
2242-
}
22432165
}
22442166
22452167
pub fn type_moves_by_default(cx: ctxt, ty: t) -> bool {
@@ -2499,12 +2421,15 @@ pub fn type_is_enum(ty: t) -> bool {
24992421
// constructors
25002422
pub fn type_is_c_like_enum(cx: ctxt, ty: t) -> bool {
25012423
match get(ty).sty {
2502-
ty_enum(did, _) => {
2503-
let variants = enum_variants(cx, did);
2504-
let some_n_ary = vec::any(*variants, |v| vec::len(v.args) > 0u);
2505-
return !some_n_ary;
2506-
}
2507-
_ => return false
2424+
ty_enum(did, _) => {
2425+
let variants = enum_variants(cx, did);
2426+
if variants.len() == 0 {
2427+
false
2428+
} else {
2429+
variants.all(|v| v.args.len() == 0)
2430+
}
2431+
}
2432+
_ => false
25082433
}
25092434
}
25102435

branches/snap-stage3/src/libstd/net_url.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,11 @@
1313
#[allow(deprecated_mode)];
1414

1515
use core::cmp::Eq;
16-
use core::from_str::FromStr;
1716
use core::io::{Reader, ReaderUtil};
1817
use core::io;
1918
use core::hashmap::HashMap;
2019
use core::str;
21-
use core::to_bytes::IterBytes;
2220
use core::to_bytes;
23-
use core::to_str::ToStr;
24-
use core::to_str;
2521
use core::uint;
2622

2723
#[deriving(Clone, Eq)]
@@ -703,13 +699,13 @@ pub fn to_str(url: &Url) -> ~str {
703699
fmt!("%s:%s%s%s%s", url.scheme, authority, url.path, query, fragment)
704700
}
705701

706-
impl to_str::ToStr for Url {
702+
impl ToStr for Url {
707703
pub fn to_str(&self) -> ~str {
708704
to_str(self)
709705
}
710706
}
711707

712-
impl to_bytes::IterBytes for Url {
708+
impl IterBytes for Url {
713709
fn iter_bytes(&self, lsb0: bool, f: to_bytes::Cb) {
714710
self.to_str().iter_bytes(lsb0, f)
715711
}

branches/snap-stage3/src/libstd/num/bigint.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ A BigInt is a combination of BigUint and Sign.
2121

2222
use core::cmp::{Eq, Ord, TotalEq, TotalOrd, Ordering, Less, Equal, Greater};
2323
use core::num::{IntConvertible, Zero, One, ToStrRadix, FromStrRadix};
24-
use core::*;
2524

2625
/**
2726
A BigDigit is a BigUint's composing element.
@@ -141,7 +140,7 @@ impl ToStr for BigUint {
141140
fn to_str(&self) -> ~str { self.to_str_radix(10) }
142141
}
143142

144-
impl from_str::FromStr for BigUint {
143+
impl FromStr for BigUint {
145144
#[inline(always)]
146145
fn from_str(s: &str) -> Option<BigUint> {
147146
FromStrRadix::from_str_radix(s, 10)
@@ -785,7 +784,7 @@ impl ToStr for BigInt {
785784
fn to_str(&self) -> ~str { self.to_str_radix(10) }
786785
}
787786

788-
impl from_str::FromStr for BigInt {
787+
impl FromStr for BigInt {
789788
#[inline(always)]
790789
fn from_str(s: &str) -> Option<BigInt> {
791790
FromStrRadix::from_str_radix(s, 10)

branches/snap-stage3/src/libsyntax/ext/fmt.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,13 +273,15 @@ fn pieces_to_expr(cx: @ext_ctxt, sp: span,
273273
match pc {
274274
/* Raw strings get appended via str::push_str */
275275
PieceString(s) => {
276+
let portion = mk_uniq_str(cx, fmt_sp, s);
277+
276278
/* If this is the first portion, then initialize the local
277279
buffer with it directly. If it's actually the only piece,
278280
then there's no need for it to be mutable */
279281
if i == 0 {
280-
stms.push(mk_local(cx, fmt_sp, npieces > 1, ident, mk_uniq_str(cx, fmt_sp, s)));
282+
stms.push(mk_local(cx, fmt_sp, npieces > 1, ident, portion));
281283
} else {
282-
let args = ~[mk_mut_addr_of(cx, fmt_sp, buf()), mk_base_str(cx, fmt_sp, s)];
284+
let args = ~[mk_mut_addr_of(cx, fmt_sp, buf()), portion];
283285
let call = mk_call_global(cx,
284286
fmt_sp,
285287
~[str_ident, push_ident],
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
enum E {}
2+
3+
fn f(e: E) {
4+
println((e as int).to_str()); //~ ERROR non-scalar cast
5+
}
6+
7+
fn main() {}

0 commit comments

Comments
 (0)