about summary refs log tree commit diff
path: root/src/libstd
AgeCommit message (Collapse)AuthorLines
2013-08-07(cleanup) Improve rtabort message for atomic-sleep.Ben Blum-1/+2
2013-08-07fix recv_ready for Port to take &self and not need to return a tuple. Close ↵Ben Blum-7/+26
#8192.
2013-08-07std: add missing #[inline] annotation to the f64 arithmetic trait impls.Huon Wilson-0/+4
2013-08-07Add weak_rng to get a random algo that puts more emphasis on speed than securityJordi Boggiano-0/+10
2013-08-07Document rand module with more emphasis on cryptographic securityJordi Boggiano-2/+12
2013-08-07Forbid `priv` where it has no effectAlex Crichton-23/+23
This is everywhere except struct fields and enum variants.
2013-08-07Implement DoubleEndedIterator on RangeKevin Ballard-54/+48
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-07std: Fix for-range loops that can use iteratorsblake2-ppc-10/+10
Fix inappropriate for-range loops to use for-iterator constructs (or other appropriate solution) instead.
2013-08-07Add initial support for a new formatting syntaxAlex Crichton-2/+1331
The new macro is available under the name ifmt! (only an intermediate name)
2013-08-07Turn on the new runtimeBrian Anderson-1/+1
2013-08-07Disable linked failure testsBrian Anderson-0/+25
The implementation currently contains a race that leads to segfaults.
2013-08-07std: Allow spawners to specify stack sizeBrian Anderson-49/+61
2013-08-07std::rt: Pull RUST_MIN_STACK from the environmentBrian Anderson-3/+32
2013-08-07std::rt: 2MB stacks againBrian Anderson-1/+1
2013-08-07Merge remote-tracking branch 'remotes/origin/master' into ↵Erick Tryzelaar-141/+488
remove-str-trailing-nulls
2013-08-07std: fix a bad type cast for in str.to_c_str()Erick Tryzelaar-1/+1
2013-08-07std: Make CString::new unsafe b/c it can mutate a *T ptrErick Tryzelaar-2/+2
2013-08-07std: remove unnecessary test from c_str.drop and use safer transmuteErick Tryzelaar-2/+2
2013-08-07std: Fix c_str.iter() and add testErick Tryzelaar-3/+20
2013-08-07auto merge of #8294 : erickt/rust/map-move, r=bblumbors-60/+92
According to #7887, we've decided to use the syntax of `fn map<U>(f: &fn(&T) -> U) -> U`, which passes a reference to the closure, and to `fn map_move<U>(f: &fn(T) -> U) -> U` which moves the value into the closure. This PR adds these `.map_move()` functions to `Option` and `Result`. In addition, it has these other minor features: * Replaces a couple uses of `option.get()`, `result.get()`, and `result.get_err()` with `option.unwrap()`, `result.unwrap()`, and `result.unwrap_err()`. (See #8268 and #8288 for a more thorough adaptation of this functionality. * Removes `option.take_map()` and `option.take_map_default()`. These two functions can be easily written as `.take().map_move(...)`. * Adds a better error message to `result.unwrap()` and `result.unwrap_err()`.
2013-08-07auto merge of #8326 : thestinger/rust/iterator, r=alexcrichtonbors-31/+89
The `extra::iter` module wasn't actually included in `extra.rs` when it was moved from `std`... I assume no one is going to miss it.
2013-08-07std: removed option.take_map{,_default}Erick Tryzelaar-19/+5
2013-08-07core: option.map_consume -> option.map_moveErick Tryzelaar-37/+35
2013-08-07std: add result.map_move, result.map_err_moveErick Tryzelaar-12/+60
2013-08-07auto merge of #8305 : huonw/rust/triage-fixes, r=cmrbors-11/+14
The two deletions are because the test cases are very old (still using `class` and modes!), and, as far as I can tell (since they are so old), the areas they test are well tested by other rpass tests.
2013-08-07std: adjust str::test_add so that the macro expands to all 3 items (#8012).Huon Wilson-11/+14
Closes #3682.
2013-08-07auto merge of #8323 : kballard/rust/saturating, r=thestingerbors-85/+167
Implement saturating math in `std::num::Saturating` and use it for `Iterator` impls
2013-08-07std: run test fix for ARM androidYoung-il Choi-4/+4
2013-08-07auto merge of #8285 : huonw/rust/deriving+++, r=alexcrichtonbors-3/+49
Some general clean-up relating to deriving: - `TotalOrd` was too eager, and evaluated the `.cmp` call for every field, even if it could short-circuit earlier. - the pointer types didn't have impls for `TotalOrd` or `TotalEq`. - the Makefiles didn't reach deep enough into libsyntax for dependencies. (Split out from https://github.com/mozilla/rust/pull/8258.)
2013-08-06vec: use `offset_inbounds` for iteratorsDaniel Micay-5/+24
This allows LLVM to optimize vector iterators to an `getelementptr` and `icmp` pair, instead of `getelementptr` and *two* comparisons. Code snippet: ~~~ fn foo(xs: &mut [f64]) { for x in xs.mut_iter() { *x += 10.0; } } ~~~ LLVM IR at stage0: ~~~ ; Function Attrs: noinline uwtable define void @"_ZN3foo17_68e1b25bca131dba7_0$x2e0E"({ i64, %tydesc*, i8*, i8*, i8 }* nocapture, { double*, i64 }* nocapture) #1 { "function top level": %2 = getelementptr inbounds { double*, i64 }* %1, i64 0, i32 0 %3 = load double** %2, align 8 %4 = getelementptr inbounds { double*, i64 }* %1, i64 0, i32 1 %5 = load i64* %4, align 8 %6 = ptrtoint double* %3 to i64 %7 = and i64 %5, -8 %8 = add i64 %7, %6 %9 = inttoptr i64 %8 to double* %10 = icmp eq double* %3, %9 %11 = icmp eq double* %3, null %or.cond6 = or i1 %10, %11 br i1 %or.cond6, label %match_case, label %match_else match_else: ; preds = %"function top level", %match_else %12 = phi double* [ %13, %match_else ], [ %3, %"function top level" ] %13 = getelementptr double* %12, i64 1 %14 = load double* %12, align 8 %15 = fadd double %14, 1.000000e+01 store double %15, double* %12, align 8 %16 = icmp eq double* %13, %9 %17 = icmp eq double* %13, null %or.cond = or i1 %16, %17 br i1 %or.cond, label %match_case, label %match_else match_case: ; preds = %match_else, %"function top level" ret void } ~~~ Optimized LLVM IR at stage1/stage2: ~~~ ; Function Attrs: noinline uwtable define void @"_ZN3foo17_68e1b25bca131dba7_0$x2e0E"({ i64, %tydesc*, i8*, i8*, i8 }* nocapture, { double*, i64 }* nocapture) #1 { "function top level": %2 = getelementptr inbounds { double*, i64 }* %1, i64 0, i32 0 %3 = load double** %2, align 8 %4 = getelementptr inbounds { double*, i64 }* %1, i64 0, i32 1 %5 = load i64* %4, align 8 %6 = lshr i64 %5, 3 %7 = getelementptr inbounds double* %3, i64 %6 %8 = icmp eq i64 %6, 0 %9 = icmp eq double* %3, null %or.cond6 = or i1 %8, %9 br i1 %or.cond6, label %match_case, label %match_else match_else: ; preds = %"function top level", %match_else %.sroa.0.0.in7 = phi double* [ %10, %match_else ], [ %3, %"function top level" ] %10 = getelementptr inbounds double* %.sroa.0.0.in7, i64 1 %11 = load double* %.sroa.0.0.in7, align 8 %12 = fadd double %11, 1.000000e+01 store double %12, double* %.sroa.0.0.in7, align 8 %13 = icmp eq double* %10, %7 br i1 %13, label %match_case, label %match_else match_case: ; preds = %match_else, %"function top level" ret void } ~~~
2013-08-06add an intrinsic for inbounds GEPDaniel Micay-1/+32
2013-08-06vec: avoid `ptrtoint`/`inttoptr` in the iteratorsDaniel Micay-8/+18
This results in throwing away alias analysis information, because LLVM does *not* implement reasoning about these conversions yet. We specialize zero-size types since a `getelementptr` offset will return us the same pointer, making it broken as a simple counter.
2013-08-06Merge remote-tracking branch 'remotes/origin/master' into ↵Erick Tryzelaar-683/+831
remove-str-trailing-nulls
2013-08-06std: update str.push_byte to work without str trailing nullsErick Tryzelaar-1/+10
2013-08-06Merge commit 'd89ff7eef969aee6b493bc846b64d68358fafbcd' into ↵Erick Tryzelaar-670/+114
remove-str-trailing-nulls
2013-08-06auto merge of #8231 : SimonSapin/rust/ascii-upper-lower-case, r=cmrbors-11/+169
Original pull request: Add str.to_ascii_lower() and str.to_ascii_upper() methods in std::str.
2013-08-06iterator: rename `Counter::new` to `count`Daniel Micay-17/+15
to match the convention used by `range`, since `iterator::count` is already namespaced enough and won't be ambiguous
2013-08-06add Extendable to the preludeDaniel Micay-1/+2
2013-08-06iterator: simplify the `take` implementationDaniel Micay-2/+1
2013-08-06Add to_ascii_upper, to_ascii_lower and eq_ignore_ascii_case in std::asciiSimon Sapin-11/+169
2013-08-06auto merge of #8317 : bblum/rust/fast-spawn-unlinked, r=brsonbors-50/+67
This lazily initializes the taskgroup structs for ```spawn_unlinked``` tasks. If such a task never spawns another task linked to it (or a descendant of it), its taskgroup is simply never initialized at all. Also if an unlinked task spawns another unlinked task, neither of them will need to initialize their taskgroups. This works for the main task too. I benchmarked this with the following test case and observed a ~~21% speedup (average over 4 runs: 7.85 sec -> 6.20 sec, 2.5 GHz)~~ 11% speedup, see comment below. ``` use std::task; use std::cell::Cell; use std::rt::comm; static NUM: uint = 1024*256; fn run(f: ~fn()) { let mut t = task::task(); t.unlinked(); t.spawn(f); } fn main() { do NUM.times { let (p,c) = comm::oneshot(); let c = Cell::new(c); do run { c.take().send(()); } p.recv(); } } ```
2013-08-06Use FromStr for IpAddr in rt::uv::netStepan Koltsov-70/+2
2013-08-06auto merge of #8313 : msullivan/rust/cleanup, r=catamorphismbors-1/+1
2013-08-06Implement FromStr for IpAddr and SocketAddrStepan Koltsov-0/+365
Better than that in rt::uv::net, because it: * handles invalid input explicitly, without fail!() * parses socket address, not just IP * handles various ipv4-in-ipv6 addresses, like 2001:db8:122:344::192.0.2.33 (see http://tools.ietf.org/html/rfc6052 for example) * rejects output like `127.0000000.0.1` * does not allocate heap memory * have unit tests
2013-08-06auto merge of #8308 : blake2-ppc/rust/str-slice-bytes, r=alexcrichtonbors-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-05Update Iterator impls to use SaturatingKevin Ballard-25/+10
Replace hand-rolled saturation math with calls to Saturating. Fix one impl that didn't use saturating math.
2013-08-05Add std::num::SaturatingKevin Ballard-60/+157
Saturating is an implementation of saturating math operations (at the moment just add and sub) for integral types.
2013-08-05std: c_str should use regions on methodsErick Tryzelaar-3/+3
2013-08-05std: fix a typo where .to_c_str wasn't being called on androidErick Tryzelaar-1/+1
2013-08-06std: Fix bug in ChunkIter::idxblake2-ppc-1/+4
ChunkIter .idx() didn't handle overflow correctly, even though it tried.