about summary refs log tree commit diff
path: root/src/libstd
AgeCommit message (Collapse)AuthorLines
2016-09-18Add basic doc examples for `std::panic::{set_hook, take_hook}`.Corey Farwell-0/+30
2016-09-18Add missing Eq implementationsGuillaume Gomez-6/+6
2016-09-17Clean up hasher discussion on HashMapSteven Fackler-8/+22
* We never want to make guarantees about protecting against attacks. * "True randomness" is not the right terminology to be using in this context. * There is significantly more nuance to the performance of SipHash than "somewhat slow".
2016-09-16Add links between format_args! macro and std::fmt::Arguments structMark-Simulacrum-4/+10
2016-09-16Rollup merge of #36480 - tshepang:stronger-pause, r=steveklabnikJonathan Turner-2/+2
doc: make that sound better
2016-09-16Update to new macro url syntaxGuillaume Gomez-1/+1
2016-09-15Rollup merge of #36463 - eugene-bulkin:duration-checked-ops, r=alexcrichtonManish Goregaokar-35/+182
Add checked operation methods to Duration Addresses #35774.
2016-09-14Add feature crate attribute for duration_checked_ops to docsEugene Bulkin-0/+8
2016-09-14Fix doc-tests for DurationEugene Bulkin-2/+10
2016-09-14doc: make that sound betterTshepang Lekhonkhobe-2/+2
2016-09-14add stronger warning to CString::from_rawAlex Burka-2/+7
2016-09-14Rollup merge of #36467 - frewsxcv:ipaddr, r=GuillaumeGomezGuillaume Gomez-0/+18
Add doc examples for std::net::IpAddr construction. None
2016-09-14Rollup merge of #36396 - athulappadan:Default-docs, r=blussGuillaume Gomez-0/+9
Documentation of what Default does for each type Addresses #36265 I haven't changed the following types due to doubts: 1)src/libstd/ffi/c_str.rs 2)src/libcore/iter/sources.rs 3)src/libcore/hash/mod.rs 4)src/libcore/hash/mod.rs 5)src/librustc/middle/privacy.rs r? @steveklabnik
2016-09-13Auto merge of #36041 - ahmedcharles:try, r=nrcbors-5/+4
Replace try! with ?.
2016-09-13Add doc examples for std::net::IpAddr construction.Corey Farwell-0/+18
2016-09-13Implement add, sub, mul and div methods using checked methods for DurationEugene Bulkin-35/+4
2016-09-13Fix Duration::checked_mul documentationEugene Bulkin-1/+1
2016-09-13Add checked operation methods to DurationEugene Bulkin-0/+162
2016-09-13Auto merge of #35021 - japaric:rustc-builtins, r=alexcrichtonbors-0/+5
crate-ify compiler-rt into compiler-builtins libcompiler-rt.a is dead, long live libcompiler-builtins.rlib This commit moves the logic that used to build libcompiler-rt.a into a compiler-builtins crate on top of the core crate and below the std crate. This new crate still compiles the compiler-rt instrinsics using gcc-rs but produces an .rlib instead of a static library. Also, with this commit rustc no longer passes -lcompiler-rt to the linker. This effectively makes the "no-compiler-rt" field of target specifications a no-op. Users of `no_std` will have to explicitly add the compiler-builtins crate to their crate dependency graph *if* they need the compiler-rt intrinsics - this is a [breaking-change]. Users of the `std` have to do nothing extra as the std crate depends on compiler-builtins. Finally, this a step towards lazy compilation of std with Cargo as the compiler-rt intrinsics can now be built by Cargo instead of having to be supplied by the user by some other method. closes #34400 --- r? @alexcrichton
2016-09-13Link test to compiler builtins and make unstableAlex Crichton-0/+1
This commit fixes a test which now needs to explicitly link to the `compiler_builtins` crate as well as makes the `compiler_builtins` crate unstable.
2016-09-13Auto merge of #36264 - matklad:zeroing-cstring, r=alexcrichtonbors-3/+25
Zero first byte of CString on drop Hi! This is one more attempt to ameliorate `CString::new("...").unwrap().as_ptr()` problem (related RFC: https://github.com/rust-lang/rfcs/pull/1642). One of the biggest problems with this code is that it may actually work in practice, so the idea of this PR is to proactively break such invalid code. Looks like writing a `null` byte at the start of the CString should do the trick, and I think is an affordable cost: zeroing a single byte in `Drop` should be cheap enough compared to actual memory deallocation which would follow. I would actually prefer to do something like ```Rust impl Drop for CString { fn drop(&mut self) { let pattern = b"CTHULHU FHTAGN "; let bytes = self.inner[..self.inner.len() - 1]; for (d, s) in bytes.iter_mut().zip(pattern.iter().cycle()) { *d = *s; } } } ``` because Cthulhu error should be much easier to google, but unfortunately this would be too expensive in release builds, and we can't implement things `cfg(debug_assertions)` conditionally in stdlib. Not sure if the whole idea or my implementation (I've used ~~`transmute`~~ `mem::unitialized` to workaround move out of Drop thing) makes sense :)
2016-09-13Rollup merge of #36402 - kmcallister:gh-29331-array-docs, r=GuillaumeGomezGuillaume Gomez-21/+65
Tweak array docs Fixes #29331. r? @GuillaumeGomez
2016-09-13Rollup merge of #36397 - SuperFluffy:bufwriter_unnecessary_cmp, r=aturonGuillaume Gomez-2/+1
Remove unnecessary `cmp::min` from BufWriter::write The first branch of the if statement already checks if `buf.len() >= self.buf.capacity()`, which makes the `cmp::min(buf.len(), self.buf.capacity())` redundant: the result will always be `buf.len()`. Therefore, we can pass the `buf` slice directly into `Write::write`.
2016-09-12crate-ify compiler-rt into compiler-builtinsJorge Aparicio-0/+4
libcompiler-rt.a is dead, long live libcompiler-builtins.rlib This commit moves the logic that used to build libcompiler-rt.a into a compiler-builtins crate on top of the core crate and below the std crate. This new crate still compiles the compiler-rt instrinsics using gcc-rs but produces an .rlib instead of a static library. Also, with this commit rustc no longer passes -lcompiler-rt to the linker. This effectively makes the "no-compiler-rt" field of target specifications a no-op. Users of `no_std` will have to explicitly add the compiler-builtins crate to their crate dependency graph *if* they need the compiler-rt intrinsics. Users of the `std` have to do nothing extra as the std crate depends on compiler-builtins. Finally, this a step towards lazy compilation of std with Cargo as the compiler-rt intrinsics can now be built by Cargo instead of having to be supplied by the user by some other method. closes #34400
2016-09-12Auto merge of #36019 - frewsxcv:take-into-inner, r=alexcrichtonbors-0/+27
Introduce `into_inner` method on `std::io::Take`. https://github.com/rust-lang/rust/issues/23755
2016-09-12Fixed issue #36387christopherdumas-3/+10
2016-09-11Use question_mark feature in libstd.Ahmed Charles-5/+4
2016-09-11Tweak array docsKeegan McAllister-21/+65
Fixes #29331.
2016-09-11Auto merge of #36369 - uweigand:s390x, r=alexcrichtonbors-6/+25
Add s390x support This adds support for building the Rust compiler and standard library for s390x-linux, allowing a full cross-bootstrap sequence to complete. This includes: - Makefile/configure changes to allow native s390x builds - Full Rust compiler support for the s390x C ABI (only the non-vector ABI is supported at this point) - Port of the standard library to s390x - Update the liblibc submodule to a version including s390x support - Testsuite fixes to allow clean "make check" on s390x Caveats: - Resets base cpu to "z10" to bring support in sync with the default behaviour of other compilers on the platforms. (Usually, upstream supports all older processors; a distribution build may then chose to require a more recent base version.) (Also, using zEC12 causes failures in the valgrind tests since valgrind doesn't fully support this CPU yet.) - z13 vector ABI is not yet supported. To ensure compatible code generation, the -vector feature is passed to LLVM. Note that this means that even when compiling for z13, no vector instructions will be used. In the future, support for the vector ABI should be added (this will require common code support for different ABIs that need different data_layout strings on the same platform). - Two test cases are (temporarily) ignored on s390x to allow passing the test suite. The underlying issues still need to be fixed: * debuginfo/simd.rs fails because of incorrect debug information. This seems to be a LLVM bug (also seen with C code). * run-pass/union/union-basic.rs simply seems to be incorrect for all big-endian platforms. Signed-off-by: Ulrich Weigand <ulrich.weigand@de.ibm.com>
2016-09-11Documentation for default types modifiedathulappadan-3/+3
2016-09-11Remove unnecessary `cmp::min` from BufWriter::writeRichard Janis Goldschmidt-2/+1
The first branch of the if statement already checks if `buf.len() >= self.buf.capacity()`, which makes the `cmp::min(buf.len(), self.buf.capacity())` redundant: the result will always be `buf.len()`. Therefore, we can pass the `buf` slice directly into `Write::write`.
2016-09-11Documentation of what does for each typeathulappadan-0/+9
2016-09-10Rollup merge of #36314 - tshepang:not-needed, r=GuillaumeGomezGuillaume Gomez-2/+2
doc: we got coercion going on here, so no need to be this explicit
2016-09-10Rollup merge of #36311 - frewsxcv:instant-elapsed-example, r=GuillaumeGomezGuillaume Gomez-0/+12
Add doc example for `std::time::Instant::elapsed`. None
2016-09-09Add s390x supportUlrich Weigand-6/+25
This adds support for building the Rust compiler and standard library for s390x-linux, allowing a full cross-bootstrap sequence to complete. This includes: - Makefile/configure changes to allow native s390x builds - Full Rust compiler support for the s390x C ABI (only the non-vector ABI is supported at this point) - Port of the standard library to s390x - Update the liblibc submodule to a version including s390x support - Testsuite fixes to allow clean "make check" on s390x Caveats: - Resets base cpu to "z10" to bring support in sync with the default behaviour of other compilers on the platforms. (Usually, upstream supports all older processors; a distribution build may then chose to require a more recent base version.) (Also, using zEC12 causes failures in the valgrind tests since valgrind doesn't fully support this CPU yet.) - z13 vector ABI is not yet supported. To ensure compatible code generation, the -vector feature is passed to LLVM. Note that this means that even when compiling for z13, no vector instructions will be used. In the future, support for the vector ABI should be added (this will require common code support for different ABIs that need different data_layout strings on the same platform). - Two test cases are (temporarily) ignored on s390x to allow passing the test suite. The underlying issues still need to be fixed: * debuginfo/simd.rs fails because of incorrect debug information. This seems to be a LLVM bug (also seen with C code). * run-pass/union/union-basic.rs simply seems to be incorrect for all big-endian platforms. Signed-off-by: Ulrich Weigand <ulrich.weigand@de.ibm.com>
2016-09-08Auto merge of #36322 - uweigand:nonblocking, r=alexcrichtonbors-1/+1
Fix argument to FIONBIO ioctl The FIONBIO ioctl takes as argument a pointer to an integer, which should be either 0 or 1 to indicate whether nonblocking mode is to be switched off or on. The type of the pointed-to variable is "int". However, the set_nonblocking routine in libstd/sys/unix/net.rs passes a pointer to a libc::c_ulong variable. This doesn't matter on all 32-bit platforms and on all litte-endian platforms, but it will break on big-endian 64-bit platforms. Found while porting Rust to s390x (a big-endian 64-bit platform). Signed-off-by: Ulrich Weigand <ulrich.weigand@de.ibm.com>
2016-09-08Auto merge of #36048 - GuillaumeGomez:code_clean, r=brsonbors-12/+9
Clean code a bit
2016-09-08Fix testsStephen M. Coakley-2/+2
2016-09-07Add ThreadId for comparing threadsStephen M. Coakley-0/+40
2016-09-07Zero first byte of CString on dropAleksey Kladov-3/+25
This should prevent code like ``` let ptr = CString::new("hello").unwrap().as_ptr(); ``` from working by accident.
2016-09-07Fix argument to FIONBIO ioctlUlrich Weigand-1/+1
The FIONBIO ioctl takes as argument a pointer to an integer, which should be either 0 or 1 to indicate whether nonblocking mode is to be switched off or on. The type of the pointed-to variable is "int". However, the set_nonblocking routine in libstd/sys/unix/net.rs passes a pointer to a libc::c_ulong variable. This doesn't matter on all 32-bit platforms and on all litte-endian platforms, but it will break on big-endian 64-bit platforms. Found while porting Rust to s390x (a big-endian 64-bit platform). Signed-off-by: Ulrich Weigand <ulrich.weigand@de.ibm.com>
2016-09-07Add doc example for `std::time::Instant::elapsed`.Corey Farwell-0/+12
2016-09-07doc: we got coercion going on here, so no need to be this explicitTshepang Lekhonkhobe-2/+2
2016-09-06Rollup merge of #36298 - GuillaumeGomez:hashmap_doc, r=steveklabnikJonathan Turner-18/+42
Add missing urls r? @steveklabnik
2016-09-06Rollup merge of #36263 - apasel422:scoped, r=steveklabnikJonathan Turner-20/+15
Clean up thread-local storage docs `std` no longer contains an implementation of scoped TLS. r? @steveklabnik
2016-09-06Add missing urlsggomez-18/+42
2016-09-04Auto merge of #36203 - petrochenkov:uvsdot, r=nrcbors-2/+3
Replace `_, _` with `..` in patterns This is how https://github.com/rust-lang/rust/issues/33627 looks in action. Looks especially nice in leftmost/rightmost positions `(first, ..)`/`(.., last)`. I haven't touched libsyntax intentionally because the feature is still unstable.
2016-09-04Auto merge of #36144 - japaric:rustbuild-musl, r=alexcrichtonbors-1/+1
rustbuild: fix building std for musl targets closes #36143 r? @alexcrichton
2016-09-04Clean up thread-local storage docsAndrew Paseltiner-20/+15
`std` no longer contains an implementation of scoped TLS.
2016-09-04Replace `_, _` with `..`Vadim Petrochenkov-1/+1