Commit Graph

17561 Commits

Author SHA1 Message Date
Patrick Walton
0780b2830f librustc: Remove the legacy mode in the type visitor intrinsic. 2013-04-29 14:30:53 -07:00
Patrick Walton
c6a9e28842 librustc: Rename reinterpret_cast to transmute_copy and remove the intrinsic 2013-04-29 14:30:53 -07:00
Patrick Walton
b6277f8140 librustc: Implement reinterpret_cast in terms of transmute. 2013-04-29 14:30:53 -07:00
Patrick Walton
b0522a497c librustc: Remove ptr::addr_of. 2013-04-29 14:30:53 -07:00
Tim Chevalier
58791c2fd8 Revert "libcore: remove unnecessary deref"
This reverts commit 9860fe10a1.
2013-04-29 14:30:52 -07:00
bors
dbcc3fe63a auto merge of #6110 : bjz/rust/numeric-traits, r=pcwalton
As discussed on issue #4819, I have created four new traits: `Algebraic`, `Trigonometric`, `Exponential` and `Hyperbolic`, and moved the appropriate methods into them from `Real`.

~~~rust
pub trait Algebraic {
    fn pow(&self, n: Self) -> Self;
    fn sqrt(&self) -> Self;
    fn rsqrt(&self) -> Self;
    fn cbrt(&self) -> Self;
    fn hypot(&self, other: Self) -> Self;
}

pub trait Trigonometric {
    fn sin(&self) -> Self;
    fn cos(&self) -> Self;
    fn tan(&self) -> Self;
    fn asin(&self) -> Self;
    fn acos(&self) -> Self;
    fn atan(&self) -> Self;
    fn atan2(&self, other: Self) -> Self;
}

pub trait Exponential {
    fn exp(&self) -> Self;
    fn exp2(&self) -> Self;
    fn expm1(&self) -> Self;
    fn log(&self) -> Self;
    fn log2(&self) -> Self;
    fn log10(&self) -> Self;
}

pub trait Hyperbolic: Exponential {
    fn sinh(&self) -> Self;
    fn cosh(&self) -> Self;
    fn tanh(&self) -> Self;
}
~~~

There was some discussion over whether we should shorten the names, for example `Trig` and `Exp`. No abbreviations have been agreed on yet, but this could be considered in the future.

Additionally, `Integer::divisible_by` has been renamed to `Integer::is_multiple_of`.
2013-04-29 13:39:37 -07:00
Brian Anderson
c1fdace588 core: Replace uses of 'drop' in task module with 'finally'. #5379 2013-04-29 13:38:21 -07:00
bors
76ec35ae74 auto merge of #6099 : danluu/rust/xfail_clone, r=catamorphism
One of the tests seems to have no current equivalent that's similar. Please let me know if that's incorrect, and I'll try fixing it instead of deleting it. I suppose a struct could be used instead of `any` and `match type`, but it seems like the original intent of the test was to exercise `match type`
2013-04-29 11:57:40 -07:00
Brendan Zabarauskas
500078e147 Revert "Merge Exponential and Hyperbolic traits"
After discussions on IRC and #4819, we have decided to revert this change. This is due to the traits expressing different ideas and because hyperbolic functions are not trivially implementable from exponential functions for floating-point types.
2013-04-29 23:50:34 +10:00
Brendan Zabarauskas
d3f494f5c3 Merge Exponential and Hyperbolic traits
The Hyperbolic Functions are trivially implemented in terms of `exp`, so it's  simpler to group them the Exponential trait. In the future these would have default implementations.
2013-04-29 22:15:58 +10:00
ILYONG CHO
32901104cb tutorial: Fix 'self' to 'Self' 2013-04-29 18:03:11 +09:00
ILYONG CHO
9d33008da1 tutorial: Fix 'self' to 'Self' 2013-04-29 17:59:25 +09:00
bors
ea74f6845e auto merge of #6083 : jbclements/rust/parser-cleanup, r=jbclements
r? @pcwalton

A month's worth of parser cleanup here. Much of this is new comments and renaming. A number of these commits also remove unneeded code.  Probably the biggest refactor here is splitting "parse_item_or_view_item" into two functions; it turns out that the only overlap between items in foreign modules and items in regular modules was macros, so this refactor should make things substantially easier for future maintenance.
2013-04-29 00:12:37 -07:00
Brendan Zabarauskas
20ad931bf3 Rename 'divisible_by' method to 'is_multiple_of', add tests for 'is_odd' and 'is_even' 2013-04-29 16:03:48 +10:00
John Clements
cce13c18fe add test case for enum disambiguation 2013-04-28 23:01:41 -07:00
John Clements
cdf4d4bcdd fix typo in librstpkg tests, allowed by old parser 2013-04-28 23:01:41 -07:00
Brendan Zabarauskas
8f63f9789b Implement Fractional for Ratio 2013-04-29 16:00:27 +10:00
Brendan Zabarauskas
c9620dc052 Move appropriate functions out of Real and into separate Algebraic, Trigonometric, Exponential and Hyperbolic traits 2013-04-29 15:33:55 +10:00
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