about summary refs log tree commit diff
path: root/src/libstd
AgeCommit message (Collapse)AuthorLines
2016-01-31Fix problems with f64 and DirEntry on IllumosNikita Baksalyar-67/+37
2016-01-31Apply several fixes for Illumos supportNikita Baksalyar-39/+76
2016-01-31Add Illumos supportNikita Baksalyar-29/+268
2016-01-31Auto merge of #31298 - japaric:mips-musl, r=alexcrichtonbors-2/+12
This target covers MIPS devices that run the trunk version of OpenWRT. The x86_64-unknown-linux-musl target always links statically to C libraries. For the mips(el)-unknown-linux-musl target, we opt for dynamic linking (like most of other targets do) to keep binary size down. As for the C compiler flags used in the build system, we use the same flags used for the mips(el)-unknown-linux-gnu target. r? @alexcrichton
2016-01-30Change MutexGuard and RwLockWriteGuard to store &mut T not &UnsafeCell<T>Jonathan Reem-38/+46
This centralizes the unsafety of converting from UnsafeCell<T> to &mut T.
2016-01-30Rollup merge of #31292 - alexcrichton:osx-dtors-in-dtors-in-dtors, r=aturonManish Goregaokar-0/+25
This test has been deadlocking and causing problems on the bots basically since its inception. Some memory safety issues were fixed in 987dc84b, but the deadlocks remained afterwards unfortunately. After some investigation, I've concluded that this is just a situation where OSX is not guaranteed to run destructors. The fix in 987dc84b observed that OSX was rewriting the backing TLS memory to its initial state during destruction while we weren't looking, and this would have the effect of canceling the destructors of any other initialized TLS slots. While very difficult to pin down, this is basically what I assume is happening here, so there doesn't seem to really be anythig we can do to ensure the test robustly passes on OSX, so just ignore it for now.
2016-01-29Add guard map methods for transforming guards to contain sub-borrows.Jonathan Reem-5/+139
This is very useful when the lock is synchronizing access to a data structure and you would like to return or store guards which contain references to data inside the data structure instead of the data structure itself.
2016-01-30Auto merge of #30448 - alexcrichton:llvmup, r=nikomatsakisbors-114/+199
These commits perform a few high-level changes with the goal of enabling i686 MSVC unwinding: * LLVM is upgraded to pick up the new exception handling instructions and intrinsics for MSVC. This puts us somewhere along the 3.8 branch, but we should still be compatible with LLVM 3.7 for non-MSVC targets. * All unwinding for MSVC targets (both 32 and 64-bit) are implemented in terms of this new LLVM support. I would like to also extend this to Windows GNU targets to drop the runtime dependencies we have on MinGW, but I'd like to land this first. * Some tests were fixed up for i686 MSVC here and there where necessary. The full test suite should be passing now for that target. In terms of landing this I plan to have this go through first, then verify that i686 MSVC works, then I'll enable `make check` on the bots for that target instead of just `make` as-is today. Closes #25869
2016-01-29trans: Reimplement unwinding on MSVCAlex Crichton-114/+199
This commit transitions the compiler to using the new exception handling instructions in LLVM for implementing unwinding for MSVC. This affects both 32 and 64-bit MSVC as they're both now using SEH-based strategies. In terms of standard library support, lots more details about how SEH unwinding is implemented can be found in the commits. In terms of trans, this change necessitated a few modifications: * Branches were added to detect when the old landingpad instruction is used or the new cleanuppad instruction is used to `trans::cleanup`. * The return value from `cleanuppad` is not stored in an `alloca` (because it cannot be). * Each block in trans now has an `Option<LandingPad>` instead of `is_lpad: bool` for indicating whether it's in a landing pad or not. The new exception handling intrinsics require that on MSVC each `call` inside of a landing pad is annotated with which landing pad that it's in. This change to the basic block means that whenever a `call` or `invoke` instruction is generated we know whether to annotate it as part of a cleanuppad or not. * Lots of modifications were made to the instruction builders to construct the new instructions as well as pass the tagging information for the call/invoke instructions. * The translation of the `try` intrinsics for MSVC has been overhauled to use the new `catchpad` instruction. The filter function is now also a rustc-generated function instead of a purely libstd-defined function. The libstd definition still exists, it just has a stable ABI across architectures and leaves some of the really weird implementation details to the compiler (e.g. the `localescape` and `localrecover` intrinsics).
2016-01-29add support for mips(el)-unknown-linux-muslJorge Aparicio-2/+12
This target covers MIPS devices that run the trunk version of OpenWRT. The x86_64-unknown-linux-musl target always links statically to C libraries. For the mips(el)-unknown-linux-musl target, we opt for dynamic linking (like most of other targets do) to keep binary size down. As for the C compiler flags used in the build system, we use the same flags used for the mips(el)-unknown-linux-gnu target.
2016-01-29std: Ignore dtors_in_dtors_in_dtors on OSXAlex Crichton-0/+25
This test has been deadlocking and causing problems on the bots basically since its inception. Some memory safety issues were fixed in 987dc84b, but the deadlocks remained afterwards unfortunately. After some investigation, I've concluded that this is just a situation where OSX is not guaranteed to run destructors. The fix in 987dc84b observed that OSX was rewriting the backing TLS memory to its initial state during destruction while we weren't looking, and this would have the effect of canceling the destructors of any other initialized TLS slots. While very difficult to pin down, this is basically what I assume is happening here, so there doesn't seem to really be anythig we can do to ensure the test robustly passes on OSX, so just ignore it for now.
2016-01-28std: Fix rumprun buildAlex Crichton-4/+9
Looks like the rumprun build has bitrotted over time, so this includes some libc fixes and some various libstd fixes which gets it back to bootstrapping.
2016-01-28Auto merge of #31171 - dirk:dirk/safety-section-in-cstring-docs, r=steveklabnikbors-4/+16
Also a minor language tweak to the documentation of the `ffi::CString::from_raw` function.
2016-01-27Fix formatting in documentation of `ffi::CString`Dirk Gadsden-2/+2
2016-01-26Auto merge of #31120 - alexcrichton:attribute-deny-warnings, r=brsonbors-110/+129
This commit removes the `-D warnings` flag being passed through the makefiles to all crates to instead be a crate attribute. We want these attributes always applied for all our standard builds, and this is more amenable to Cargo-based builds as well. Note that all `deny(warnings)` attributes are gated with a `cfg(stage0)` attribute currently to match the same semantics we have today
2016-01-26Auto merge of #31081 - alexcrichton:stabilize-hasher, r=aturonbors-122/+129
This commit implements the stabilization of the custom hasher support intended for 1.7 but left out due to some last-minute questions that needed some decisions. A summary of the actions done in this PR are: Stable * `std::hash::BuildHasher` * `BuildHasher::Hasher` * `BuildHasher::build_hasher` * `std::hash::BuildHasherDefault` * `HashMap::with_hasher` * `HashMap::with_capacity_and_hasher` * `HashSet::with_hasher` * `HashSet::with_capacity_and_hasher` * `std::collections::hash_map::RandomState` * `RandomState::new` Deprecated * `std::collections::hash_state` * `std::collections::hash_state::HashState` - this trait was also moved into `std::hash` with a reexport here to ensure that we can have a blanket impl to prevent immediate breakage on nightly. Note that this is unstable in both location. * `HashMap::with_hash_state` - renamed * `HashMap::with_capacity_and_hash_state` - renamed * `HashSet::with_hash_state` - renamed * `HashSet::with_capacity_and_hash_state` - renamed Closes #27713
2016-01-26Fix warnings during testsAlex Crichton-110/+128
The deny(warnings) attribute is now enabled for tests so we need to weed out these warnings as well.
2016-01-26Auto merge of #30402 - jooert:prettypanic, r=alexcrichtonbors-0/+5
This splits the output of panics into two lines as proposed in #15239 and adds a note about how to get a backtrace. Because the default panic message consists of multiple lines now, this changes the test runner's failure output to not indent the first line anymore. Fixes #15239 and fixes #11704.
2016-01-26std: Stabilize custom hasher support in HashMapAlex Crichton-122/+129
This commit implements the stabilization of the custom hasher support intended for 1.7 but left out due to some last-minute questions that needed some decisions. A summary of the actions done in this PR are: Stable * `std::hash::BuildHasher` * `BuildHasher::Hasher` * `BuildHasher::build_hasher` * `std::hash::BuildHasherDefault` * `HashMap::with_hasher` * `HashMap::with_capacity_and_hasher` * `HashSet::with_hasher` * `HashSet::with_capacity_and_hasher` * `std::collections::hash_map::RandomState` * `RandomState::new` Deprecated * `std::collections::hash_state` * `std::collections::hash_state::HashState` - this trait was also moved into `std::hash` with a reexport here to ensure that we can have a blanket impl to prevent immediate breakage on nightly. Note that this is unstable in both location. * `HashMap::with_hash_state` - renamed * `HashMap::with_capacity_and_hash_state` - renamed * `HashSet::with_hash_state` - renamed * `HashSet::with_capacity_and_hash_state` - renamed Closes #27713
2016-01-26Add message about RUST_BACKTRACE to default output of panic!Johannes Oertel-0/+5
The note will only be shown on the first panic.
2016-01-25std: Fix some behavior without stdio handlesAlex Crichton-4/+9
On all platforms, reading from stdin where the actual stdin isn't present should return 0 bytes as having been read rather than the entire buffer. On Windows, handle the case where we're inheriting stdio handles but one of them isn't present. Currently the behavior is to fail returning an I/O error but instead this commit corrects it to detecting this situation and propagating the non-set handle. Closes #31167
2016-01-24mk: Move from `-D warnings` to `#![deny(warnings)]`Alex Crichton-0/+1
This commit removes the `-D warnings` flag being passed through the makefiles to all crates to instead be a crate attribute. We want these attributes always applied for all our standard builds, and this is more amenable to Cargo-based builds as well. Note that all `deny(warnings)` attributes are gated with a `cfg(stage0)` attribute currently to match the same semantics we have today
2016-01-24Add section about memory safety to `ffi::CString` documentationDirk Gadsden-3/+15
Also a minor language tweak to the documentation of the `ffi::CString::from_raw` function.
2016-01-24Auto merge of #31166 - geofft:process-comments, r=alexcrichtonbors-9/+6
The implementation changed in 33a2191d, but the comments did not change to match. r? @alexcrichton
2016-01-24Auto merge of #31093 - tshepang:misc-doc-improvements, r=steveklabnikbors-5/+5
2016-01-24sys/unix/process.rs: Update comments in make_argv and make_envpGeoffrey Thomas-9/+6
The implementation changed in 33a2191d, but the comments did not change to match.
2016-01-24doc: miscellaneous OpenOptions:append improvementsTshepang Lekhonkhobe-5/+5
2016-01-23Rollup merge of #31146 - angelsl:patch-1, r=steveklabnikSteve Klabnik-1/+1
2016-01-23Rollup merge of #31090 - tshepang:improve-sentence, r=brsonSteve Klabnik-2/+2
2016-01-23Rollup merge of #31088 - tshepang:grammar, r=brsonSteve Klabnik-1/+1
2016-01-23Rollup merge of #31035 - nathankleyn:improve-visibility-of-entry-api, ↵Steve Klabnik-0/+29
r=steveklabnik Responding to [a thread of discussion on the Rust subreddit](https://www.reddit.com/r/rust/comments/3racik/mutable_lifetimes_are_too_long_when_matching_an/), it was identified that the presence of the Entry API is not duly publicised. This commit aims to add some reasonable examples of common usages of this API to the main example secion of the `HashMap` documentation. This is part of issue #29348.
2016-01-23Rollup merge of #31019 - andreabedini:patch-1, r=alexcrichtonSteve Klabnik-3/+1
Documentation of `CStr::from_ptr` suggests using `str::from_utf8(slice.to_bytes()).unwrap()` to obtain a `&str` but `CStr` has `CStr::to_str` that does exactly that. (First PR, be nice :)
2016-01-23Semaphore not sempahoreangelsl-1/+1
2016-01-23Impl Error for Box<T: Error>Guillaume Gomez-0/+11
2016-01-22Simplify return for error::Error impl for string::ParseErrorDirk Gadsden-1/+1
2016-01-22Implement error::Error and fmt::Display for string::ParseErrorDirk Gadsden-0/+7
Fixes #31106.
2016-01-22Auto merge of #31070 - sfackler:bufreader-box-slice, r=alexcrichtonbors-2/+2
Saves a word, and also prevents the impl from accidentally changing the buffer length. r? @alexcrichton
2016-01-22Auto merge of #31068 - sfackler:bufwriter-panic, r=alexcrichtonbors-3/+40
We don't want to write the same data twice. Closes #30888 r? @alexcrichton
2016-01-21doc: this sentence did not read wellTshepang Lekhonkhobe-2/+2
2016-01-21doc: improve grammarTshepang Lekhonkhobe-1/+1
2016-01-21Auto merge of #31057 - bluss:memrchr-fallback, r=alexcrichtonbors-1/+1
Use the fallback impl for memrchr on non-linux The memrchr code was never used(!). This brings the memrchr improvements to non-linux platforms (LineWriter / buffered stdout benefits). Previous PR #30381
2016-01-20Use a Box<[u8]> in BufReaderSteven Fackler-2/+2
Saves a word, and also prevents the impl from accidentally changing the buffer length.
2016-01-20Don't flush in BufWriter destructor after a panic in writeSteven Fackler-3/+40
We don't want to write the same data twice. Closes #30888
2016-01-20Auto merge of #30872 - pitdicker:expand_open_options, r=alexcrichtonbors-177/+480
Tracking issue: #30014 This implements the RFC and makes a few other changes. I have added a few extra tests, and made the Windows and Unix code as similar as possible. Part of the RFC mentions the unstable OpenOptionsExt trait on Windows (see #27720). I have added a few extra methods to future-proof it for CreateFile2.
2016-01-20std: Use the fallback impl for memrchr on non-linuxUlrik Sverdrup-1/+1
This code was never used(!). This brings the memrchr improvements to non-linux platforms (LineWriter / buffered stdout benefits).
2016-01-20Remove raw pointer from OpenOptions structPaul Dicker-3/+9
Otherwise it is not Send and Sync anymore
2016-01-20Auto merge of #30894 - antrik:debug-mpsc, r=brsonbors-0/+69
Minimal fix for https://github.com/rust-lang/rust/issues/30563 This covers all the public structs I think; except for Iter and IntoIter, which I don't know if or how they should be handled.
2016-01-20Remove leftover import of `std::str` in doc testAndrea Bedini-1/+0
2016-01-19Add examples of the Entry API to the HashMap documentation.Nathan Kleyn-0/+29
Responding to [a thread of discussion on the Rust subreddit](https://www.reddit.com/r/rust/comments/3racik/mutable_lifetimes_are_too_long_when_matching_an/), it was identified that the presence of the Entry API is not duly publicised. This commit aims to add some reasonable examples of common usages of this API to the main example secion of the `HashMap` documentation. This is part of issue #29348.
2016-01-19Improve CStr::from_ptr example in docsAndrea Bedini-2/+1
Documentation of `CStr::from_ptr` suggests using `str::from_utf8(slice.to_bytes()).unwrap()` to obtain a `&str` but `CStr` has `CStr::to_str` that does exactly that.