Commit Graph

17397 Commits

Author SHA1 Message Date
Daniel Micay
46f91a0fa9 make way for a new iter module 2013-04-28 22:31:39 -04:00
bors
9f03d45c56 auto merge of #5646 : Aatch/rust/unwind-fix, r=brson
This fixes issue #5641
2013-04-28 15:36:35 -07:00
bors
1f9823375b auto merge of #6092 : gifnksm/rust/impl-integer-bigint, r=graydon
This is a follow-up commit for #6041 (and depending on #6048).
Also adding `#[inline(always)]` for almost every methods in `std::bigint`.
2013-04-28 12:51:35 -07:00
Dan Luu
e9814da3c0 Updated spawn / loop thread to work with current syntax 2013-04-28 15:33:41 -04:00
Dan Luu
212d77efcc Remove test for any type -> match type, which doesn't seem to exist anymore 2013-04-28 15:02:15 -04:00
Dan Luu
9968ccfc30 Update old xfailing spawn/bind/join test 2013-04-28 14:50:04 -04:00
John Clements
41af279233 parser comments 2013-04-28 09:51:16 -07:00
John Clements
2985f74ff3 s/one_tuple/trailing_comma (more accurate name) 2013-04-28 09:51:16 -07:00
John Clements
aa346401ba removed unneeded argument to parse_record 2013-04-28 09:51:16 -07:00
John Clements
d2aee7b3e6 s/parse_purity/parse_unsafety 2013-04-28 09:51:16 -07:00
John Clements
1abc1be81a remove 3-line used-once function 2013-04-28 09:51:16 -07:00
John Clements
7ef92ba246 rename parse_instance_var to parse_name_and_ty
the name no longer made sense. perhaps this could just be inlined.
2013-04-28 09:51:15 -07:00
John Clements
2a74c58588 remove obsolete semicolon from list of suggestions 2013-04-28 09:51:15 -07:00
John Clements
915e76a974 rename parse_single_class_item as well 2013-04-28 09:51:15 -07:00
John Clements
968089e422 rename parse_class_item to parse_struct_decl_field
two problems with the old name: they're not called classes any more, and
the word "item" has a specific connotation in the parser
2013-04-28 09:51:15 -07:00
John Clements
b82724db22 needs_comma was always true 2013-04-28 09:51:15 -07:00
John Clements
703390150a fix for parsing x() as identifier pattern 2013-04-28 09:51:15 -07:00
John Clements
5119597dc6 hard to read the implied double negative 2013-04-28 09:51:15 -07:00
John Clements
3c10a9412e remove unused functions, fix tiny lexing bug
before this change, the parser would parse 14.a() as a method call, but
would parse 14.ø() as the floating-point number 14. followed by a function
call. This is because it was checking is_alpha, rather than ident_start,
and was therefore wrong with respect to unicode.
2013-04-28 09:51:15 -07:00
John Clements
5411cbf656 remove unused flag to parse_local fn 2013-04-28 09:51:14 -07:00
John Clements
63397b8519 remove unused RESTRICT_NO_CALL_EXPRS restriction 2013-04-28 09:51:14 -07:00
John Clements
2733a1f14b undo abstraction over whether to parse attrs in a block
In principle, it seems like a nice idea to abstract over the two
functions that parse blocks (one with inner attrs allowed, one not).
However, the existing one wound up making things more complex than
just having two separate functions, especially after the obsolete
syntax is (will be) removed.
2013-04-28 09:51:14 -07:00
John Clements
ab03c1e422 refactoring to split foreign_items from items 2013-04-28 09:51:14 -07:00
John Clements
fa5ba17c89 parser comments
parser comments
2013-04-28 09:51:14 -07:00
John Clements
1b4ced8bcb get rid of prec.rs
prec.rs no longer had much to do with precedence; the token->binop
function fits better in token.rs, and the one-liner defining the
precedence of 'as' can go next to the other precedence stuff in
ast_util.rs
2013-04-28 09:51:14 -07:00
John Clements
9f8d30a128 reindent in parser 2013-04-28 09:49:21 -07:00
John Clements
a818648aa9 remove unnecessary function 2013-04-28 09:49:20 -07:00
John Clements
71c0bd5c5d simplify, based on invariant that items_allowed != foreign_items_allowed 2013-04-28 09:49:20 -07:00
John Clements
ae4e09f71a adding parse_path 2013-04-28 09:49:20 -07:00
John Clements
28b285764c comments, helper function for tests, more informative error message 2013-04-28 09:49:20 -07:00
John Clements
50a7f5483b refactor parse_fn_decl 2013-04-28 09:49:20 -07:00
John Clements
2b7f1a4f24 parser comments only 2013-04-28 09:49:20 -07:00
John Clements
c73a9c9cd0 refactoring mod.rs 2013-04-28 09:49:20 -07:00
John Clements
a2493ad048 change stage1,stage2,stage2 into not(stage0)
With luck, this will allow rust to compile itself without --cfg flags again...
2013-04-28 09:49:20 -07:00
bors
cdd342bd34 auto merge of #6097 : Blei/rust/fix-rand, r=pnkfelix
`self` has type `&@Rand`, so `*self` will be of type `@Rand` which causes
this same impl to be called again.

Fixes #6061
2013-04-28 04:48:35 -07:00
Philipp Brüschweiler
8627fc9726 rand: Fix infinite recursion
`self` has type `&@Rand`, so `*self` will be of type `@Rand` which causes
this same impl to be called again.
2013-04-28 13:31:49 +02:00
bors
5f7947aa52 auto merge of #6075 : thestinger/rust/no-no_core, r=brson
core injection works fine now
2013-04-27 19:18:33 -07:00
gifnksm
92f0dc6b4b libstd: inlining almost every methods in bigint module. 2013-04-28 10:59:58 +09:00
gifnksm
01b3490a55 libstd: impl Integer for BigUint/BigInt.
Also remove abs() method from the non-trait impl for BigInt/BigUint.
That method is provided in the Signed trait.
2013-04-28 10:59:58 +09:00
Daniel Micay
f792baba42 only use #[no_core] in libcore 2013-04-27 21:34:24 -04:00
bors
dd5b1de181 auto merge of #6082 : catamorphism/rust/mkdir_recursive, r=brson
r? @brson mkdir_recursive creates a directory as well as any of its
parent directories that don't exist already. Seems like a useful
thing to have in core.

(Or r? anyone who gets to it first.)
2013-04-27 17:24:33 -07:00
bors
88dd53a754 auto merge of #6081 : brson/rust/out-of-stack, r=thestinger
People hit the recursion depth limit too often, it's not possible
to unwind reliably from out-of-stack.

Issues #3555, #3695
2013-04-27 16:24:34 -07:00
bors
9f118865a2 auto merge of #6072 : cmr/rust/better_import_error, r=graydon 2013-04-27 14:24:36 -07:00
bors
aa38867e4e auto merge of #6071 : bjz/rust/numeric-traits, r=graydon
As part of the numeric trait reform (see issue #4819), I have added the following traits to `core::num` and implemented them for Rust's primitive numeric types:

~~~rust
pub trait Bitwise: Not<Self>
                 + BitAnd<Self,Self>
                 + BitOr<Self,Self>
                 + BitXor<Self,Self>
                 + Shl<Self,Self>
                 + Shr<Self,Self> {}

pub trait BitCount {
    fn population_count(&self) -> Self;
    fn leading_zeros(&self) -> Self;
    fn trailing_zeros(&self) -> Self;
}

pub trait Bounded {
    fn min_value() -> Self;
    fn max_value() -> Self;
}

pub trait Primitive: Num
                   + NumCast
                   + Bounded
                   + Neg<Self>
                   + Add<Self,Self>
                   + Sub<Self,Self>
                   + Mul<Self,Self>
                   + Quot<Self,Self>
                   + Rem<Self,Self> {
    fn bits() -> uint;
    fn bytes() -> uint;
}

pub trait Int: Integer
             + Primitive
             + Bitwise
             + BitCount {}

pub trait Float: Real
               + Signed
               + Primitive {
    fn NaN() -> Self;
    fn infinity() -> Self;
    fn neg_infinity() -> Self;
    fn neg_zero() -> Self;

    fn is_NaN(&self) -> bool;
    fn is_infinite(&self) -> bool;
    fn is_finite(&self) -> bool;

    fn mantissa_digits() -> uint;
    fn digits() -> uint;
    fn epsilon() -> Self;
    fn min_exp() -> int;
    fn max_exp() -> int;
    fn min_10_exp() -> int;
    fn max_10_exp() -> int;

    fn mul_add(&self, a: Self, b: Self) -> Self;
    fn next_after(&self, other: Self) -> Self;
}
~~~
Note: I'm not sure my implementation for `BitCount::trailing_zeros` and `BitCount::leading_zeros` is correct for uints. I also need some assistance creating appropriate unit tests for them.

More work needs to be done in implementing specialized primitive floating-point and integer methods, but I'm beginning to reach the limits of my knowledge. Please leave your suggestions/critiques/ideas on #4819 if you have them – I'd very much appreciate hearing them.

I have also added an `Orderable` trait:

~~~rust
pub trait Orderable: Ord {
    fn min(&self, other: &Self) -> Self;
    fn max(&self, other: &Self) -> Self;
    fn clamp(&self, mn: &Self, mx: &Self) -> Self;
}
~~~

This is a temporary trait until we have default methods. We don't want to encumber all implementors of Ord by requiring them to implement these functions, but at the same time we want to be able to take advantage of the speed of the specific numeric functions (like the `fmin` and `fmax` intrinsics).
2013-04-27 13:09:35 -07:00
bors
5de74f3e75 auto merge of #6070 : thestinger/rust/tutorial, r=pcwalton 2013-04-27 12:09:35 -07:00
bors
9ea32a380d auto merge of #6066 : djui/rust/patch-1, r=graydon 2013-04-27 10:24:35 -07:00
bors
47dbcdc455 auto merge of #6064 : thestinger/rust/char, r=catamorphism 2013-04-27 09:27:36 -07:00
bors
46806b7ae0 auto merge of #6059 : Kimundi/rust/nice-fail, r=pcwalton
r? @brson

Unwinding through macros now happens as a call to the trait function `FailWithCause::fail_with()`, which consumes self, allowing to use a more generic failure object in the future.
2013-04-26 22:45:36 -07:00
bors
8804b13bd2 auto merge of #6058 : huonw/rust/rt-isaac-update, r=graydon
The "unsigned 4 byte" `ub4`s are actually 8 bytes on 64-bit platforms
which mean that some bits > 2**32 were retained in calculations, these
would then "reappear" after a right shift and so the stream of random numbers
would differ on 32 bit vs 64 bit platforms.

http://burtleburtle.net/bob/c/randport.c
2013-04-26 21:57:35 -07:00
Brendan Zabarauskas
9cdf402c80 Propagate NaNs for Orderable methods impled on floating-point primitives 2013-04-27 13:13:28 +10:00