about summary refs log tree commit diff
path: root/src/libstd/sys
AgeCommit message (Collapse)AuthorLines
2015-01-21rollup merge of #21414: ejjeong/aarch64-linux-androidAlex Crichton-2/+2
Initial support for aarch64-linux-android (#18920) - Add new configuration files - Modify some options to compile & link succesfully. (PIE, disable tls on jemalloc, modify some external function linkage, ..) - To build, refer to https://github.com/rust-lang/rust/wiki/Doc-building-for-android. (tested with platform=21 and toolchain=aarch64-linux-android-4.9)
2015-01-21rollup merge of #21396: japaric/no-parens-in-rangeAlex Crichton-1/+1
Conflicts: src/libsyntax/parse/lexer/comments.rs
2015-01-21rollup merge of #21389: retep998/timerAlex Crichton-1/+1
Fixes #20943 and adds a test for it r? @alexcrichton
2015-01-21Fallout from stabilization.Aaron Turon-12/+12
2015-01-21Rollup merge of #21387 - retep998:hmodule, r=alexcrichtonBarosl LEE-1/+1
r? @alexcrichton
2015-01-21Rollup merge of #21375 - petrochenkov:ssbsl, r=alexcrichtonBarosl LEE-1/+1
After PR #19766 added implicit coersions `*mut T -> *const T`, the explicit casts can be removed. (The number of such casts turned out to be relatively small).
2015-01-20Initial support for aarch64-linux-androidEunji Jeong-2/+2
2015-01-19remove unnecessary parentheses from range notationJorge Aparicio-1/+1
2015-01-19Impl Send for Timer on WindowsPeter Atashian-1/+1
Fixes #20943 Signed-off-by: Peter Atashian <retep998@gmail.com>
2015-01-19Fix HMODULEPeter Atashian-1/+1
Signed-off-by: Peter Atashian <retep998@gmail.com>
2015-01-19Replace `0 as *const/mut T` with `ptr::null/null_mut()`we-13/+16
2015-01-19std::dynamic_lib: Fix Windows error handlingklutzy-0/+7
This is a [breaking-change] since `std::dynamic_lib::dl` is now private. When `LoadLibraryW()` fails, original code called `errno()` to get error code. However, there was local allocation of `Vec` before `LoadLibraryW()`, and it drops before `errno()`, and the drop (deallocation) changed `errno`! Therefore `dynamic_lib::open()` thought it always succeeded. This commit fixes the issue. This commit also sets Windows error mode during `LoadLibrary()` to prevent "dll load failed" dialog.
2015-01-17Register new snapshots.Eduard Burtescu-8/+6
2015-01-17Remove unnecessary explicit conversions to *const Twe-1/+1
2015-01-17auto merge of #21132 : sfackler/rust/wait_timeout, r=alexcrichtonbors-20/+212
**The implementation is a direct adaptation of libcxx's condition_variable implementation.** I also added a wait_timeout_with method, which matches the second overload in C++'s condition_variable. The implementation right now is kind of dumb but it works. There is an outstanding issue with it: as is it doesn't support the use case where a user doesn't care about poisoning and wants to continue through poison. r? @alexcrichton @aturon
2015-01-16Rewrite Condvar::wait_timeout and make it publicSteven Fackler-20/+212
**The implementation is a direct adaptation of libcxx's condition_variable implementation.** pthread_cond_timedwait uses the non-monotonic system clock. It's possible to change the clock to a monotonic via pthread_cond_attr, but this is incompatible with static initialization. To deal with this, we calculate the timeout using the system clock, and maintain a separate record of the start and end times with a monotonic clock to be used for calculation of the return value.
2015-01-15auto merge of #20980 : richo/rust/final-power, r=alexcrichtonbors-6/+28
Originally, this was going to be discussed and revisted, however I've been working on this for months, and a rebase on top of master was about 1 flight's worth of work so I just went ahead and did it. This gets you as far as being able to target powerpc with, eg: LD_LIBRARY_PATH=./x86_64-unknown-linux-gnu/stage2/lib/ x86_64-unknown-linux-gnu/stage2/bin/rustc -C linker=powerpc-linux-gnu-gcc --target powerpc-unknown-linux-gnu hello.rs Would really love to get this out before 1.0. r? @alexcrichton
2015-01-14auto merge of #21061 : japaric/rust/range, r=nick29581bors-1/+1
2015-01-12Change Mutex to use SRWLock on Windows.Peter Atashian-83/+49
Signed-off-by: Peter Atashian <retep998@gmail.com>
2015-01-12cleanup: `&foo[0..a]` -> `&foo[..a]`Jorge Aparicio-1/+1
2015-01-12auto merge of #20896 : sfackler/rust/atomic-rename, r=alexcrichtonbors-8/+8
Change any use of AtomicInt to AtomicIsize and AtomicUint to AtomicUsize Closes #20893 [breaking-change]
2015-01-11powerpc: pthread supportRicho Healey-3/+6
2015-01-11powerpc: Fixup more stack workRicho Healey-0/+1
2015-01-11powerpc: add cdefs for linuxRicho Healey-3/+9
This borrowed entirely from the mips definitions, and should be revisited after it lands while testing.
2015-01-11powerpc: Janky segmented stack supportRicho Healey-0/+12
2015-01-11Rename AtomicInt and AtomicUintSteven Fackler-8/+8
Change any use of AtomicInt to AtomicIsize and AtomicUint to AtomicUsize Closes #20893 [breaking-change]
2015-01-11Give mmap a page-aligned stack start addressClifford Caoile-1/+13
2015-01-09Merge pull request #20699 from vhbit/ios-archsbors-3/+6
Better iOS support Reviewed-by: alexcrichton
2015-01-09iOS: preliminary 64-bit archs supportValerii Hiora-3/+6
2015-01-09Merge pull request #20741 from mneumann/dragonfly-pthread-mutexbors-0/+37
Fix assertion in Mutex::destroy() on DragonFly (#20698) Reviewed-by: alexcrichton
2015-01-08Fix destroy assertions in mutex/rwlock/condvarMichael Neumann-0/+37
On DragonFly pthread_{mutex,rwlock,condvar}_destroy() returns EINVAL when called on a pthread_{mutex,rwlock,condvar}_t that was just initialized via PTHREAD_{MUTEX,RWLOCK,CONDVAR}_INITIALIZER and not used in the meantime or initialized via pthread_{mutex,rwlock,condvar}_init(). Change the code to treat a return value of EINVAL on DragonFly as success.
2015-01-08Improvements to feature stagingBrian Anderson-2/+2
This gets rid of the 'experimental' level, removes the non-staged_api case (i.e. stability levels for out-of-tree crates), and lets the staged_api attributes use 'unstable' and 'deprecated' lints. This makes the transition period to the full feature staging design a bit nicer.
2015-01-07More test fixes and rebase conflictsAlex Crichton-1/+1
2015-01-07Test fixes and rebase conflictsAlex Crichton-1/+1
2015-01-07rollup merge of #20721: japaric/snapAlex Crichton-4/+4
Conflicts: src/libcollections/vec.rs src/libcore/fmt/mod.rs src/librustc/lint/builtin.rs src/librustc/session/config.rs src/librustc_trans/trans/base.rs src/librustc_trans/trans/context.rs src/librustc_trans/trans/type_.rs src/librustc_typeck/check/_match.rs src/librustdoc/html/format.rs src/libsyntax/std_inject.rs src/libsyntax/util/interner.rs src/test/compile-fail/mut-pattern-mismatched.rs
2015-01-07rollup merge of #20680: nick29581/target-wordAlex Crichton-6/+11
Closes #20421 [breaking-change] r? @brson
2015-01-07rollup merge of #20654: alexcrichton/stabilize-hashAlex Crichton-7/+11
This commit aims to prepare the `std::hash` module for alpha by formalizing its current interface whileholding off on adding `#[stable]` to the new APIs. The current usage with the `HashMap` and `HashSet` types is also reconciled by separating out composable parts of the design. The primary goal of this slight redesign is to separate the concepts of a hasher's state from a hashing algorithm itself. The primary change of this commit is to separate the `Hasher` trait into a `Hasher` and a `HashState` trait. Conceptually the old `Hasher` trait was actually just a factory for various states, but hashing had very little control over how these states were used. Additionally the old `Hasher` trait was actually fairly unrelated to hashing. This commit redesigns the existing `Hasher` trait to match what the notion of a `Hasher` normally implies with the following definition: trait Hasher { type Output; fn reset(&mut self); fn finish(&self) -> Output; } This `Hasher` trait emphasizes that hashing algorithms may produce outputs other than a `u64`, so the output type is made generic. Other than that, however, very little is assumed about a particular hasher. It is left up to implementors to provide specific methods or trait implementations to feed data into a hasher. The corresponding `Hash` trait becomes: trait Hash<H: Hasher> { fn hash(&self, &mut H); } The old default of `SipState` was removed from this trait as it's not something that we're willing to stabilize until the end of time, but the type parameter is always required to implement `Hasher`. Note that the type parameter `H` remains on the trait to enable multidispatch for specialization of hashing for particular hashers. Note that `Writer` is not mentioned in either of `Hash` or `Hasher`, it is simply used as part `derive` and the implementations for all primitive types. With these definitions, the old `Hasher` trait is realized as a new `HashState` trait in the `collections::hash_state` module as an unstable addition for now. The current definition looks like: trait HashState { type Hasher: Hasher; fn hasher(&self) -> Hasher; } The purpose of this trait is to emphasize that the one piece of functionality for implementors is that new instances of `Hasher` can be created. This conceptually represents the two keys from which more instances of a `SipHasher` can be created, and a `HashState` is what's stored in a `HashMap`, not a `Hasher`. Implementors of custom hash algorithms should implement the `Hasher` trait, and only hash algorithms intended for use in hash maps need to implement or worry about the `HashState` trait. The entire module and `HashState` infrastructure remains `#[unstable]` due to it being recently redesigned, but some other stability decision made for the `std::hash` module are: * The `Writer` trait remains `#[experimental]` as it's intended to be replaced with an `io::Writer` (more details soon). * The top-level `hash` function is `#[unstable]` as it is intended to be generic over the hashing algorithm instead of hardwired to `SipHasher` * The inner `sip` module is now private as its one export, `SipHasher` is reexported in the `hash` module. And finally, a few changes were made to the default parameters on `HashMap`. * The `RandomSipHasher` default type parameter was renamed to `RandomState`. This renaming emphasizes that it is not a hasher, but rather just state to generate hashers. It also moves away from the name "sip" as it may not always be implemented as `SipHasher`. This type lives in the `std::collections::hash_map` module as `#[unstable]` * The associated `Hasher` type of `RandomState` is creatively called... `Hasher`! This concrete structure lives next to `RandomState` as an implemenation of the "default hashing algorithm" used for a `HashMap`. Under the hood this is currently implemented as `SipHasher`, but it draws an explicit interface for now and allows us to modify the implementation over time if necessary. There are many breaking changes outlined above, and as a result this commit is a: [breaking-change]
2015-01-07use slicing sugarJorge Aparicio-4/+4
2015-01-07std: Stabilize the std::hash moduleAlex Crichton-7/+11
This commit aims to prepare the `std::hash` module for alpha by formalizing its current interface whileholding off on adding `#[stable]` to the new APIs. The current usage with the `HashMap` and `HashSet` types is also reconciled by separating out composable parts of the design. The primary goal of this slight redesign is to separate the concepts of a hasher's state from a hashing algorithm itself. The primary change of this commit is to separate the `Hasher` trait into a `Hasher` and a `HashState` trait. Conceptually the old `Hasher` trait was actually just a factory for various states, but hashing had very little control over how these states were used. Additionally the old `Hasher` trait was actually fairly unrelated to hashing. This commit redesigns the existing `Hasher` trait to match what the notion of a `Hasher` normally implies with the following definition: trait Hasher { type Output; fn reset(&mut self); fn finish(&self) -> Output; } This `Hasher` trait emphasizes that hashing algorithms may produce outputs other than a `u64`, so the output type is made generic. Other than that, however, very little is assumed about a particular hasher. It is left up to implementors to provide specific methods or trait implementations to feed data into a hasher. The corresponding `Hash` trait becomes: trait Hash<H: Hasher> { fn hash(&self, &mut H); } The old default of `SipState` was removed from this trait as it's not something that we're willing to stabilize until the end of time, but the type parameter is always required to implement `Hasher`. Note that the type parameter `H` remains on the trait to enable multidispatch for specialization of hashing for particular hashers. Note that `Writer` is not mentioned in either of `Hash` or `Hasher`, it is simply used as part `derive` and the implementations for all primitive types. With these definitions, the old `Hasher` trait is realized as a new `HashState` trait in the `collections::hash_state` module as an unstable addition for now. The current definition looks like: trait HashState { type Hasher: Hasher; fn hasher(&self) -> Hasher; } The purpose of this trait is to emphasize that the one piece of functionality for implementors is that new instances of `Hasher` can be created. This conceptually represents the two keys from which more instances of a `SipHasher` can be created, and a `HashState` is what's stored in a `HashMap`, not a `Hasher`. Implementors of custom hash algorithms should implement the `Hasher` trait, and only hash algorithms intended for use in hash maps need to implement or worry about the `HashState` trait. The entire module and `HashState` infrastructure remains `#[unstable]` due to it being recently redesigned, but some other stability decision made for the `std::hash` module are: * The `Writer` trait remains `#[experimental]` as it's intended to be replaced with an `io::Writer` (more details soon). * The top-level `hash` function is `#[unstable]` as it is intended to be generic over the hashing algorithm instead of hardwired to `SipHasher` * The inner `sip` module is now private as its one export, `SipHasher` is reexported in the `hash` module. And finally, a few changes were made to the default parameters on `HashMap`. * The `RandomSipHasher` default type parameter was renamed to `RandomState`. This renaming emphasizes that it is not a hasher, but rather just state to generate hashers. It also moves away from the name "sip" as it may not always be implemented as `SipHasher`. This type lives in the `std::collections::hash_map` module as `#[unstable]` * The associated `Hasher` type of `RandomState` is creatively called... `Hasher`! This concrete structure lives next to `RandomState` as an implemenation of the "default hashing algorithm" used for a `HashMap`. Under the hood this is currently implemented as `SipHasher`, but it draws an explicit interface for now and allows us to modify the implementation over time if necessary. There are many breaking changes outlined above, and as a result this commit is a: [breaking-change]
2015-01-08Rename `target_word_size` to `target_pointer_width`Nick Cameron-6/+11
Closes #20421 [breaking-change]
2015-01-07Merge pull request #20674 from jbcrail/fix-misspelled-commentsbors-1/+1
Fix misspelled comments. Reviewed-by: steveklabnik
2015-01-06More test fixesAlex Crichton-21/+20
2015-01-06Fix misspelled comments.Joseph Crail-1/+1
I cleaned up comments prior to the 1.0 alpha release.
2015-01-06rollup merge of #20563: cmr/macro-input-future-proofingAlex Crichton-14/+14
2015-01-06rollup merge of #20650: klutzy/omg-windows-error-modeAlex Crichton-0/+7
Believe or not, `CreateProcess()` is racy if several threads create child processes: [0], [1], [2]. This caused some tests show crash dialogs during `make check-stage#-rpass`. More explanation: On Windows, `SetErrorMode()` controls display of error dialogs: it accepts new error mode and returns old error mode. The error mode is process-global and automatically inherited to child process when created. MSYS2 bash shell internally sets it to not show error dialogs, therefore `make check-stage#-rpass` should not show them either. However, [1] says that `CreateProcess()` internally invokes `SetErrorMode()` twice: at first it sets mode `0x8001` and saves original mode, and at second it restores original mode. So if two threads simultaneously call `CreateProcess()`, the first thread sets error mode to `0x8001` then the second thread recognizes that current error mode is `0x8001`. Therefore, The second thread will create process with wrong error mode. This really occurs inside `compiletest`: it creates several processes on each thread, so some `run-pass` tests are invoked with wrong error mode therefore show crash dialog. This commit adds `StaticMutex` for `CreateProcess()` call. This seems to fix the "dialog annoyance" issue. [0]: http://support.microsoft.com/kb/315939 [1]: https://code.google.com/p/nativeclient/issues/detail?id=2968 [2]: https://ghc.haskell.org/trac/ghc/ticket/2650
2015-01-06rollup merge of #20615: aturon/stab-2-threadAlex Crichton-1/+1
This commit takes a first pass at stabilizing `std::thread`: * It removes the `detach` method in favor of two constructors -- `spawn` for detached threads, `scoped` for "scoped" (i.e., must-join) threads. This addresses some of the surprise/frustrating debug sessions with the previous API, in which `spawn` produced a guard that on destruction joined the thread (unless `detach` was called). The reason to have the division in part is that `Send` will soon not imply `'static`, which means that `scoped` thread creation can take a closure over *shared stack data* of the parent thread. On the other hand, this means that the parent must not pop the relevant stack frames while the child thread is running. The `JoinGuard` is used to prevent this from happening by joining on drop (if you have not already explicitly `join`ed.) The APIs around `scoped` are future-proofed for the `Send` changes by taking an additional lifetime parameter. With the current definition of `Send`, this is forced to be `'static`, but when `Send` changes these APIs will gain their full flexibility immediately. Threads that are `spawn`ed, on the other hand, are detached from the start and do not yield an RAII guard. The hope is that, by making `scoped` an explicit opt-in with a very suggestive name, it will be drastically less likely to be caught by a surprising deadlock due to an implicit join at the end of a scope. * The module itself is marked stable. * Existing methods other than `spawn` and `scoped` are marked stable. The migration path is: ```rust Thread::spawn(f).detached() ``` becomes ```rust Thread::spawn(f) ``` while ```rust let res = Thread::spawn(f); res.join() ``` becomes ```rust let res = Thread::scoped(f); res.join() ``` [breaking-change]
2015-01-06rollup merge of #20607: nrc/kindsAlex Crichton-6/+6
Conflicts: src/libcore/array.rs src/libcore/cell.rs src/libcore/prelude.rs src/libstd/path/posix.rs src/libstd/prelude/v1.rs src/test/compile-fail/dst-sized-trait-param.rs
2015-01-06rollup merge of #20652: vhbit/thread-key-typeAlex Crichton-2/+10
This is a manual merge of #20627 and #20634 to avoid conflicts in rollup and also avoid one roundtrip. I've leave copyright to original author. If this one is moved to rollup original PR could be closed. cc @mneumann @alexcrichton r? Both FreeBSD and DragonFly define pthread_key_t as int, while Linux defines it as uint. As pthread_key_t is used as an opaque type and storage size of both int and uint are the same, this is rather a cosmetic change. iOS uses ulong (as OS X) so difference is critical on 64bit platforms.
2015-01-06rollup merge of #20612: retep998/winsizeAlex Crichton-7/+39
This calculates the width and height using the bounding box of the window in the buffer. Bounding box coordinates are inclusive so I have to add 1 to both dimensions.
2015-01-06rollup merge of #20481: seanmonstar/fmt-show-stringAlex Crichton-9/+9
Conflicts: src/compiletest/runtest.rs src/libcore/fmt/mod.rs src/libfmt_macros/lib.rs src/libregex/parse.rs src/librustc/middle/cfg/construct.rs src/librustc/middle/dataflow.rs src/librustc/middle/infer/higher_ranked/mod.rs src/librustc/middle/ty.rs src/librustc_back/archive.rs src/librustc_borrowck/borrowck/fragments.rs src/librustc_borrowck/borrowck/gather_loans/mod.rs src/librustc_resolve/lib.rs src/librustc_trans/back/link.rs src/librustc_trans/save/mod.rs src/librustc_trans/trans/base.rs src/librustc_trans/trans/callee.rs src/librustc_trans/trans/common.rs src/librustc_trans/trans/consts.rs src/librustc_trans/trans/controlflow.rs src/librustc_trans/trans/debuginfo.rs src/librustc_trans/trans/expr.rs src/librustc_trans/trans/monomorphize.rs src/librustc_typeck/astconv.rs src/librustc_typeck/check/method/mod.rs src/librustc_typeck/check/mod.rs src/librustc_typeck/check/regionck.rs src/librustc_typeck/collect.rs src/libsyntax/ext/format.rs src/libsyntax/ext/source_util.rs src/libsyntax/ext/tt/transcribe.rs src/libsyntax/parse/mod.rs src/libsyntax/parse/token.rs src/test/run-pass/issue-8898.rs