blake2-ppc
6e3d5c62e7
std::num: Remove range_step
for each numeric type
...
Replaced by `std::iter::range_step`
2013-09-15 00:41:41 -04:00
bors
bca015d9ff
auto merge of #9182 : bjz/rust/master, r=brson
...
Somehow this was missed!
cc #4819
2013-09-14 11:15:54 -07:00
Brendan Zabarauskas
ec8f88417c
Add Orderable bound to num::Primitive
2013-09-14 13:31:31 +10:00
Erick Tryzelaar
ca47eebb44
std: Add a bunch of Default impls
2013-09-12 18:54:13 -07:00
bors
fd2488bf5a
auto merge of #9051 : bjz/rust/master, r=huonw
2013-09-09 06:06:04 -07:00
bors
dd5c7379e9
auto merge of #8988 : cmr/rust/fromstr_fn, r=brson
...
It just calls out to the associated function on the trait.
2013-09-08 12:05:55 -07:00
Corey Richardson
e0e5523552
Fix import order which caused the wrong from_str to be in scope
2013-09-08 15:00:00 -04:00
Brendan Zabarauskas
2c31053d20
Fix unused import warnings on 32bit systems
2013-09-09 03:51:29 +10:00
Brendan Zabarauskas
8445009a84
Add Clone and DeepClone constraints to Primitive trait
2013-09-08 13:48:46 +10:00
Brendan Zabarauskas
0fcb85997d
Moved checked trait impls out of std::num
...
This follows the same pattern as the other numeric trait impls, and reduces the clutter in std::num.
2013-09-08 13:48:15 +10:00
bors
25f3b29c61
auto merge of #9010 : aaronlaursen/rust/master, r=alexcrichton
...
Here's a fix for issue #7588 , "Overflow handling of from_str methods is broken".
The integer overflow issues are taken care of by checking to see if the multiply-by-radix-and-add-next-digit process is reversible. If it overflowed, then some information is lost and the process is irreversible, in which case, None is returned.
Floats now consistently return Some(Inf) of Some(-Inf) on overflow thanks to a call to NumStrConv::inf() and NumStrConv::neg_inf() respectively when the overflow is detected (which yields a value of None in the case of ints and uints anyway).
This is my first contribution to Rust, and my first time using the language in general, so any and all feedback is appreciated.
2013-09-06 20:10:57 -07:00
Aaron Laursen
caf5321eb4
fix for issue #7588 , overflow now handled correctly
2013-09-06 13:00:34 -05:00
Florian Hahn
de39874801
Rename str::from_bytes to str::from_utf8, closes #8985
2013-09-05 14:17:24 +02:00
bors
bb35e23f1c
auto merge of #8896 : lightcatcher/rust/default_eq_fix, r=thestinger
...
Summary:
-removed "ne" methods in libstd and librustpkg
-made default "ne" be inlined
-made one of the "eq" methods in librustpkg follow more standard parameter naming convention
2013-08-30 21:40:32 -07:00
Eric Martin
babe20f018
remove several 'ne' methods
2013-08-30 21:53:25 -04:00
Erick Tryzelaar
9730ed9b02
std: Add a fixme for when we add Trait::<for T>::static_method()
2013-08-30 15:10:55 -07:00
bors
ed422b8872
auto merge of #8819 : vadimcn/rust/unit-tests, r=brson
...
Some of the tests are failing. I've only managed to fix 'memory_map_file', the rest are up for grabs...
Fixes #5261 .
2013-08-29 20:40:47 -07:00
Jason Fager
dc30005ad8
Remove the iter module.
...
Moves the Times trait to num while the question of whether it should
exist at all gets hashed out as a completely separate question.
2013-08-29 01:27:24 -04:00
Vadim Chugunov
6828428cad
Disabled failing parts of abs_sub() and frexp() unit tests on Windows.
2013-08-28 01:44:12 -07:00
Patrick Walton
8693943676
librustc: Ensure that type parameters are in the right positions in paths.
...
This removes the stacking of type parameters that occurs when invoking
trait methods, and fixes all places in the standard library that were
relying on it. It is somewhat awkward in places; I think we'll probably
want something like the `Foo::<for T>::new()` syntax.
2013-08-27 18:47:57 -07:00
Vadim Chugunov
12ecdb6381
Enabled unit tests in std and extra.
2013-08-22 20:02:20 -07:00
bors
e66478193b
auto merge of #8610 : kballard/rust/mod_floor, r=alexcrichton
...
`mod_floor()` was incorrectly defined for uint types as `a / b` instead of `a % b`.
2013-08-21 09:31:43 -07:00
Daniel Micay
0ba8ccdaee
rm obsolete float to_str_radix free functions
2013-08-20 22:05:03 -04:00
Daniel Micay
46fc549fa9
rm obsolete integer to_str{,_radix} free functions
2013-08-20 22:05:03 -04:00
bors
4bdceb9c00
auto merge of #8459 : thestinger/rust/checked, r=graydon
2013-08-19 12:42:48 -07:00
Niko Matsakis
0479d946c8
Add externfn macro and correctly label fixed_stack_segments
2013-08-19 07:13:15 -04:00
Kevin Ballard
ac3bc9cfcc
Fix mod_floor() for uint primitive types
2013-08-19 01:01:11 -07:00
Huon Wilson
abe94f9b4d
doc: correct spelling in documentation.
2013-08-16 15:41:28 +10:00
Kevin Ballard
15159a5638
Rewrite Saturating in terms of CheckedAdd/CheckedSub
2013-08-14 13:02:20 -07:00
Alex Crichton
930885d5e5
Forbid pub/priv where it has no effect
...
Closes #5495
2013-08-12 23:20:46 -07:00
Daniel Micay
0cb0ef2ca5
fix build with the new snapshot compiler
2013-08-12 17:37:46 -04:00
Daniel Micay
b244911398
num: implement CheckedDiv
2013-08-11 19:19:19 -04:00
Daniel Micay
7db605cd15
disable 64-bit CheckedMul on 32-bit
...
code generation problem reported as issue #8449
2013-08-11 02:58:52 -04:00
Daniel Micay
076b91f8ad
add intrinsics for checked overflow add/sub/mul
2013-08-11 02:51:20 -04:00
OGINO Masanori
b4d6ae5bb8
Remove redundant Ord method impls.
...
Basically, generic containers should not use the default methods since a
type of elements may not guarantees total order. str could use them
since u8's Ord guarantees total order. Floating point numbers are also
broken with the default methods because of NaN. Thanks for @thestinger.
Timespec also guarantees total order AIUI. I'm unsure whether
extra::semver::Identifier does so I left it alone. Proof needed.
Signed-off-by: OGINO Masanori <masanori.ogino@gmail.com>
2013-08-09 14:28:14 +09:00
Huon Wilson
8460dac909
std: add missing #[inline] annotation to the f64 arithmetic trait impls.
2013-08-07 22:41:14 -04:00
Alex Crichton
e99eff172a
Forbid priv
where it has no effect
...
This is everywhere except struct fields and enum variants.
2013-08-07 22:41:12 -04:00
Kevin Ballard
8964fcc5ac
Implement DoubleEndedIterator on Range
...
Range is now invertable as long as its element type conforms to Integer.
Remove int::range_rev() et al in favor of range().invert().
2013-08-07 22:41:09 -04:00
bors
54c8c23d05
auto merge of #8323 : kballard/rust/saturating, r=thestinger
...
Implement saturating math in `std::num::Saturating` and use it for `Iterator` impls
2013-08-07 04:02:16 -07:00
Kevin Ballard
5f713da4aa
Add std::num::Saturating
...
Saturating is an implementation of saturating math operations (at the
moment just add and sub) for integral types.
2013-08-05 22:49:33 -07:00
blake2-ppc
ea9c5c405e
std: Remove uint::iterate, replaced by range
2013-08-06 04:05:08 +02:00
Marvin Löbel
0ac7a219f0
Updated std::Option, std::Either and std::Result
...
- Made naming schemes consistent between Option, Result and Either
- Changed Options Add implementation to work like the maybe monad (return None if any of the inputs is None)
- Removed duplicate Option::get and renamed all related functions to use the term `unwrap` instead
2013-08-05 22:42:21 +02:00
Daniel Micay
b3ad685f7f
replace all remaining for
with foreach
or do
2013-08-03 03:00:42 -04:00
Patrick Walton
9457ebee55
librustc: Disallow "unsafe" for external functions
2013-08-02 21:57:59 -07:00
Daniel Micay
234acad404
replace range
with an external iterator
2013-08-02 00:51:14 -04:00
blake2-ppc
78cde5b9fb
std: Change Times
trait to use do
instead of for
...
Change the former repetition::
for 5.times { }
to::
do 5.times { }
.times() cannot be broken with `break` or `return` anymore; for those
cases, use a numerical range loop instead.
2013-08-01 16:54:22 +02:00
Brendan Zabarauskas
4f65fc7ef2
Improve std::num module description, and fix some formatting
2013-07-30 08:59:43 +10:00
Brendan Zabarauskas
b6ea0538a9
Add some missing method wrappers to std::num
2013-07-30 08:58:46 +10:00
Birunthan Mohanathas
d047cf1ec6
Change 'print(fmt!(...))' to printf!/printfln! in src/lib*
2013-07-24 09:45:20 -04:00
Graydon Hoare
9f7e364d3a
std: add #[bench] benchmarks for num::strconv
2013-07-22 16:56:11 -07:00
Patrick Walton
06594ed96b
librustc: Remove pub extern
and priv extern
from the language.
...
Place `pub` or `priv` on individual items instead.
2013-07-20 17:39:38 -07:00
bors
5c999d4eca
auto merge of #7894 : pcwalton/rust/and-pointers-in-at-boxes, r=brson
...
r? @brson
2013-07-20 10:55:34 -07:00
Brian Anderson
ddd8c156c6
std: Remove old magic core mod
2013-07-19 21:01:24 -04:00
Patrick Walton
9089cf2ec9
librustc: Forbid &
pointers (other than &'static
) inside @
boxes.
...
This makes custom borrowing implementations for custom smart pointers
sound.
2013-07-18 17:12:46 -07:00
Patrick Walton
e20549ff19
librustc: Remove all uses of the Copy
bound.
2013-07-17 14:57:53 -07:00
Patrick Walton
99b33f7219
librustc: Remove all uses of "copy".
2013-07-17 14:57:51 -07:00
Felix S. Klock II
db0a13b986
Switch over to new range_rev semantics; fix #5270 .
2013-07-10 09:35:35 +02:00
Felix S. Klock II
3c19f1bca8
Refactored int/uint range code in preparation for change to range_rev semantics.
...
Also added unit tests of range code to test refactoring. The
num-range-rev.rs test will need to be updated when the range_rev
semantics change.
2013-07-10 09:35:35 +02:00
Jens Nockert
1aae28a57d
Replaces the free-standing functions in f32, &c.
...
The free-standing functions in f32, f64, i8, i16, i32, i64, u8, u16,
u32, u64, float, int, and uint are replaced with generic functions in
num instead.
If you were previously using any of those functions, just replace them
with the corresponding function with the same name in num.
Note: If you were using a function that corresponds to an operator, use
the operator instead.
2013-07-08 18:05:17 +02:00
Huon Wilson
c437a16c5d
rustc: add a lint to enforce uppercase statics.
2013-07-01 17:52:57 +10:00
bors
07feeb95c5
auto merge of #7487 : huonw/rust/vec-kill, r=cmr
...
Continuation of #7430 .
I haven't removed the `map` method, since the replacement `v.iter().transform(f).collect::<~[SomeType]>()` is a little ridiculous at the moment.
2013-06-30 21:14:13 -07:00
Alex Crichton
d3155faede
Specialize to_str_common for floats/integers in strconv
...
This allows the integral paths to avoid allocations on the heap
Closes #4424 , #4423
2013-06-30 09:19:25 -07:00
Huon Wilson
9e83b2fe55
Convert vec::{reverse, swap} to methods.
2013-06-30 21:15:25 +10:00
Patrick Walton
a1531ed946
librustc: Remove the broken overloaded assign-ops from the language.
...
They evaluated the receiver twice. They should be added back with
`AddAssign`, `SubAssign`, etc., traits.
2013-06-28 10:44:16 -04:00
Patrick Walton
f9b54541ee
librustc: Disallow "mut" from distributing over bindings.
...
This is the backwards-incompatible part of per-binding-site "mut".
2013-06-28 10:44:15 -04:00
Graydon Hoare
d904c72af8
replace #[inline(always)] with #[inline]. r=burningtree.
2013-06-18 14:48:48 -07:00
Niko Matsakis
eb48c29681
Add copies to type params with Copy bound
2013-06-16 12:47:36 -04:00
Alex Crichton
893c70d7bc
Add Zero impls for lots of common types
2013-06-14 19:12:37 -07:00
Huon Wilson
efc71a8bdb
std: unify the str -> [u8] functions as 3 methods: .as_bytes() and .as_bytes_with_null[_consume]().
...
The first acts on &str and is not nul-terminated, the last two act on strings
that are always null terminated (&'static str, ~str and @str).
2013-06-12 12:21:04 +10:00
Huon Wilson
7e6a5940cb
std: convert pow, hypot, atan2, log to take arguments by reference.
2013-06-11 11:36:03 +10:00
Tim Chevalier
a014088da1
std: Fix search-and-replace typos
2013-06-08 11:59:03 -07:00
Patrick Walton
8114d0e950
librustc: Disallow multiple patterns from appearing in a "let" declaration.
...
You can still initialize multiple variables at once with "let (x, y) = (1, 2)".
2013-06-04 21:45:42 -07:00
Steve Klabnik
220e1a6cfc
Add example for uint::range_step.
2013-05-30 14:35:07 -07:00
Alex Crichton
007651cd26
Require documentation by default for libstd
...
Adds documentation for various things that I understand.
Adds #[allow(missing_doc)] for lots of things that I don't understand.
2013-05-30 01:02:55 -05:00
Patrick Walton
206ab89629
librustc: Stop reexporting the standard modules from prelude.
2013-05-29 19:04:53 -07:00
Matthijs Hofstra
3141acf674
Changed to a more efficient implementation.
2013-05-29 20:21:04 +02:00
Matthijs Hofstra
6cc9a26a2d
Replaced calls to external fmin/fmax by a Rust implementation.
2013-05-29 18:26:50 +02:00
Alex Crichton
b04c40bb1c
Silence various warnings throughout test modules
2013-05-28 15:27:35 -05:00
bors
24784e8030
auto merge of #6771 : thestinger/rust/highlight, r=luqmana
...
This works with pandoc linked against highlighting-kate >= 0.5.3.8. It seems to just be a no-op with earlier versions, because I successfully ran this through `try`.
This also fixes some consistency issues (like making `Example`/`Examples` always a header and always using three tildes).
2013-05-28 04:02:02 -07:00
Daniel Micay
0d5fdce82e
syntax highlight code examples in docstrings
2013-05-27 14:47:21 -04:00
Lindsey Kuper
beec6e4b21
Get rid of no-longer-needed #[doc(hidden)] attributes.
...
There were several old `#[doc(hidden)]` attributes in libstd and
libextra, left over from when rustdoc didn't hide private
definitions, tagged with `FIXME #3538`.
Since #3538 is now closed, I removed the `#[doc(hidden)]` attributes
as well as the FIXMEs, but I left `#[doc(hidden)]` in
libstd/task/spawn.rs and libstd/task/rt.rs since those two are
apparently `pub`, as well as in libextra/std.rc since std/extra is
`pub`.
2013-05-27 13:29:48 -04:00
Alex Crichton
ec8fb884e9
Remove usage of the #[merge] hack with int modules
2013-05-24 15:31:34 -05:00
Erick Tryzelaar
dc970c13f4
cleanup warnings from libstd
2013-05-23 17:48:16 -07:00
Patrick Walton
0c820d4123
libstd: Rename libcore to libstd and libstd to libextra; update makefiles.
...
This only changes the directory names; it does not change the "real"
metadata names.
2013-05-22 21:57:05 -07:00
Corey Richardson
cc57ca012a
Use assert_eq! rather than assert! where possible
2013-05-19 08:16:02 -04:00
bors
c30414f980
auto merge of #6471 : gifnksm/rust/reform-rational, r=brson
...
`std::ratio` module contains `BigRational` type, but the type is not usable by following reasons.
* `Ratio::new` requires `T: Copy + Num + Ord`, but `BigInt` is not implicitly copyable, because it contains unique vector.
* `BigInt` is not implements `Num`
So, I rewrite `Ratio` as follows.
* `Ratio` requires `T: Clone + Integer + Ord`.
* `Copy` -> `Clone`: to be able to use `BigRational`
* `Num` -> `Integer`: It is incorrect that a rational number constructed by two non-integer numbers.
* `BigInt` implements `Num` and `Orderable` which are required by `Integer` bound
2013-05-14 15:28:59 -07:00
Björn Steinbrink
bdc182cc41
Use static string with fail!() and remove fail!(fmt!())
...
fail!() used to require owned strings but can handle static strings
now. Also, it can pass its arguments to fmt!() on its own, no need for
the caller to call fmt!() itself.
2013-05-14 16:36:23 +02:00
gifnksm
da9c1fbf27
libstd: Add tests for BigRational
2013-05-14 21:59:13 +09:00
gifnksm
76ecce0e0c
libstd: Ratio
requires Clone
instead of Copy
...
This allows creating `Ratio<T>` which `T` is non-implicitly copyable types
such as `BigInt`.
2013-05-14 21:59:08 +09:00
gifnksm
41eaa97372
libstd: Rational
requires Integer
as type bounds instead of Num
2013-05-14 21:55:42 +09:00
gifnksm
e3695468b7
libstd: impl Orderable
for BigUint
/BigInt
2013-05-14 21:20:27 +09:00
gifnksm
5ce0795de5
libstd: impl Num for BigUint/BigInt
2013-05-14 19:27:20 +09:00
bors
36771ef609
auto merge of #6429 : gifnksm/rust/bigint-is_even, r=catamorphism
...
`BigUint::is_even()` didn't return correct value.
2013-05-11 22:40:36 -07:00
Tim Chevalier
ed41864464
Warning police
2013-05-11 20:36:44 -07:00
gifnksm
a2b81ccba4
libstd: Fix BigUint::is_even
2013-05-12 10:17:23 +09:00
Youngsoo Son
b7da975049
renamed vec::from_slice to vec::to_owned
2013-05-10 18:38:54 +09:00
Daniel Micay
2bc12635a2
remove vecs_implicitly_copyable from libstd/libcore
2013-05-09 14:00:53 -04:00
Brendan Zabarauskas
a9ac2b95f4
Add abs_sub method to Signed trait
2013-05-07 19:16:03 +10:00
Daniel Micay
86efd97a10
add gitattributes and fix whitespace issues
2013-05-03 20:01:42 -04:00
gifnksm
cff6aba76e
libcore: Export core::from_str::FromStr from core::prelude
2013-05-02 20:42:54 +09:00