summary refs log tree commit diff
path: root/src/libstd
AgeCommit message (Collapse)AuthorLines
2013-09-01Fix #8898novalis-2/+3
2013-09-02rt::io: Add Bytes iterator for Readerblake2-ppc-1/+83
An iterator that simply calls `.read_bytes()` each iteration. I think choosing to own the Reader value and implementing Decorator to allow extracting it is the most generically useful. The Reader type variable can of course be some kind of reference type that implements Reader.
2013-09-01std/extra: Add ExactSize for Bitv, DList, RingBuf, Option iteratorsblake2-ppc-1/+3
2013-09-01std::iterator: Use ExactSize, inheriting DoubleEndedIteratorblake2-ppc-52/+43
Address discussion with acrichto; inherit DoubleEndedIterator so that `.rposition()` can be a default method, and that the nische of the trait is clear. Use assertions when using `.size_hint()` in reverse enumerate and `.rposition()`
2013-09-01std::iterator: Add back .rposition() testblake2-ppc-10/+25
2013-09-01auto merge of #8276 : kballard/rust/iterator-protocol, r=cmrbors-6/+122
r? @thestinger
2013-08-31auto merge of #8899 : thestinger/rust/repr, r=huonwbors-21/+31
2013-08-31repr: remove trailing {} from unit-like structsDaniel Micay-7/+11
2013-08-31repr: print the name of structsDaniel Micay-19/+25
2013-08-30auto merge of #8896 : lightcatcher/rust/default_eq_fix, r=thestingerbors-18/+2
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-30Now inline default 'ne' methodsEric Martin-0/+2
2013-08-30remove several 'ne' methodsEric Martin-18/+0
2013-08-30auto merge of #8889 : erickt/rust/cleanup, r=catamorphismbors-1/+3
This fixes a couple minor things I've been sitting on. It cleans up some warnings, CapCases some types in librustc's rscope module, and adds a fixme.
2013-08-30std: Add a file-renaming function to std::osTim Chevalier-0/+12
2013-08-30std: Add a fixme for when we add Trait::<for T>::static_method()Erick Tryzelaar-0/+2
2013-08-30fix various warningsErick Tryzelaar-1/+1
2013-08-30std::select: Use correct indices from the frontblake2-ppc-2/+2
Caught a bug where .enumerate() was used on a reverse iterator. The indices should be counted from the front here (bblum confirms).
2013-08-30std::str: Use reverse enumerate and .rpositionblake2-ppc-15/+6
Simplify code by using the reversibility of enumerate and use .rposition().
2013-08-30std: Implement .rposition() on double-ended iterators with known sizeblake2-ppc-36/+37
This is a generalization of the vector .rposition() method, to all double-ended iterators that have the ExactSizeHint trait. This resolves the slight asymmetry around `position` and `rposition` * position from front is `vec.iter().position()` * position from the back was, `vec.rposition()` is now `vec.iter().rposition()` Additionally, other indexed sequences (only `extra::ringbuf` I think), will have the same method available once it implements ExactSizeHint.
2013-08-30std::iterator: Add tests for .next_back() on Zip and Enumerateblake2-ppc-0/+27
2013-08-30std::iterator: Implement .next_back() for Zipblake2-ppc-0/+23
Let Zip be double-ended when both its children have the ExactSizeHint trait.
2013-08-30std::iterator: Introduce trait ExactSizeHintblake2-ppc-0/+38
The trait `ExactSizeHint` is introduced to solve a few small niggles: * We can't reverse (`.invert()`) an enumeration iterator * for a vector, we have `v.iter().position(f)` but `v.rposition(f)`. * We can't reverse `Zip` even if both iterators are from vectors `ExactSizeHint` is an empty trait that is intended to indicate that an iterator, for example `VecIterator`, knows its exact finite size and reports it correctly using `.size_hint()`. Only adaptors that preserve this at all times, can expose this trait further. (Where here we say finite for fitting in uint).
2013-08-30auto merge of #8858 : blake2-ppc/rust/small-bugs, r=alexcrichtonbors-16/+21
Fix a bug in `s.slice_chars(a, b)` that did not accept `a == s.len()`. Fix a bug in `!=` defined for DList. Also simplify NormalizationIterator to use the CharIterator directly instead of mimicing the iteration itself.
2013-08-30auto merge of #8877 : bouk/rust/master, r=sanxiynbors-1/+1
Ran into a missing space in the stdlib source
2013-08-30auto merge of #8867 : thestinger/rust/smaller-arc, r=alexcrichtonbors-1/+9
2013-08-30auto merge of #8857 : blake2-ppc/rust/std-str-remove, r=thestingerbors-40/+0
These are very easy to replace with methods on string slices, basically `.char_len()` and `.len()`. These are the replacement implementations I did to clean these functions up, but seeing this I propose removal: /// ... pub fn count_chars(s: &str, begin: uint, end: uint) -> uint { // .slice() checks the char boundaries s.slice(begin, end).char_len() } /// Counts the number of bytes taken by the first `n` chars in `s` /// starting from byte index `begin`. /// /// Fails if there are less than `n` chars past `begin` pub fn count_bytes<'b>(s: &'b str, begin: uint, n: uint) -> uint { s.slice_from(begin).slice_chars(0, n).len() }
2013-08-30Add missing spaceBouke van der Bijl-1/+1
2013-08-30auto merge of #8854 : huonw/rust/rt-papercuts, r=brsonbors-31/+25
The only user-facing change is handling non-integer (and zero) `RUST_THREADS` more nicely: ``` $ RUST_THREADS=x rustc # old You've met with a terrible fate, haven't you? fatal runtime error: runtime tls key not initialized Aborted $ RUST_THREADS=x ./x86_64-unknown-linux-gnu/stage2/bin/rustc # new You've met with a terrible fate, haven't you? fatal runtime error: `RUST_THREADS` is `x`, should be a positive integer Aborted ``` The other changes are converting some `for .. in range(x,y)` to `vec::from_fn` or `for .. in x.iter()` as appropriate; and removing a chain of (seemingly) unnecessary pointer casts. (Also, fixes a typo in `extra::test` from #8823.)
2013-08-30auto merge of #8820 : alexcrichton/rust/no-io-writer, r=brsonbors-299/+1521
At the same time, this updates the TyVisitor to use a mutable self because it's probably going to be mutating state as it goes along anyway.
2013-08-29Make Zip iterator short-circuitKevin Ballard-6/+12
Python's zip() short-circuits by not even querying its right-hand iterator if the left-hand one is done. Match that behavior here by not calling .next() on the right iterator if the left one returns None.
2013-08-29Make the iterator protocol more explicitKevin Ballard-0/+110
Document the fact that the iterator protocol only defines behavior up until the first None is returned. After this point, iterators are free to behave how they wish. Add a new iterator adaptor Fuse<T> that modifies iterators to return None forever if they returned None once.
2013-08-29auto merge of #8819 : vadimcn/rust/unit-tests, r=brsonbors-25/+84
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-29reduce the size of UnsafeArc from 2 words to 1Daniel Micay-1/+9
2013-08-29Revert "auto merge of #8645 : alexcrichton/rust/issue-6436-run-non-blocking, ↵Brian Anderson-1053/+1060
r=brson" This reverts commit b8d1fa399402c71331aefd634d710004e00b73a6, reversing changes made to f22b4b169854c8a4ba86c16ee43327d6bcf94562. Conflicts: mk/rt.mk src/libuv
2013-08-29auto merge of #8842 : jfager/rust/remove-iter-module, r=pnkfelixbors-36/+21
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-29std::str: Fix bug in .slice_chars()blake2-ppc-0/+4
`s.slice_chars(a, b)` did not allow the case where `a == s.len()`, this is a bug I introduced last time I touched the method; add a test for this case.
2013-08-29std::str: Use CharIterator in NormalizationIteratorblake2-ppc-16/+17
Just to simplify and not have the iteration logic repeated in multiple places.
2013-08-29std::str: Remove functions count_chars, count_bytesblake2-ppc-40/+0
These are very easy to replace with methods on string slices, basically `.char_len()` and `.len()`. These are the replacement implementations I did to clean these functions up, but seeing this I propose removal: /// ... pub fn count_chars(s: &str, begin: uint, end: uint) -> uint { // .slice() checks the char boundaries s.slice(begin, end).char_len() } /// Counts the number of bytes taken by the first `n` chars in `s` /// starting from byte index `begin`. /// /// Fails if there are less than `n` chars past `begin` pub fn count_bytes<'b>(s: &'b str, begin: uint, n: uint) -> uint { s.slice_from(begin).slice_chars(0, n).len() }
2013-08-29rt: remove a series of unfortunate casts.Huon Wilson-13/+6
2013-08-29rt: use sugary functions rather than manual range loops.Huon Wilson-16/+11
2013-08-29rt: Handle non-integer RUST_THREADS (slightly) more gracefully.Huon Wilson-2/+8
Previously it would call Option.unwrap(), which calls `fail!` on None, which doesn't work without the runtime (e.g. when initialising it).
2013-08-28Remove @io::Writer from sys/repr/reflectAlex Crichton-299/+1521
At the same time, this updates the TyVisitor to use a mutable self because it's probably going to be mutating state as it goes along anyway.
2013-08-29Remove the iter module.Jason Fager-36/+21
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-28auto merge of #8447 : alexcrichton/rust/local-data-merge, r=brsonbors-549/+467
This moves all local_data stuff into the `local_data` module and only that module alone. It also removes a fair amount of "super-unsafe" code in favor of just vanilla code generated by the compiler at the same time. Closes #8113
2013-08-28auto merge of #8807 : alexcrichton/rust/remove-two-offsets, r=thestingerbors-94/+36
Everything that we do is actually inbounds, so there's no reason for us to be exposing two of these functions
2013-08-28Turned off libstd unit tests that currently fail on Windows.Vadim Chugunov-0/+21
2013-08-28Disabled failing parts of abs_sub() and frexp() unit tests on Windows.Vadim Chugunov-0/+21
2013-08-28Fixed MemoryMap on Windows.Vadim Chugunov-25/+42
2013-08-27Remove offset_inbounds for an unsafe offset functionAlex Crichton-94/+36
2013-08-27auto merge of #8805 : jfager/rust/remove-hashutil, r=alexcrichtonbors-7/+0