about summary refs log tree commit diff
path: root/src/libstd
AgeCommit message (Collapse)AuthorLines
2016-02-05std: Atomically set CLOEXEC for sockets if possibleAlex Crichton-0/+23
This commit adds support for creating sockets with the `SOCK_CLOEXEC` flag. Support for this flag was added in Linux 2.6.27, however, and support does not exist on platforms other than Linux. For this reason we still have the same fallback as before but just special case Linux if we can.
2016-02-05std: When duplicating fds, skip extra set_cloexecAlex Crichton-6/+15
Similar to the previous commit, if `F_DUPFD_CLOEXEC` succeeds then there's no need for us to then call `set_cloexec` on platforms other than Linux. The bug mentioned of kernels not actually setting the `CLOEXEC` flag has only been repored on Linux, not elsewhere.
2016-02-05std: Only have extra set_cloexec for files on LinuxAlex Crichton-4/+12
On Linux we have to do this for binary compatibility with 2.6.18, but for other OSes (e.g. OSX/BSDs/etc) they all support this flag so we don't need to pass it.
2016-02-05Remove MutexGuard::map, as it is not safe in combination with Condvar.Jonathan Reem-60/+1
It could return in the future if it returned a different guard type, which could not be used with Condvar, otherwise it is unsafe as another thread can invalidate an "inner" reference during a Condvar::wait. cc #27746
2016-02-05Remove an unnecessary 'static bound in the impl of Debug for Mutex.Jonathan Reem-1/+1
There is no reason to require T: 'static; the bound appears to be a historical artifact.
2016-02-05Auto merge of #30865 - alexcrichton:mtime-system-time, r=aturonbors-8/+183
These accessors are used to get at the last modification, last access, and creation time of the underlying file. Currently not all platforms provide the creation time, so that currently returns `Option`.
2016-02-04Auto merge of #31416 - steveklabnik:rollup, r=steveklabnikbors-3/+24
- Successful merges: #31007, #31396, #31401, #31411, #31412, #31413, #31415 - Failed merges:
2016-02-04Rollup merge of #31415 - tshepang:2-space-indent, r=steveklabnikSteve Klabnik-3/+3
2016-02-04Rollup merge of #31401 - frewsxcv:clarify-ascii, r=steveklabnikSteve Klabnik-0/+21
Fixes https://github.com/rust-lang/rust/issues/31203
2016-02-04doc: Rust indents are 4-space wide by conventionTshepang Lekhonkhobe-3/+3
2016-02-04std: Expose SystemTime accessors on fs::MetadataAlex Crichton-8/+183
These accessors are used to get at the last modification, last access, and creation time of the underlying file. Currently not all platforms provide the creation time, so that currently returns `Option`.
2016-02-04Auto merge of #30759 - Manishearth:attr-tls, r=alexcrichtonbors-23/+27
fixes #30756 r? @Gankro
2016-02-04Auto merge of #31360 - pitdicker:fs_tests_cleanup, r=alexcrichtonbors-183/+192
- use `symlink_file` and `symlink_dir` instead of the old `soft_link` - create a junction instead of a directory symlink for testing recursive_rmdir (as it causes the same troubles, but can be created by users without `SeCreateSymbolicLinkPrivilege`) - `remove_dir_all` was unable to remove directory symlinks and junctions - only run tests that create symlinks if we have the right permissions. - rename `Path2` to `Path` - remove the global `#[allow(deprecated)]` and outdated comments - After factoring out `create_junction()` from the test `directory_junctions_are_directories` and removing needlessly complex code, what I was left with was: ``` #[test] #[cfg(windows)] fn directory_junctions_are_directories() { use sys::fs::create_junction; let tmpdir = tmpdir(); let foo = tmpdir.join("foo"); let bar = tmpdir.join("bar"); fs::create_dir(&foo).unwrap(); check!(create_junction(&foo, &bar)); assert!(bar.metadata().unwrap().is_dir()); } ``` It test whether a junction is a directory instead of a reparse point. But it actually test the target of the junction (which is a directory if it exists) instead of the junction itself, which should always be a symlink. So this test is invalid, and I expect it only exists because the author was suprised by it. So I removed it. Some things that do not yet work right: - relative symlinks do not accept forward slashes - the conversion of paths for `create_junction` is hacky - `remove_dir_all` now messes with the internal data of `FileAttr` to be able to remove symlinks. We should add some method like `is_symlink_dir()` to it, so code outside the standard library can see the difference between file and directory symlinks too.
2016-02-04Stop using unsafe code in TLS macro expansion (fixes #30756)Manish Goregaokar-23/+27
2016-02-04Clarify scenario where AsciiExt appears to operate on non-ASCIICorey Farwell-0/+21
Fixes https://github.com/rust-lang/rust/issues/31203
2016-02-04Allow dead code for `symlink_junction()`Paul Dicker-0/+2
2016-02-04Auto merge of #31161 - sfackler:slice-to-socket-addrs, r=alexcrichtonbors-0/+11
This is useful when you have an API that takes a `T: ToSocketAddrs` and needs to turn that into an owned value which will be passed to another API taking `T: ToSocketAddrs` at a later time, for example: https://github.com/sfackler/rust-hyper-socks/blob/master/src/lib.rs#L15
2016-02-04Auto merge of #31069 - sfackler:file-try-clone, r=alexcrichtonbors-39/+87
I have it set as stable right now under the rationale that it's extending an existing, stable API to another type in the "obvious" way. r? @alexcrichton cc @reem
2016-02-04Implement ToSocketAddrs for &[SocketAddr]Steven Fackler-0/+11
2016-02-04Add File::try_cloneSteven Fackler-39/+87
2016-02-04Auto merge of #30796 - GuillaumeGomez:impl_box_error, r=alexcrichtonbors-0/+11
Fixes #30349
2016-02-03Auto merge of #31078 - nbaksalyar:illumos, r=alexcrichtonbors-30/+272
This pull request adds support for [Illumos](http://illumos.org/)-based operating systems: SmartOS, OpenIndiana, and others. For now it's x86-64 only, as I'm not sure if 32-bit installations are widespread. This PR is based on #28589 by @potatosalad, and also closes #21000, #25845, and #25846. Required changes in libc are already merged: https://github.com/rust-lang-nursery/libc/pull/138 Here's a snapshot required to build a stage0 compiler: https://s3-eu-west-1.amazonaws.com/nbaksalyar/rustc-sunos-snapshot.tar.gz It passes all checks from `make check`. There are some changes I'm not quite sure about, e.g. macro usage in `src/libstd/num/f64.rs` and `DirEntry` structure in `src/libstd/sys/unix/fs.rs`, so any comments on how to rewrite it better would be greatly appreciated. Also, LLVM configure script might need to be patched to build it successfully, or a pre-built libLLVM should be used. Some details can be found here: https://llvm.org/bugs/show_bug.cgi?id=25409 Thanks! r? @brson
2016-02-03Auto merge of #30834 - reem:rwlock-read-guard-map, r=alexcrichtonbors-57/+228
This is very useful when the RwLock 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-02-03Reformat commentsPaul Dicker-12/+13
2016-02-03Adress commentsPaul Dicker-29/+63
2016-02-03Auto merge of #31056 - kamalmarhubi:std-process-nul-chars, r=alexcrichtonbors-52/+163
This reports an error at the point of calling `Command::spawn()` or one of its equivalents. Fixes #30858 Fixes #30862
2016-02-03std: Properly handle interior NULs in std::processKamal Marhubi-52/+163
This reports an error at the point of calling `Command::spawn()` or one of its equivalents. Fixes https://github.com/rust-lang/rust/issues/30858 Fixes https://github.com/rust-lang/rust/issues/30862
2016-02-03Fix broken auto-mac-ios-opt buildNikita Baksalyar-27/+23
2016-02-03Auto merge of #31375 - nagisa:path-docs, r=alexcrichtonbors-29/+51
2016-02-02trying again at fixing stackp initializationDave Huseby-3/+18
2016-02-02simplifying get_stackDave Huseby-24/+3
2016-02-02refactoring get_stack to be cleanerDave Huseby-27/+20
2016-02-02unifying name_bytes now that the two blocks are the sameDave Huseby-8/+2
2016-02-02Fixes #31229Dave Huseby-10/+35
2016-02-03Auto merge of #31370 - Manishearth:rollup, r=Manishearthbors-0/+3
- Successful merges: #27499, #31220, #31329, #31332, #31347, #31351, #31352, #31366 - Failed merges:
2016-02-02Add issue number to guard map methods.Jonathan Reem-49/+78
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