Commit Graph

104 Commits

Author SHA1 Message Date
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
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