summary refs log tree commit diff
path: root/src/libstd
AgeCommit message (Collapse)AuthorLines
2016-02-03Improve docs for Path::methodsSimonas Kazlauskas-29/+51
2016-02-03Rollup merge of #27499 - barosl:macro-doc-raw-str-hashes, r=nikomatsakisManish Goregaokar-0/+3
Any documentation comments that contain raw-string-looking sequences may pretty-print invalid code when expanding them, as the current logic always uses the `r"literal"` form, without appending any `#`s. This commit calculates the minimum number of `#`s required to wrap a comment correctly and appends `#`s appropriately. Fixes #27489.
2016-02-02Auto merge of #31312 - alexcrichton:no-le-in-powerpc64le, r=alexcrichtonbors-33/+11
Currently the `mipsel-unknown-linux-gnu` target doesn't actually set the `target_arch` value to `mipsel` but it rather uses `mips`. Alternatively the `powerpc64le` target does indeed set the `target_arch` as `powerpc64le`, causing a bit of inconsistency between theset two. As these are just the same instance of one instruction set, let's use `target_endian` to switch between them and only set the `target_arch` as one value. This should cut down on the number of `#[cfg]` annotations necessary and all around be a little more ergonomic.
2016-02-02Auto merge of #30991 - rthomas:master, r=Gankrobors-1/+29
Using the test @bluss suggested in #30983
2016-02-02Ensure capacity returned of HashMap is max(capacity, length).Ryan Thomas-1/+29
r? @Gankro
2016-02-02Enable more fs tests on WindowsPaul Dicker-171/+143
2016-02-02Rollup merge of #31345 - kamalmarhubi:book-docs-special-section-errors, ↵Steve Klabnik-14/+14
r=steveklabnik This matches the usage in the standard library's documentation.
2016-02-01Remove "powerpc64le" and "mipsel" target_archAlex Crichton-33/+11
Currently the `mipsel-unknown-linux-gnu` target doesn't actually set the `target_arch` value to `mipsel` but it rather uses `mips`. Alternatively the `powerpc64le` target does indeed set the `target_arch` as `powerpc64le`, causing a bit of inconsistency between theset two. As these are just the same instance of one instruction set, let's use `target_endian` to switch between them and only set the `target_arch` as one value. This should cut down on the number of `#[cfg]` annotations necessary and all around be a little more ergonomic.
2016-02-01docs: Standardize on 'Errors' header in std docsKamal Marhubi-14/+14
2016-02-01Add AsciiExt::into_ascii_{upper,lower}caseSimon Sapin-0/+106
The default implementations (with where Self: Sized) are so that methods that take `self` by value can exist in a trait that’s implemented for dynamically-sized types (`str` and `[u8]`). CC https://github.com/rust-lang/rust/issues/27809#issuecomment-177564950
2016-01-31Minor corrections in docs for `std::process::Child`Dirk Gadsden-4/+6
2016-01-31Safety docs about `std::process::Child` going out of scopeDirk Gadsden-0/+8
There is no `Drop` implemented for `Child`, so if it goes out of scope in Rust-land and gets deallocated, the child process will continue to exist and execute. If users want a guarantee that the process has finished running and exited they must manually use `kill`, `wait`, or `wait_with_output`. Fixes #31289.
2016-01-31Fix unresolved name in libstd/sys/unix/threadNikita Baksalyar-1/+1
2016-01-31Rename sunos to solarisNikita Baksalyar-37/+37
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.