summary refs log tree commit diff
path: root/src/libstd
AgeCommit message (Collapse)AuthorLines
2016-10-19Deprecate `Reflect`Nick Cameron-11/+6
[tracking issue](https://github.com/rust-lang/rust/issues/27749)
2016-10-19Stabilise `?`Nick Cameron-1/+1
cc [`?` tracking issue](https://github.com/rust-lang/rust/issues/31436)
2016-10-10std: Stabilize and deprecate APIs for 1.13Alex Crichton-12/+37
This commit is intended to be backported to the 1.13 branch, and works with the following APIs: Stabilized * `i32::checked_abs` * `i32::wrapping_abs` * `i32::overflowing_abs` * `RefCell::try_borrow` * `RefCell::try_borrow_mut` * `DefaultHasher` * `DefaultHasher::new` * `DefaultHasher::default` Deprecated * `BinaryHeap::push_pop` * `BinaryHeap::replace` * `SipHash13` * `SipHash24` * `SipHasher` - use `DefaultHasher` instead in the `std::collections::hash_map` module Closes #28147 Closes #34767 Closes #35057 Closes #35070
2016-09-26Rollup merge of #36754 - tmiasko:getaddrinfo-errors, r=alexcrichtonJonathan Turner-2/+7
When getaddrinfo returns EAI_SYSTEM retrieve actual error from errno. Fixes issue #36546. This change also updates libc to earliest version that includes EAI_SYSTEM constant. Previously, in cases where `EAI_SYSTEM` has been returned from getaddrinfo, the resulting `io::Error` would be broadly described as "System error": Error { repr: Custom(Custom { kind: Other, error: StringError("failed to lookup address information: System error") }) } After change a more detailed error is crated based on particular value of errno, for example: Error { repr: Os { code: 64, message: "Machine is not on the network" } } The only downside is that the prefix "failed to lookup address information" is no longer included in the error message.
2016-09-26Rollup merge of #36727 - kallisti5:master, r=AatchJonathan Turner-15/+322
Haiku: Initial work at OS support These changes should be non-invasive to non-Haiku platforms. These patches were hand reworked from Neil's original Rust 1.9.0 patches. I've done some style cleanup and design updates along the way. There are a few small additional patches to libc, rust-installer and compiler-rt that will be submitted once this one is accepted. Haiku can be compiled on Linux, and a full gcc cross-compiler with a Haiku target is available, which means bootstrapping should be fairly easy. The patches here have already successfully bootstrapped under our haiku x86_gcc2 architecture. http://rust-on-haiku.com/wiki/PortingRust I'll be focusing on our more modern gcc5 x86 and x86 architectures for now. As for support, we're not seeking official support for now. We understand Haiku isn't a top-tier OS choice, however having these patches upstream greatly reduces the amount of patchwork we have to do. Mesa has Haiku code upstream, and we submit patches to keep it going. Mesa doesn't test on Haiku and we're ok with that :-)
2016-09-26When getaddrinfo returns EAI_SYSTEM retrieve actual error from errno.Tomasz Miąsko-2/+7
Fixes issue #36546. This change also updates libc to earliest version that includes EAI_SYSTEM constant.
2016-09-26Auto merge of #36719 - shepmaster:build-env-var-reporting, r=alexcrichtonbors-3/+3
Report which required build-time environment variable is not set
2016-09-26Auto merge of #36734 - nnethercote:fix-HashSet-sizing, r=Aatchbors-8/+34
Don't allocate during default HashSet creation. The following `HashMap` creation functions don't allocate heap storage for elements. ``` HashMap::new() HashMap::default() HashMap::with_hasher() ``` This is good, because it's surprisingly common to create a HashMap and never use it. So that case should be cheap. However, `HashSet` does not have the same behaviour. The corresponding creation functions *do* allocate heap storage for the default number of non-zero elements (which is 32 slots for 29 elements). ``` HashMap::new() HashMap::default() HashMap::with_hasher() ``` This commit gives `HashSet` the same behaviour as `HashMap`, by simply calling the corresponding `HashMap` functions (something `HashSet` already does for `with_capacity` and `with_capacity_and_hasher`). It also reformats one existing `HashSet` construction to use a consistent single-line format. This speeds up rustc itself by 1.01--1.04x on most of the non-tiny rustc-benchmarks.
2016-09-26Haiku: Use common thread set_name stubAlexander von Gluck IV-7/+5
2016-09-26Don't allocate during default HashSet creation.Nicholas Nethercote-8/+34
The following `HashMap` creation functions don't allocate heap storage for elements. ``` HashMap::new() HashMap::default() HashMap::with_hasher() ``` This is good, because it's surprisingly common to create a HashMap and never use it. So that case should be cheap. However, `HashSet` does not have the same behaviour. The corresponding creation functions *do* allocate heap storage for the default number of non-zero elements (which is 32 slots for 29 elements). ``` HashMap::new() HashMap::default() HashMap::with_hasher() ``` This commit gives `HashSet` the same behaviour as `HashMap`, by simply calling the corresponding `HashMap` functions (something `HashSet` already does for `with_capacity` and `with_capacity_and_hasher`). It also reformats one existing `HashSet` construction to use a consistent single-line format. This speeds up rustc itself by 1.01--1.04x on most of the non-tiny rustc-benchmarks.
2016-09-25Report which required build-time environment variable is not setJake Goulding-3/+3
2016-09-25Haiku: Fix pthread_t typesize set to stable 1.8.0 post #29791Alexander von Gluck IV-1/+1
2016-09-25Haiku: Work around the lack of the FIOCLEX ioctlNiels Sascha Reedijk-2/+8
* Hand rebased from Niels original work on 1.9.0
2016-09-25Add support for the Haiku operating system on x86 and x86_64 machinesNiels Sascha Reedijk-11/+314
* Hand rebased from Niels original work on 1.9.0
2016-09-24Rollup merge of #36578 - GuillaumeGomez:fix_typo, r=steveklabnikGuillaume Gomez-2/+2
Replace 'e.g.' by 'i.e.' Fixes #36577. r? @steveklabnik
2016-09-24Rollup merge of #36018 - durka:patch-28, r=steveklabnikGuillaume Gomez-2/+7
strengthen doc warning about CString::from_raw Saw unsound code using this function on IRC.
2016-09-22Auto merge of #36631 - frewsxcv:dir-entry-debug, r=sfacklerbors-0/+20
Implement Debug for DirEntry. None
2016-09-22Rollup merge of #36632 - CryZe:patch-3, r=sfacklerJonathan Turner-2/+2
Fix outdated Doc Comment on BufReader::seek A long time ago non-panicking `unwrap` methods were renamed to `into_inner` in this Pull Request: https://github.com/rust-lang/rust/pull/19149 Looks like this doc comment was not updated however.
2016-09-22Rollup merge of #36423 - GuillaumeGomez:eq_impl, r=pnkfelixJonathan Turner-6/+6
Add missing Eq implementations Part of #36301.
2016-09-22Implement Debug for DirEntry.Corey Farwell-0/+20
2016-09-21Fix outdated Doc Comment on BufReader::seekChristopher Serr-2/+2
A long time ago non-panicking `unwrap` methods were renamed to `into_inner` in this Pull Request: https://github.com/rust-lang/rust/pull/19149 Looks like this doc comment was not updated however.
2016-09-21add assert_ne and debug_assert_ne macrosAshley Williams-2/+2
2016-09-19Replace 'e.g.' by 'i.e.'Guillaume Gomez-2/+2
2016-09-18Auto merge of #36523 - Mark-Simulacrum:format-args-link, r=GuillaumeGomezbors-4/+10
Add links between format_args! macro and std::fmt::Arguments struct r? @GuillaumeGomez
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-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-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-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>