about summary refs log tree commit diff
path: root/src/libstd
AgeCommit message (Collapse)AuthorLines
2017-07-10Use LocalKey::try_with in stdLee Bousfield-22/+11
2017-07-10Add LocalKey::try_with as an alternative to stateLee Bousfield-0/+52
2017-07-10Correct some stability attributesOliver Middleton-4/+4
These show up in rustdoc so need to be correct.
2017-07-09Add warning to BufWriter documentationJohn Gallagher-1/+5
2017-07-09Auto merge of #43082 - ids1024:condvar2, r=alexcrichtonbors-3/+1
Redox: Fix Condvar.wait(); do not lock mutex twice The atomic_xchg() loop locks the mutex, so the call to mutex_lock is incorrect, and blocks.
2017-07-08Auto merge of #43104 - nbaksalyar:rustbuild-illumos-fix, r=sanxiynbors-0/+4
Fix Rustbuild linking on Illumos Illumos (an OpenSolaris fork) expects to get several extra library references for some system functions used by Rust standard library. This commit adds required linker options to rustbuild, which is currently doesn't work on Illumos-based operating systems.
2017-07-08Auto merge of #43072 - cuviper:linux-stack-guard, r=alexcrichtonbors-15/+29
Skip the main thread's manual stack guard on Linux Linux doesn't allocate the whole stack right away, and the kernel has its own stack-guard mechanism to fault when growing too close to an existing mapping. If we map our own guard, then the kernel starts enforcing a rather large gap above that, rendering much of the possible stack space useless. Instead, we'll just note where we expect rlimit to start faulting, so our handler can report "stack overflow", and trust that the kernel's own stack guard will work. Fixes #43052. r? @alexcrichton ### Kernel compatibility: Strictly speaking, Rust claims support for Linux kernels >= 2.6.18, and stack guards were only added to mainline in 2.6.36 for [CVE-2010-2240]. But since that vulnerability was so severe, the guards were backported to many stable branches, and Red Hat patched this all the way back to RHEL3's 2.4.21! I think it's reasonable for us to assume that any *supportable* kernel should have these stack guards. At that time, the kernel only enforced one page of padding between the stack and other mappings, but thanks to [Stack Clash] that padding is now much larger, causing #43052. The kernel side of those fixes are in [CVE-2017-1000364], which Red Hat has backported to at least RHEL5's 2.6.18 so far. [CVE-2010-2240]: https://access.redhat.com/security/cve/CVE-2010-2240 [CVE-2017-1000364]: https://access.redhat.com/security/cve/CVE-2017-1000364 [Stack Clash]: https://access.redhat.com/security/vulnerabilities/stackguard
2017-07-07Auto merge of #42809 - seanmonstar:stable-associated-consts, r=nikomatsakisbors-1/+1
remove associated_consts feature gate Currently struggling to run tests locally (something about jemalloc target missing). cc #29646
2017-07-07Skip the main thread's manual stack guard on LinuxJosh Stone-15/+29
Linux doesn't allocate the whole stack right away, and the kernel has its own stack-guard mechanism to fault when growing too close to an existing mapping. If we map our own guard, then the kernel starts enforcing a rather large gap above that, rendering much of the possible stack space useless. Instead, we'll just note where we expect rlimit to start faulting, so our handler can report "stack overflow", and trust that the kernel's own stack guard will work. Fixes #43052.
2017-07-07Redox: Fix Condvar.wait(); do not lock mutex twiceIan Douglas Scott-3/+1
The atomic_xchg() loop locks the mutex, so the call to mutex_lock is incorrect, and blocks.
2017-07-07Auto merge of #43093 - rthomas:39791-hashmap, r=alexcrichtonbors-0/+2
Add annotations to the resize fn #39791 This adds the `inline(never)` and `cold` annotations to the HashMap::resize function.
2017-07-07Fix Rustbuild linking on IllumosNikita Baksalyar-0/+4
Illumos (an OpenSolaris fork) expects to get several extra library references for some system functions used by Rust standard library. This commit adds required linker options to rustbuild, which is currently doesn't work on Illumos-based operating systems.
2017-07-06Implement TcpStream::connect_timeoutSteven Fackler-2/+193
This breaks the "single syscall rule", but it's really annoying to hand write and is pretty foundational.
2017-07-06Redox: add stat methods(); support is_symlink()Ian Douglas Scott-2/+17
2017-07-06Add annotations to the resize fn #39791Ryan Thomas-0/+2
This adds the `inline(never)` and `cold` annotations to the HashMap::resize function.
2017-07-06remove associated_consts feature gateSean McArthur-1/+1
2017-07-06Stabilize float_bits_convest31-9/+4
2017-07-06Auto merge of #42899 - alexcrichton:compiler-builtins, r=nikomatsakisbors-1/+1
Switch to rust-lang-nursery/compiler-builtins This commit migrates the in-tree `libcompiler_builtins` to the upstream version at https://github.com/rust-lang-nursery/compiler-builtins. The upstream version has a number of intrinsics written in Rust and serves as an in-progress rewrite of compiler-rt into Rust. Additionally it also contains all the existing intrinsics defined in `libcompiler_builtins` for 128-bit integers. It's been the intention since the beginning to make this transition but previously it just lacked the manpower to get done. As this PR likely shows it wasn't a trivial integration! Some highlight changes are: * The PR rust-lang-nursery/compiler-builtins#166 contains a number of fixes across platforms and also some refactorings to make the intrinsics easier to read. The additional testing added there also fixed a number of integration issues when pulling the repository into this tree. * LTO with the compiler-builtins crate was fixed to link in the entire crate after the LTO process as these intrinsics are excluded from LTO. * Treatment of hidden symbols was updated as previously the `#![compiler_builtins]` crate would mark all symbol *imports* as hidden whereas it was only intended to mark *exports* as hidden.
2017-07-06Auto merge of #42727 - alexcrichton:allocators-new, r=eddybbors-54/+178
rustc: Implement the #[global_allocator] attribute This PR is an implementation of [RFC 1974] which specifies a new method of defining a global allocator for a program. This obsoletes the old `#![allocator]` attribute and also removes support for it. [RFC 1974]: https://github.com/rust-lang/rfcs/pull/1974 The new `#[global_allocator]` attribute solves many issues encountered with the `#![allocator]` attribute such as composition and restrictions on the crate graph itself. The compiler now has much more control over the ABI of the allocator and how it's implemented, allowing much more freedom in terms of how this feature is implemented. cc #27389
2017-07-05Be more specific about the implications of the panic!Stefan Schindler-1/+1
2017-07-05rustc: Implement the #[global_allocator] attributeAlex Crichton-54/+178
This PR is an implementation of [RFC 1974] which specifies a new method of defining a global allocator for a program. This obsoletes the old `#![allocator]` attribute and also removes support for it. [RFC 1974]: https://github.com/rust-lang/rfcs/pull/197 The new `#[global_allocator]` attribute solves many issues encountered with the `#![allocator]` attribute such as composition and restrictions on the crate graph itself. The compiler now has much more control over the ABI of the allocator and how it's implemented, allowing much more freedom in terms of how this feature is implemented. cc #27389
2017-07-05Insert current implementation headerStefan Schindler-0/+2
2017-07-05Switch to rust-lang-nursery/compiler-builtinsAlex Crichton-1/+1
This commit migrates the in-tree `libcompiler_builtins` to the upstream version at https://github.com/rust-lang-nursery/compiler-builtins. The upstream version has a number of intrinsics written in Rust and serves as an in-progress rewrite of compiler-rt into Rust. Additionally it also contains all the existing intrinsics defined in `libcompiler_builtins` for 128-bit integers. It's been the intention since the beginning to make this transition but previously it just lacked the manpower to get done. As this PR likely shows it wasn't a trivial integration! Some highlight changes are: * The PR rust-lang-nursery/compiler-builtins#166 contains a number of fixes across platforms and also some refactorings to make the intrinsics easier to read. The additional testing added there also fixed a number of integration issues when pulling the repository into this tree. * LTO with the compiler-builtins crate was fixed to link in the entire crate after the LTO process as these intrinsics are excluded from LTO. * Treatment of hidden symbols was updated as previously the `#![compiler_builtins]` crate would mark all symbol *imports* as hidden whereas it was only intended to mark *exports* as hidden.
2017-07-04Auto merge of #43051 - Mark-Simulacrum:rollup, r=Mark-Simulacrumbors-18/+27
Rollup of 8 pull requests - Successful merges: #42227, #42836, #42975, #42994, #43041, #43042, #43043, #43045 - Failed merges:
2017-07-04Rollup merge of #42975 - ids1024:symlink2, r=aturonMark Simulacrum-6/+15
redox: symlink and readlink
2017-07-04Rollup merge of #42227 - ollie27:into_to_from, r=aturonMark Simulacrum-12/+12
Convert Intos to Froms. This is a resubmission of #42129 without `impl<T> From<Vec<T>> for Box<[T]>`.
2017-07-04Auto merge of #43025 - est31:nan_cross_platform, r=BurntSushibors-13/+24
Make sNaN removal code tolerate different sNaN encodings IEEE 754-1985 specifies the encoding of NaN floating point numbers, but while it mentions that NaNs can be subdivided into signaling and quiet ones, it doesn't fix the encoding of signaling NaNs in binary formats. This led to different implementations (CPUs) having different encodings. IEEE 754-2008 finally specified the encoding of signaling NaNs but some architectures are compatible with it, while others aren't. Certain MIPS and PA-RISC CPUs have different encodings for signaling NaNs. In order to have the float <-> binary cast feature of the std library be portable to them, we don't mask any quiet NaNs like we did before (only being compliant to IEEE 754-2008 and nothing else), but instead we simply pass a known good NaN instead. Note that in the code removed there was a bug; the 64 bit mask for quiet NaNs should have been `0x0008000000000000` instead of the specified `0x0001000000000000`.
2017-07-03Make sNaN removal code tolerate different sNaN encodingsest31-13/+24
IEEE 754-1985 specifies the encoding of NaN floating point numbers, but while it mentions that NaNs can be subdivided into signaling and quiet ones, it doesn't fix the encoding of signaling NaNs in binary formats. This led to different implementations (CPUs) having different encodings. IEEE 754-2008 finally specified the encoding of signaling NaNs but some architectures are compatible with it, while others aren't. Certain MIPS and PA-RISC CPUs have different encodings for signaling NaNs. In order to have the float <-> binary cast feature of the std library be portable to them, we don't mask any quiet NaNs like we did before (only being compliant to IEEE 754-2008 and nothing else), but instead we simply pass a known good NaN instead. Note that in the code removed there was a bug; the 64 bit mask for quiet NaNs should have been `0x0008000000000000` instead of the specified `0x0001000000000000`.
2017-07-03Auto merge of #42976 - ids1024:redoxfix, r=sfacklerbors-1/+5
Fix Redox build, apparently broken by #42687
2017-07-02Fix the test failure, add comment, and refactor a little bitest31-2/+17
2017-07-02Output line column info when panickingest31-17/+64
2017-07-01Auto merge of #43002 - SergioBenitez:more-io-inner-stable, r=BurntSushibors-15/+5
Stabilize 'more_io_inner_methods' feature. As in the title. Closes #41519.
2017-07-01Auto merge of #42991 - sfackler:unstable-rangeargument, r=alexcrichtonbors-2/+0
Revert "Stabilize RangeArgument" This reverts commit 143206d54d7558c2326212df99efc98110904fdb. From the discussion in #30877 it seems like this is premature.
2017-06-30Stabilize 'more_io_inner_methods' feature.Sergio Benitez-15/+5
2017-06-30Rollup merge of #42925 - tbu-:pr_document_file_open_errors, r=GuillaumeGomezGuillaume Gomez-9/+30
Document possible `io::ErrorKind`s of `fs::open` Try to make clear that this isn't an API guarantee for now, as we likely want to refine these errors in the future, e.g. `ENOSPC` "No space left on device". CC #40322
2017-06-30Fix long lineIan Douglas Scott-1/+2
2017-06-30Revert "Stabilize RangeArgument"Steven Fackler-2/+0
This reverts commit 143206d54d7558c2326212df99efc98110904fdb.
2017-06-29Fix Redox build, apparently broken by #42687Ian Douglas Scott-1/+5
2017-06-29redox: symlink and readlinkIan Douglas Scott-4/+12
2017-06-29Rollup merge of #42955 - matklad:doc-path, r=steveklabnikAriel Ben-Yehuda-6/+7
Document that `/` works as separator on Windows Hi Whenever I see code like `Path::new("./src/bin/main.rs")` or `path.ends_with("foo/bar")`, I wonder if it will work on Windows as I expect. Unfortunately, reading the current docs does not help to answer this question, because all examples are Unix-specific. However, I believe that using `/` is fine, because both Windows itself [and Rust stdlib](https://github.com/rust-lang/rust/blob/47faf1d51952ecd9d4c8a7325332fba34fbe00bd/src/libstd/sys/windows/path.rs#L26) do treat it as a file separator, and because it is [actually used](https://github.com/rust-lang/cargo/blob/abf01e1eddb3145c83f71b469ea7bee37141e5e1/tests/git.rs#L579) in Cargo. So looks like we can just document it? r? @steveklabnik cc @retep998 I don't actually program for windows that much, so I might be totally wrong, and perhaps we should advise to always use (allocating) `.join` method to construct paths of more than one component?
2017-06-29Rollup merge of #42884 - stepancheg:set-env-run-pass, r=alexcrichtonAriel Ben-Yehuda-81/+1
Move global vars changing tests into run-pass Should fix race #42795
2017-06-29Auto merge of #42848 - ids1024:redox-fix, r=sfacklerbors-3/+2
Fix Redox build, broken in ecbb896b9eb2acadefde57be493e4298c1aa04a3
2017-06-28Document that `/` works as separator on WindowsAleksey Kladov-6/+7
2017-06-28Auto merge of #42745 - sfackler:1.19-stabilization, r=alexcrichtonbors-14/+6
1.19 stabilization r? @alexcrichton
2017-06-28Add links to the `ErrorKind` variants in errors of `open`Tobias Bucher-11/+16
2017-06-28Auto merge of #42431 - nagisa:core-float-2, r=alexcrichtonbors-34/+16
Fix NaN handling in is_sign_negative/positive This would be my proposed fix for the #42425 provided we decide it is indeed a problem. Note this would technically be a breaking change to a stable API. We might want to consider deprecating these methods and adding new ones.
2017-06-27Document possible `io::ErrorKind`s of `fs::open`Tobias Bucher-9/+25
Try to make clear that this isn't an API guarantee for now, as we likely want to refine these errors in the future, e.g. `ENOSPC` "No space left on device". CC #40322
2017-06-26Rollup merge of #42905 - casey:casey-utf8-null-doc, r=steveklabnikCorey Farwell-1/+1
Reword OsStr docs to clarify that utf8 may contain nulls The use of the word "but" in the OsStr docs implies (at least to me) that valid UTF-8 does not contain null bytes. Using "which" instead makes it clear that valid UTF-8 may contain null bytes.
2017-06-25Reword OsStr docs to clarify that utf8 may contain nullsCasey Rodarmor-1/+1
2017-06-24Stabilize RangeArgumentSteven Fackler-0/+2
Move it and Bound to core::ops while we're at it. Closes #30877