about summary refs log tree commit diff
path: root/src/libcore
AgeCommit message (Collapse)AuthorLines
2013-05-01correct incorrect handling of overloaded operators, exposing various other ↵Niko Matsakis-8/+8
bits of rot
2013-05-01auto merge of #6147 : bjz/rust/numeric-traits, r=brsonbors-134/+101
After much discussion on IRC and #4819, we have decided to revert to the old naming of the `/` operator. This does not change its behavior. In making this change, we also have had to rename some of the methods in the `Integer` trait. Here is a list of the methods that have changed: - `Quot::quot` -> `Div::div` - `Rem::rem` - stays the same - `Integer::quot_rem` -> `Integer::div_rem` - `Integer::div` -> `Integer::div_floor` - `Integer::modulo` -> `Integer::mod_floor` - `Integer::div_mod` -> `Integer::div_mod_floor`
2013-05-01auto merge of #6144 : catamorphism/rust/mkdir_recursive-breakage, r=thestingerbors-0/+30
r? @brson or @thestinger : Added a change_dir_locked function to os, and use it in the mkdir_recursive tests so that the tests don't clobber each other's directory changes.
2013-05-01Revert rename of Div to QuotBrendan Zabarauskas-134/+101
2013-04-30auto merge of #6131 : thestinger/rust/new_iter, r=graydonbors-0/+94
2013-04-30auto merge of #6113 : brson/rust/task-drop, r=graydonbors-56/+21
2013-04-30core/std: Fix race condition in os::mkdir_recursive testsTim Chevalier-0/+30
Added a change_dir_locked function to os, and use it in the mkdir_recursive tests so that the tests don't clobber each other's directory changes.
2013-04-30Merge remote-tracking branch 'brson/io'Brian Anderson-279/+1241
Conflicts: src/libcore/task/local_data_priv.rs
2013-04-30remove some unused mut declsNiko Matsakis-1/+1
2013-04-30iter: add max and min functionsDaniel Micay-2/+66
2013-04-30allover: numerous unused muts etcNiko Matsakis-33/+25
2013-04-30iter: add a find functionDaniel Micay-0/+29
2013-04-30char: fix unused import warningDaniel Micay-0/+1
2013-04-30new borrow checker (mass squash)Niko Matsakis-41/+87
2013-04-30desnapshotNiko Matsakis-122/+8
2013-04-30adapt to snapshotNiko Matsakis-864/+2
2013-04-30I modified the doc of from_elem, from_fn, I think it returns an owned vectorSangeun Kim-4/+4
2013-04-29auto merge of #6107 : catamorphism/rust/mkdir_recursive, r=brsonbors-16/+60
r? @brson This hopefully addresses your concerns about the termination condition, and adds more tests. With a bonus documentation commit.
2013-04-29auto merge of #6073 : huonw/rust/core-rust-isaac, r=pcwaltonbors-47/+234
This replaces the wrapper around the runtime RNG with a pure Rust implementation of the same algorithm. This is much faster (up to 5x), and is hopefully safer. There is still (a little) room for optimisation: testing by summing 100,000,000 random `u32`s indicates this is about ~~40-50%~~ 10% slower than the pure C implementation (running as standalone executable, not in the runtime). (Only 6d50d55 is part of this PR, the first two are from #6058, but are required for the rt rng to be correct to compare against in the tests.)
2013-04-29core: Turn off the local heap in newsched in stage0 to work around windows ↵Brian Anderson-0/+19
bustage core won't compile in stage0 without.
2013-04-30core: add some inlining hints to methods/fns in rand.Huon Wilson-1/+32
2013-04-30core: a pure Rust implementation of the ISAAC RNG.Huon Wilson-46/+202
This replaces the wrapper around the runtime RNG with a pure Rust implementation of the same algorithm. This is faster (up to 5x), and is hopefully safer. There is still much room for optimisation: testing by summing 100,000,000 random `u32`s indicates this is about 40-50% slower than the pure C implementation (running as standalone executable, not in the runtime).
2013-04-29test: Fix more tests.Patrick Walton-5/+5
2013-04-29librustc: Forbid type implementations on typedefs.Patrick Walton-31/+65
2013-04-29test: Fix tests.Patrick Walton-16/+18
2013-04-29librustc: Make `&fn` by-copy by default and remove the mode from ↵Patrick Walton-0/+3
`frame_address`.
2013-04-29test: Remove #[legacy_modes] from the test suite.Patrick Walton-1/+1
2013-04-29librustc: Rename `reinterpret_cast` to `transmute_copy` and remove the intrinsicPatrick Walton-26/+39
2013-04-29librustc: Implement `reinterpret_cast` in terms of `transmute`.Patrick Walton-0/+36
2013-04-29librustc: Remove `ptr::addr_of`.Patrick Walton-89/+70
2013-04-29Revert "libcore: remove unnecessary deref"Tim Chevalier-1/+1
This reverts commit 9860fe10a19cc4997e58861df905f8dbe4de3c5b.
2013-04-29auto merge of #6110 : bjz/rust/numeric-traits, r=pcwaltonbors-256/+360
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-29core: Replace uses of 'drop' in task module with 'finally'. #5379Brian Anderson-56/+21
2013-04-29Revert "Merge Exponential and Hyperbolic traits"Brendan Zabarauskas-5/+11
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-29Merge Exponential and Hyperbolic traitsBrendan Zabarauskas-11/+5
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-29Rename 'divisible_by' method to 'is_multiple_of', add tests for 'is_odd' and ↵Brendan Zabarauskas-5/+67
'is_even'
2013-04-29Move appropriate functions out of Real and into separate Algebraic, ↵Brendan Zabarauskas-251/+293
Trigonometric, Exponential and Hyperbolic traits
2013-04-28core: Use a better termination condition in os::mkdir_recursiveTim Chevalier-16/+20
Instead of checking whether the parent is "." or "/", check the number of components. Also, more tests.
2013-04-28core: Document core::path::GenericPath's trait methodsTim Chevalier-0/+40
2013-04-28make way for a new iter moduleDaniel Micay-429/+534
2013-04-28rand: Fix infinite recursionPhilipp Brüschweiler-1/+1
`self` has type `&@Rand`, so `*self` will be of type `@Rand` which causes this same impl to be called again.
2013-04-27auto merge of #6082 : catamorphism/rust/mkdir_recursive, r=brsonbors-0/+35
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-27auto merge of #6071 : bjz/rust/numeric-traits, r=graydonbors-762/+1624
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-27auto merge of #6064 : thestinger/rust/char, r=catamorphismbors-14/+19
2013-04-26auto merge of #6059 : Kimundi/rust/nice-fail, r=pcwaltonbors-1/+46
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-27Propagate NaNs for Orderable methods impled on floating-point primitivesBrendan Zabarauskas-15/+75
2013-04-27Fix copy-paste mistakesBrendan Zabarauskas-5/+5
2013-04-26auto merge of #6057 : cmr/rust/map_zip, r=graydonbors-9/+12
I think the name is more clear, and fits with filter_map etc.
2013-04-27Remove unnecessary fallbacksBrendan Zabarauskas-82/+0
The `target_word_size` attribute is always available at compile time, so there is no need for a fallback.
2013-04-27Rename `nextafter` to `next_after` to match method name in FloatBrendan Zabarauskas-8/+9