summary refs log tree commit diff
path: root/src/libstd
AgeCommit message (Collapse)AuthorLines
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 :)
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.