about summary refs log tree commit diff
path: root/src/libstd
AgeCommit message (Collapse)AuthorLines
2014-01-19auto merge of #11649 : FlaPer87/rust/pow, r=cmrbors-37/+22
There was an old and barely used implementation of pow, which expected both parameters to be uint and required more traits to be implemented. Since a new implementation for `pow` landed, I'm proposing to remove this old impl in favor of the new one. The benchmark shows that the new implementation is faster than the one being removed: ``` test num::bench::bench_pow_function ..bench: 9429 ns/iter (+/- 2055) test num::bench::bench_pow_with_uint_function ...bench: 28476 ns/iter (+/- 2202) ```
2014-01-19auto merge of #11643 : kballard/rust/path-root-path, r=ericktbors-4/+7
2014-01-19auto merge of #11642 : erickt/rust/path, r=huonwbors-41/+62
This pull request exposes a platform independent way to get the path separator. This is useful when building complicated paths by hand.
2014-01-19auto merge of #11635 : thestinger/rust/zero-size-alloc, r=alexcrichtonbors-21/+31
The `malloc` family of functions may return a null pointer for a zero-size allocation, which should not be interpreted as an out-of-memory error. If the implementation does not return a null pointer, then handling this will result in memory savings for zero-size types. This also switches some code to `malloc_raw` in order to maintain a centralized point for handling out-of-memory in `rt::global_heap`. Closes #11634
2014-01-18Replace old pow_with_uint with the new pow funcFlavio Percoco-43/+7
There was an old and barely used implementation of pow, which expected both parameters to be uint and required more traits to be implemented. Since a new implementation for `pow` landed, I'm proposing to remove this old impl in favor of the new one. The benchmark shows that the new implementation is faster than the one being removed: test num::bench::bench_pow_function ..bench: 9429 ns/iter (+/- 2055) test num::bench::bench_pow_with_uint_function ...bench: 28476 ns/iter (+/- 2202)
2014-01-18Added benchmark for pow and pow_with_uintFlavio Percoco-0/+21
2014-01-18Expose platform independent path separatorsErick Tryzelaar-41/+62
2014-01-18auto merge of #11622 : bjz/rust/simplify-primitive-trait, r=brsonbors-84/+31
As part of #10387, this removes the `Primitive::{bits, bytes, is_signed}` methods and removes the trait's operator trait constraints for the reasons outlined below: - The `Primitive::{bits, bytes}` associated functions were originally added to reflect the existing `BITS` and `BYTES`statics included in the numeric modules. These statics are only exist as a workaround for Rust's lack of CTFE, and should be deprecated in the future in favor of using the `std::mem::size_of` function (see #11621). - `Primitive::is_signed` seems to be of little utility and does not seem to be used anywhere in the Rust compiler or libraries. It is also rather ugly to call due to the `Option<Self>` workaround for #8888. - The operator trait constraints are already covered by the `Num` trait.
2014-01-18auto merge of #11605 : alexcrichton/rust/issue-9582, r=brsonbors-2/+2
Closes #9582
2014-01-17Make WindowsPath::new("C:foo").root_path() return Some("C:")Kevin Ballard-4/+7
2014-01-18Rename iterators for consistencyPalmer Cox-295/+295
Rename existing iterators to get rid of the Iterator suffix and to give them names that better describe the things being iterated over.
2014-01-17handle zero-size allocations correctlyDaniel Micay-21/+31
The `malloc` family of functions may return a null pointer for a zero-size allocation, which should not be interpreted as an out-of-memory error. If the implementation does not return a null pointer, then handling this will result in memory savings for zero-size types. This also switches some code to `malloc_raw` in order to maintain a centralized point for handling out-of-memory in `rt::global_heap`. Closes #11634
2014-01-17auto merge of #11503 : FlaPer87/rust/master, r=huonwbors-43/+71
The patch adds the missing pow method for all the implementations of the Integer trait. This is a small addition that will most likely be improved by the work happening in #10387. Fixes #11499
2014-01-18std::trie: use unsafe code to give a 3x speed up to the iterator.Huon Wilson-39/+118
This stores the stack of iterators inline (we have a maximum depth with `uint` keys), and then uses direct pointer offsetting to manipulate it, in a blazing fast way: Before: bench_iter_large ... bench: 43187 ns/iter (+/- 3082) bench_iter_small ... bench: 618 ns/iter (+/- 288) After: bench_iter_large ... bench: 13497 ns/iter (+/- 1575) bench_iter_small ... bench: 220 ns/iter (+/- 91)
2014-01-18std::trie: remove each_{key,value}_reverse internal iterators.Huon Wilson-13/+1
This are *trivial* to reimplement in terms of each_reverse if that extra little bit of performance is needed.
2014-01-18Add FIXME comments regarding issue #11526.Brendan Zabarauskas-0/+22
2014-01-18Simplify std::num::Primitive trait definitionBrendan Zabarauskas-84/+9
This removes the `Primitive::{bits, bytes, is_signed}` methods and removes the operator trait constraints, for the reasons outlined below: - The `Primitive::{bits, bytes}` associated functions were originally added to reflect the existing `BITS` and `BYTES` statics included in the numeric modules. These statics are only exist as a workaround for Rust's lack of CTFE, and should probably be deprecated in the future in favor of using the `std::mem::size_of` function (see #11621). - `Primitive::is_signed` seems to be of little utility and does not seem to be used anywhere in the Rust compiler or libraries. It is also rather ugly to call due to the `Option<Self>` workaround for #8888. - The operator trait constraints are already covered by the `Num` trait.
2014-01-17auto merge of #11598 : alexcrichton/rust/io-export, r=brsonbors-106/+148
* Reexport io::mem and io::buffered structs directly under io, make mem/buffered private modules * Remove with_mem_writer * Remove DEFAULT_CAPACITY and use DEFAULT_BUF_SIZE (in io::buffered) cc #11119
2014-01-17Tweak the interface of std::ioAlex Crichton-106/+148
* Reexport io::mem and io::buffered structs directly under io, make mem/buffered private modules * Remove with_mem_writer * Remove DEFAULT_CAPACITY and use DEFAULT_BUF_SIZE (in io::buffered)
2014-01-17auto merge of #11585 : nikomatsakis/rust/issue-3511-rvalue-lifetimes, r=pcwaltonbors-36/+98
Major changes: - Define temporary scopes in a syntax-based way that basically defaults to the innermost statement or conditional block, except for in a `let` initializer, where we default to the innermost block. Rules are documented in the code, but not in the manual (yet). See new test run-pass/cleanup-value-scopes.rs for examples. - Refactors Datum to better define cleanup roles. - Refactor cleanup scopes to not be tied to basic blocks, permitting us to have a very large number of scopes (one per AST node). - Introduce nascent documentation in trans/doc.rs covering datums and cleanup in a more comprehensive way. r? @pcwalton
2014-01-17Add a generic power functionFlavio Percoco-43/+71
The patch adds a `pow` function for types implementing `One`, `Mul` and `Clone` trait. The patch also renames f32 and f64 pow into powf in order to still have a way to easily have float powers. It uses llvms intrinsics. The pow implementation for all num types uses the exponentiation by square. Fixes bug #11499
2014-01-17auto merge of #11479 : khodzha/rust/peekable_empty, r=brsonbors-1/+15
to fix https://github.com/mozilla/rust/issues/11218
2014-01-16Fix test to account for new temporary lifetime rules, which cause the ↵Niko Matsakis-1/+1
channel to be dropped prematurely.
2014-01-16Forbid coercing unsafe functions to closuresAlex Crichton-2/+2
Closes #9582
2014-01-16auto merge of #11571 : derekchiang/rust/fix-task-docs, r=alexcrichtonbors-7/+6
There might be a reason, but I failed to see why these comments couldn't be proper rust docs.
2014-01-16Remove typoNiko Matsakis-1/+1
2014-01-16auto merge of #11579 : kballard/rust/windows-path-join, r=ericktbors-2/+9
WindowsPath::new("C:").join("a") produces r"C:". This is incorrect. It should produce "C:a".
2014-01-16Fix some docs in std::rt::taskDerek Chiang-7/+6
2014-01-15auto merge of #11548 : bjz/rust/bitwise, r=alexcrichtonbors-39/+39
One less trait in `std::num` and three less exported in the prelude. cc. #10387
2014-01-15auto merge of #11565 : mozilla/rust/snapshot, r=huonwbors-246/+17
2014-01-16Merge Bitwise and BitCount traits and remove from prelude, along with BoundedBrendan Zabarauskas-39/+39
One less trait in std::num, and three less exported in the prelude.
2014-01-15Remove FIXMEs and add licenseNiko Matsakis-1/+1
2014-01-15auto merge of #11568 : FlaPer87/rust/even, r=alexcrichtonbors-2/+2
This implementation should be a bit more optimal than calling `self.is_multiple_of(&2)`
2014-01-15Issue #3511 - Rationalize temporary lifetimes.Niko Matsakis-37/+99
Major changes: - Define temporary scopes in a syntax-based way that basically defaults to the innermost statement or conditional block, except for in a `let` initializer, where we default to the innermost block. Rules are documented in the code, but not in the manual (yet). See new test run-pass/cleanup-value-scopes.rs for examples. - Refactors Datum to better define cleanup roles. - Refactor cleanup scopes to not be tied to basic blocks, permitting us to have a very large number of scopes (one per AST node). - Introduce nascent documentation in trans/doc.rs covering datums and cleanup in a more comprehensive way.
2014-01-15auto merge of #11550 : alexcrichton/rust/noinline, r=thestingerbors-0/+2
The failure functions are generic, meaning they're candidates for getting inlined across crates. This has been happening, leading to monstrosities like that found in #11549. I have verified that the codegen is *much* better now that we're not inlining the failure path (the slow path).
2014-01-15path: Fix joining Windows path when the receiver is "C:"Kevin Ballard-2/+9
WindowsPath::new("C:").join("a") produces r"C:\a". This is incorrect. It should produce "C:a".
2014-01-15auto merge of #11112 : alexcrichton/rust/issue-11087, r=brsonbors-23/+98
This should allow callers to know whether the channel was empty or disconnected without having to block. Closes #11087
2014-01-15Allow more "error" values in try_recv()Alex Crichton-23/+98
This should allow callers to know whether the channel was empty or disconnected without having to block. Closes #11087
2014-01-15auto merge of #11543 : thestinger/rust/gc, r=cmrbors-0/+5
This type isn't yet very useful since it only pretends cycles won't be a problem. Anyone using it should be made aware that they're going to leak.
2014-01-15Use the least significant beat to determine if int/uint is evenFlavio Percoco-2/+2
2014-01-15auto merge of #11561 : eddyb/rust/moar-inlines, r=pcwaltonbors-9/+34
2014-01-15remove the concept of managed-unique from libstdDaniel Micay-31/+16
Closes #11545
2014-01-15register snapshotsDaniel Micay-215/+1
2014-01-15auto merge of #11556 : am0d/rust/docs, r=huonwbors-1/+1
2014-01-15libstd: Added more #[inline] annotations and replaced uses of `libc::abort` ↵Eduard Burtescu-9/+34
with the intrinsic.
2014-01-14auto merge of #11535 : thestinger/rust/header, r=alexcrichtonbors-9/+114
Unique pointers and vectors currently contain a reference counting header when containing a managed pointer. This `{ ref_count, type_desc, prev, next }` header is not necessary and not a sensible foundation for tracing. It adds needless complexity to library code and is responsible for breakage in places where the branch has been left out. The `borrow_offset` field can now be removed from `TyDesc` along with the associated handling in the compiler. Closes #9510 Closes #11533
2014-01-14Flag failure functions as inline(never)Alex Crichton-0/+2
The failure functions are generic, meaning they're candidates for getting inlined across crates. This has been happening, leading to monstrosities like that found in #11549. I have verified that the codegen is *much* better now that we're not inlining the failure path (the slow path).
2014-01-14Mark LineIterator as public so its docs get generated.a_m0d-1/+1
2014-01-14add implementation of `Repr` for `~[T]`Daniel Micay-1/+2
2014-01-14remove `borrow_offset` as ~ is now free of headersDaniel Micay-7/+0