summary refs log tree commit diff
path: root/src/libstd
AgeCommit message (Collapse)AuthorLines
2013-08-06std: Remove unused trait bound in Result::mapblake2-ppc-1/+1
2013-08-06std: Convert Result to use external iteratorsblake2-ppc-14/+18
convert iter() and iter_err() for Result. Use OptionIterator.
2013-08-06std: Add .consume_iter() for Option, to make it reusableblake2-ppc-27/+15
Let Option be a base for a widely useful one- or zero- item iterator. Refactor OptionIterator to support any generic element type, so the same iterator impl can be used for both &T, &mut T and T iterators.
2013-08-05auto merge of #8288 : Kimundi/rust/opteitres4, r=brsonbors-516/+493
This is an alternative version to https://github.com/mozilla/rust/pull/8268, where instead of transitioning to `get()` completely, I transitioned to `unwrap()` completely. My reasoning for also opening this PR is that having two different functions with identical behavior on a common datatype is bad for consistency and confusing for users, and should be solved as soon as possible. The fact that apparently half the code uses `get()`, and the other half `unwrap()` only makes it worse. If the final naming decision ends up different, there needs to be a big renaming anyway, but until then it should at least be consistent. --- - Made naming schemes consistent between Option, Result and Either - Lifted the quality of the either and result module to that of option - Changed Options Add implementation to work like the maybe Monad (return None if any of the inputs is None) See https://github.com/mozilla/rust/issues/6002, especially my last comment. - Removed duplicate Option::get and renamed all related functions to use the term `unwrap` instead See also https://github.com/mozilla/rust/issues/7887. Todo: Adding testcases for all function in the three modules. Even without the few functions I added, the coverage wasn't complete to begin with. But I'd rather do that as a follow up PR, I've touched to much code here already, need to go through them again later.
2013-08-05Lazily initialize 'leaf node' taskgroups for unlinked spawns, for an ↵Ben Blum-45/+63
apparent 11% speedup.
2013-08-05(cleanup) Uncomment an assertion that now holds.Ben Blum-5/+4
2013-08-05auto merge of #8298 : darkf/rust/fix-3948, r=pcwaltonbors-1/+1
2013-08-05Updated std::Option, std::Either and std::ResultMarvin Löbel-516/+493
- 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-05Get rid of some NOTEs.Michael Sullivan-1/+1
2013-08-05auto merge of #8293 : dim-an/rust/trie-iterator, r=thestingerbors-0/+94
Closes #5506.
2013-08-05std: Use correct lifetime parameter on str::raw::slice_bytesblake2-ppc-1/+1
fn slice_bytes is marked unsafe since it allows violating the valid string encoding property; but the function did also allow extending the lifetime of the slice by mistake, since it's returning `&str`. Use the annotation `slice_bytes<'a>(&'a str, ...) -> &'a str` so that all uses of slice_bytes are region checked correctly.
2013-08-05auto merge of #8289 : sfackler/rust/push_byte, r=ericktbors-1/+8
It was previously pushing the byte on top of the string's null terminator. I added a test to make sure it doesn't break in the future.
2013-08-05auto merge of #8303 : brson/rust/tls-magic-wtf, r=brsonbors-0/+13
2013-08-05std::rt: Use magic to make TLS work from annihilated boxes. #8302Brian Anderson-0/+13
2013-08-04std::rt: Schedule more scheduler callbacks to avoid dropping messagesBrian Anderson-1/+3
2013-08-04std: Fix newsched logging truncationBrian Anderson-14/+17
The truncation needs to be done in the console logger in order to catch all the logging output, and because truncation only matters when outputting to the console.
2013-08-04Open files in binary mode. Closes #3948darkf-1/+1
2013-08-04std: Update the c_str docs, and support CString not owning the pointerErick Tryzelaar-138/+63
2013-08-04auto merge of #8282 : brson/rust/more-newsched-fixes, r=brsonbors-211/+74
2013-08-04auto merge of #8218 : brson/rust/nogc, r=brsonbors-444/+0
These are both obsoleted by the forthcoming new GC.
2013-08-04Merge remote-tracking branch 'remotes/origin/master' into str-remove-nullErick Tryzelaar-492/+470
2013-08-05Remove debug printing.Dmitry Ermolov-2/+0
2013-08-04Remove trailing null from stringsErick Tryzelaar-25/+439
2013-08-04std: remove use of cast module from os.Erick Tryzelaar-13/+6
2013-08-04std: merge str::raw::from_buf and str::raw::from_c_strErick Tryzelaar-23/+13
2013-08-04std and rustc: explicitly pass c strings to c functionsErick Tryzelaar-91/+108
When strings lose their trailing null, this pattern will become dangerous: let foo = "bar"; let foo_ptr: *u8 = &foo[0]; Instead we should use c_strs to handle this correctly.
2013-08-05Implemented iterator for TrieMapDmitry Ermolov-0/+96
Closes #5506.
2013-08-04Remove old tests and code for `select`Brian Anderson-152/+2
Not compatible with newsched
2013-08-04std::rt: Remove the test for context()Brian Anderson-10/+0
This is no longer testable once newsched is turned on
2013-08-04std::rt: Don't allow schedulers to exit before handling all messagesBrian Anderson-0/+10
Every time run_sched_once performs a 'scheduling action' it needs to guarantee that it runs at least one more time, so enqueue another run_sched_once callback. The primary reason it needs to do this is because not all async callbacks are guaranteed to run, it's only guaranteed that *a* callback will run after enqueing one - some may get dropped. At the moment this means we wastefully create lots of callbacks to ensure that there will *definitely* be a callback queued up to continue running the scheduler. The logic really needs to be tightened up here.
2013-08-04std::rt: 3MB stacks!Brian Anderson-2/+2
rustc needs *even more* megabytes when run without optimizations
2013-08-04std::rt: Run the tests for Local in a bare threadBrian Anderson-36/+45
Otherwise interferes with the existing runtime
2013-08-04std::rt: Improve the error message when the thread-local ptr is nullBrian Anderson-11/+15
Also fix some incorrect comments and variable names.
2013-08-04std: replace str::as_c_str with std::c_strErick Tryzelaar-185/+403
2013-08-04std: remove str::from_bytes_with_nullErick Tryzelaar-82/+0
2013-08-04std: add test for str::as_c_strErick Tryzelaar-0/+23
2013-08-04std: cleanup os and str testsErick Tryzelaar-28/+28
2013-08-04std: remove str::NullTerminatedStrErick Tryzelaar-55/+2
2013-08-04std: rewrite run::with_{argv,envp,dirp} to copy C stringsErick Tryzelaar-44/+59
2013-08-04std: add str.to_c_str()Erick Tryzelaar-1/+27
2013-08-04std: minor cleanupErick Tryzelaar-3/+3
2013-08-04Fixed str::raw::push_byteSteven Fackler-1/+8
It was previously pushing the byte on top of the string's null terminator. I added a test to make sure it doesn't break in the future.
2013-08-04auto merge of #8243 : stepancheg/rust/ipv, r=brsonbors-148/+142
multicast functions now take IpAddr (without port), because they dont't need port. Uv* types renamed: * UvIpAddr -> UvSocketAddr * UvIpv4 -> UvIpv4SocketAddr * UvIpv6 -> UvIpv6SocketAddr "Socket address" is a common name for (ip-address, port) pair (e.g. in sockaddr_in struct). P. S. Are there any backward compatibility concerns? What is std::rt module, is it a part of public API?
2013-08-04auto merge of #8237 : blake2-ppc/rust/faster-utf8, r=brsonbors-35/+67
Use unchecked vec indexing since the vector bounds are checked by the loop. Iterators are not easy to use in this case since we skip 1-4 bytes each lap. This part of the commit speeds up is_utf8 for ASCII input. Check codepoint ranges by checking the byte ranges manually instead of computing a full decoding for multibyte encodings. This is easy to read and corresponds to the UTF-8 syntax in the RFC. No changes to what we accept. A comment notes that surrogate halves are accepted. Before: test str::bench::is_utf8_100_ascii ... bench: 165 ns/iter (+/- 3) test str::bench::is_utf8_100_multibyte ... bench: 218 ns/iter (+/- 5) After: test str::bench::is_utf8_100_ascii ... bench: 130 ns/iter (+/- 1) test str::bench::is_utf8_100_multibyte ... bench: 156 ns/iter (+/- 3) An improvement upon the previous pull #8133
2013-08-04std: implement Total{Ord,Eq} for pointers.Huon Wilson-2/+49
2013-08-04syntax: make #[deriving(TotalOrd)] lazy.Huon Wilson-1/+0
Previously it would call: f(sf1.cmp(&of1), f(sf2.cmp(&of2), ...)) (where s/of1 = 'self/other field 1', and f was std::cmp::lexical_ordering) This meant that every .cmp subcall got evaluated when calling a derived TotalOrd.cmp. This corrects this to use let test = sf1.cmp(&of1); if test == Equal { let test = sf2.cmp(&of2); if test == Equal { // ... } else { test } } else { test } This gives a lexical ordering by short-circuiting on the first comparison that is not Equal.
2013-08-03std: Remove gc and stackwalkBrian Anderson-444/+0
These are both obsoleted by the forthcoming new GC.
2013-08-03auto merge of #8264 : thestinger/rust/snapshot, r=Aatchbors-263/+232
2013-08-03auto merge of #8269 : brson/rust/fix-task-cleanup, r=brsonbors-27/+22
...y/catch And before collect_failure. These are both running user dtors and need to be handled in the task try/catch block and before the final task cleanup code.
2013-08-03remove obsolete `foreach` keywordDaniel Micay-231/+231
this has been replaced by `for`