Commit graph

17405 commits

Author SHA1 Message Date
gifnksm
ffa31d235b libstd: modify wrong shift width.
borrow = *elem << (uint::bits - n_bits);

The code above contains a bug that the value of the right operand of the shift operator exceeds the size of the left operand,
because sizeof(*elem) == 32, and 0 <= n_bits < 32 in 64bit architecture.

If `--opt-level` option is not given to rustc, the code above runs as if the right operand is `(uint::bits - n_bits) % 32`,
but if --opt-level is given, `borrow` is always zero.

I wonder why this bug is not catched in the libstd's testsuite (I try the `rustc --test --opt-level=2 bigint.rs` before fixing the bug,
but the unittest passes normally.)
2013-04-29 13:49:27 +09:00
gifnksm
e4ca2da420 libstd: remove implicit copying of BigInt/BigUint 2013-04-29 13:49:27 +09:00
Tim Chevalier
d045ce7b87 core: Use a better termination condition in os::mkdir_recursive
Instead of checking whether the parent is "." or "/", check the
number of components.

Also, more tests.
2013-04-28 21:25:35 -07:00
Tim Chevalier
379dce11a9 core: Document core::path::GenericPath's trait methods 2013-04-28 20:34:05 -07:00
James Miller
e75203ce82 Adds '--print-link-args' that outputs linker arguments that would be used 2013-04-29 14:54:41 +12:00
bors
7b7a0fc235 auto merge of #6056 : thestinger/rust/iter, r=catamorphism
The existing adaptors like `map` in the `iter` module are very flawed because they only work for `BaseIter` implementations. There are many internal iterator implementations in the standard library like the set methods (`difference`, `symmetric_difference`, `intersection`, `union`) and the `range` functions that only share the `for` loop protocol in common.

The internal iterator adaptors should be implemented to work on any implementation of that protocol, rather than just a method called `each` taking `&self`.

This just moves `iter.rs` to `old_iter.rs` and begins work on documenting and implementing a nicer module.
2013-04-28 19:36:36 -07:00
Daniel Micay
46f91a0fa9 make way for a new iter module 2013-04-28 22:31:39 -04:00
Tim Chevalier
edc11a9f09 rustc: Suppress derived pattern-match-checking errors
typeck::check::_match wasn't suppressing derived errors properly.
Fixed it.
2013-04-28 18:47:55 -07:00
James Miller
00ede34fcb Add --linker option to pass flags to the linker 2013-04-29 13:08:14 +12: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