summary refs log tree commit diff
path: root/src/libstd
AgeCommit message (Collapse)AuthorLines
2014-01-31auto merge of #11768 : nikomatsakis/rust/issue-11385-cell-and-variance, ↵bors-43/+264
r=pnkfelix Introduce marker types for indicating variance and for opting out of builtin bounds. Fixes #10834. Fixes #11385. cc #5922. r? @pnkfelix (since you reviewed the variance inference in the first place)
2014-01-31auto merge of #11885 : bnoordhuis/rust/issue11694, r=alexcrichtonbors-9/+113
EINVAL means that the requested stack size is either not a multiple of the system page size or that it's smaller than PTHREAD_STACK_MIN. Figure out what the case is, fix it up and retry. If it still fails, give up, like before. Suggestions for future improvements: * don't fail!() but instead signal a condition, or * silently ignore the error and use a default sized stack. Fixes #11694. The first two commits put the framework in place, the third one contains the meat.
2014-01-31Introduce marker types for indicating variance and for opting outNiko Matsakis-43/+264
of builtin bounds. Fixes #10834. Fixes #11385. cc #5922.
2014-02-01Move int and uint overflow tests into macrosBrendan Zabarauskas-15/+14
2014-02-01Remove free-standing div functions in std::uintBrendan Zabarauskas-60/+0
2014-02-01Remove some unused importsBrendan Zabarauskas-2/+0
2014-02-01Make next_power_of_two generic for unsigned integersBrendan Zabarauskas-76/+85
Also rename `next_power_of_two_opt` to `checked_next_power_of_two`.
2014-01-31Use __pthread_get_minstack() when available.Ben Noordhuis-1/+46
glibc >= 2.15 has a __pthread_get_minstack() function that returns PTHREAD_STACK_MIN plus however many bytes are needed for thread-local storage. Use it when it's available because just PTHREAD_STACK_MIN is not enough in applications that have big thread-local storage requirements. Fixes #6233.
2014-01-31Retry on EINVAL from pthread_attr_setstacksize()Ben Noordhuis-6/+45
Enforce that the stack size is > RED_ZONE + PTHREAD_STACK_MIN. If the call to pthread_attr_setstacksize() subsequently fails with EINVAL, it means that the platform requires the stack size to be a multiple of the page size. In that case, round up to the nearest page and retry. Fixes #11694.
2014-01-31Add libc::consts::os::posix01::PTHREAD_STACK_MINBen Noordhuis-3/+23
Represents the minimum size of a thread's stack. As such, it's both platform and architecture-specific. I put it under posix01 even though it predates POSIX.1-2001 by some years. I believe it was first formalized in SUSv2. I doubt anyone cares, though.
2014-01-31auto merge of #11918 : omasanori/rust/reduce-warnings, r=alexcrichtonbors-14/+5
Moving forward to green waterfall.
2014-01-30auto merge of #11947 : alexcrichton/rust/osx-unwind, r=brsonbors-1/+4
On OSX 32-bit, the private fields are 5 words long, not 2. I found this segfaulting before this change, and after this change it no longer segfaulted.
2014-01-30Fix the size of the _Unwind_Exception structAlex Crichton-1/+4
On OSX 32-bit, the private fields are 5 words long, not 2. I found this segfaulting before this change, and after this change it no longer segfaulted.
2014-01-30auto merge of #11784 : eminence/rust/fix_run_tests, r=alexcrichtonbors-1/+1
This test is designed to ensure that running a non-existent executable results in a correct error message (FileNotFound in this case of this test). However, if you try to run an executable that doesn't exist, and that requires searching through the $PATH, and one of the $PATH components is not readable, then a PermissionDenied error will be returned, instead of FileNotFound. Using an absolute path skips the $PATH search logic in exec, thus by-passing the logic in exec that would have returned a PermissionDenied In the specific case of my machine, /usr/bin/games was part of $PATH, but my user account wasn't in the games group (thus being unable to read /usr/bin/games) See the man pages for execv and execve for more details. I've tested this on Linux and OSX, and I am fairly certain that there will be no problems on Windows
2014-01-30Make mut_last return Option instead of failing on empty vector (and add a ↵Nathaniel Herman-4/+14
test for mut_last)
2014-01-30Make pop_ref and mut_pop_ref return Option instead of failing on empty vectorsNathaniel Herman-24/+20
2014-01-30Make shift_ref and mut_shift_ref return Option instead of failingNathaniel Herman-24/+20
2014-01-30auto merge of #11895 : xales/rust/libstd, r=alexcrichtonbors-29/+2
Fixes #11814
2014-01-29auto merge of #11672 : bjz/rust/remove-times, r=brsonbors-75/+30
`Times::times` was always a second-class loop because it did not support the `break` and `continue` operations. Its playful appeal (which I liked) was then lost after `do` was disabled for closures. It's time to let this one go.
2014-01-30Remove Times traitBrendan Zabarauskas-75/+30
`Times::times` was always a second-class loop because it did not support the `break` and `continue` operations. Its playful appeal was then lost after `do` was disabled for closures. It's time to let this one go.
2014-01-29Remove seldom-used std::reference functions.xales-28/+2
2014-01-29Remove double-use of logging.xales-1/+0
2014-01-29Rename std::borrow to std::reference.xales-3/+3
Fixes #11814
2014-01-29auto merge of #11893 : Armavica/rust/copyable-cloneable, r=huonwbors-26/+26
I found awkward to have `MutableCloneableVector` and `CloneableIterator` on the one hand, and `CopyableVector` etc. on the other hand. The concerned traits are: * `CopyableVector` --> `CloneableVector` * `OwnedCopyableVector` --> `OwnedCloneableVector` * `ImmutableCopyableVector` --> `ImmutableCloneableVector` * `CopyableTuple` --> `CloneableTuple`
2014-01-30Append ; to #[allow(dead_code)].OGINO Masanori-1/+1
Signed-off-by: OGINO Masanori <masanori.ogino@gmail.com>
2014-01-30Prefix _ to unused variables.OGINO Masanori-4/+4
Signed-off-by: OGINO Masanori <masanori.ogino@gmail.com>
2014-01-30Remove unused imports.OGINO Masanori-9/+0
Signed-off-by: OGINO Masanori <masanori.ogino@gmail.com>
2014-01-29auto merge of #11754 : alexcrichton/rust/unused-result, r=brsonbors-3/+4
The general consensus is that we want to move away from conditions for I/O, and I propose a two-step plan for doing so: 1. Warn about unused `Result` types. When all of I/O returns `Result`, it will require you inspect the return value for an error *only if* you have a result you want to look at. By default, for things like `write` returning `Result<(), Error>`, these will all go silently ignored. This lint will prevent blind ignorance of these return values, letting you know that there's something you should do about them. 2. Implement a `try!` macro: ``` macro_rules! try( ($e:expr) => (match $e { Ok(e) => e, Err(e) => return Err(e) }) ) ``` With these two tools combined, I feel that we get almost all the benefits of conditions. The first step (the lint) is a sanity check that you're not ignoring return values at callsites. The second step is to provide a convenience method of returning early out of a sequence of computations. After thinking about this for awhile, I don't think that we need the so-called "do-notation" in the compiler itself because I think it's just *too* specialized. Additionally, the `try!` macro is super lightweight, easy to understand, and works almost everywhere. As soon as you want to do something more fancy, my answer is "use match". Basically, with these two tools in action, I would be comfortable removing conditions. What do others think about this strategy? ---- This PR specifically implements the `unused_result` lint. I actually added two lints, `unused_result` and `unused_must_use`, and the first commit has the rationale for why `unused_result` is turned off by default.
2014-01-29Flag Result as #[must_use] and deal with fallout.Alex Crichton-3/+4
2014-01-29Removing do keyword from libstd and librustcScott Lawrence-265/+264
2014-01-28Rename CopyableTuple to CloneableTupleVirgile Andreani-4/+4
2014-01-28Rename ImmutableCopyableVector to ImmutableCloneableVectorVirgile Andreani-3/+3
2014-01-28Rename OwnedCopyableVector to OwnedCloneableVectorVirgile Andreani-8/+8
2014-01-28Rename CopyableVector to CloneableVectorVirgile Andreani-12/+12
2014-01-28auto merge of #11845 : xales/rust/libnative, r=alexcrichtonbors-0/+44
Fixes std::net test error when re-running too quickly. Suggested by @cmr
2014-01-28auto merge of #11858 : huonw/rust/11841-followup, r=brsonbors-0/+4
Follow-up to #11841 which added this function.
2014-01-27Set SO_REUSEADDR by default in libnative.xales-0/+44
Fixes std::net test error when re-running too quickly.
2014-01-28std: comment about OOM & allocs in begin_unwind_fmt.Huon Wilson-0/+4
Follow-up to #11841 which added this function.
2014-01-27auto merge of #11723 : eddyb/rust/more-trans-cleanup, r=pcwaltonbors-0/+2
2014-01-27Removed take_glue from tydesc, inlining the equivalent refcount increment ↵Eduard Burtescu-0/+2
code instead.
2014-01-27auto merge of #11841 : huonw/rust/noinline-fail, r=alexcrichtonbors-6/+43
In two ways: - for a plain `fail!(a)` we make the generic part of `begin_unwind` as small as possible (makes `fn main() { fail!() }` compile 2-3x faster, due to less monomorphisation bloat) - for `fail!("format {}", "string")`, we avoid touching the generics completely by doing the formatting in a specialised function, which (with optimisations) saves a function call at the call-site of `fail!`. (This one has significantly less benefit than the first.)
2014-01-28Feature gate #[simd]David Manescu-1/+12
Fixes #11721
2014-01-27std: add begin_unwind_fmt that reduces codesize for formatted fail!().Huon Wilson-3/+25
This ends up saving a single `call` instruction in the optimised code, but saves a few hundred lines of non-optimised IR for `fn main() { fail!("foo {}", "bar"); }` (comparing against the minimal generic baseline from the parent commit).
2014-01-27Demote self to an (almost) regular argument and remove the env param.Eduard Burtescu-17/+8
Fixes #10667 and closes #10259.
2014-01-27std: reduce the generic code instantiated by fail!().Huon Wilson-3/+18
This splits the vast majority of the code path taken by `fail!()` (`begin_unwind`) into a separate non-generic inline(never) function, so that uses of `fail!()` only monomorphise a small amount of code, reducing code bloat and making very small crates compile faster.
2014-01-26auto merge of #11817 : salemtalha/rust/master, r=brsonbors-37/+37
Fixes Issue #11815
2014-01-26Removed all instances of XXX in preparation for relaxing of FIXME ruleSalem Talha-37/+37
2014-01-26Fix privacy fallout from previous changeAlex Crichton-1/+1
2014-01-26auto merge of #11762 : alexcrichton/rust/guard_pages, r=alexcrichtonbors-68/+132
Rebasing of the previous PRs, I believe I've found the problems.
2014-01-26Bring in the line-length policeAlex Crichton-51/+79