summary refs log tree commit diff
path: root/src/libstd
AgeCommit message (Collapse)AuthorLines
2016-09-27Update map.rsFrank Rehberger-4/+6
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-27run rustfmt on libstd/collections/hash folderSrinivas Reddy Thatiparthy-279/+438
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-26Remove CString drop test.Aleksey Kladov-1/+3
The test relies on the undefined behavior, and so may fail in some circumstances. This can be worked around by stubbing a memory allocator in the test, but it is a bit of work, and LLVM could still theoretically eliminate the write of the zero byte in release mode (which is intended). So let's just remove the test and mark the function as inline. It shouldn't be optimized away when inlined into the debug build of user's code.
2016-09-26Update set.rsFrank Rehberger-1/+1
2016-09-26Update map.rsFrank Rehberger-1/+1
2016-09-26Update set.rsFrank Rehberger-4/+2
2016-09-26Update map.rsFrank Rehberger-5/+2
2016-09-26Document init of HashSet/HashMap from vectorFrank Rehberger-0/+31
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-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 :)