about summary refs log tree commit diff
path: root/src/libstd
AgeCommit message (Collapse)AuthorLines
2017-10-08Remove Queue::new.Joshua Lockerman-29/+5
2017-10-08cfg out Queue::new for emscriptenJLockerman-1/+1
Queue::new is only used is tests atm, which causes warnings on emscripten which does not run queue tests.
2017-10-08Link std::process::Output to Command and ChildPirh-1/+8
2017-10-08Auto merge of #45030 - raggi:zircon-handle-t, r=alexcrichtonbors-18/+17
zircon: the type of zx_handle_t is now unsigned This is a kernel ABI change that landed today. I noticed some other ABI issues and have left a note to cleanup once they are better defined.
2017-10-08Remove ./ prefix from relative URLsPirh-10/+10
Also remove trailing whitespace to pass tidy checks.
2017-10-08Add links and examples for std::process::StdioPirh-1/+108
As per #29370
2017-10-08Don't encourage people to ignore threading errors in the docsJake Goulding-5/+7
2017-10-08Rollup merge of #45083 - fhartwig:slice-read-to-end, r=blusskennytm-0/+8
Add read_to_end implementation to &[u8]'s Read impl The default impl for read_to_end does a bunch of bookkeeping that isn't necessary for slices and is about 4 times slower on my machine. The following benchmark takes about 30 ns before this change and about 7 ns after: ``` #[bench] fn bench_read_std(b: &mut Bencher) { let data = vec![0u8; 100]; let mut v = Vec::with_capacity(200); b.iter(|| { let mut s = data.as_slice(); v.clear(); s.read_to_end(&mut v).unwrap(); }); } ``` This solves the easy part of https://github.com/rust-lang/rust/issues/44819 (I think extending this to `Take<&[u8]> `would require specialization)
2017-10-07Change current_pid to just `id`.Thayne McCombs-3/+4
2017-10-07Add read_to_end implementation to &[u8]'s Read implFlorian Hartwig-0/+8
The default impl for read_to_end does a bunch of bookkeeping that isn't necessary for slices and is about 4 times slower on my machine.
2017-10-07Auto merge of #44913 - leavehouse:patch-1, r=BurntSushibors-3/+3
Fix TcpStream::local_addr docs example code The local address's port is not 8080 in this example, that's the remote peer address port. On my machine, the local address is different every time, so I've changed `assert_eq` to only test the IP address
2017-10-07Add missing colon.Thayne McCombs-1/+1
2017-10-06Auto merge of #44734 - mchlrhw:wip/hashmap-entry-and-then, r=BurntSushibors-0/+35
Implement `and_modify` on `Entry` ## Motivation `Entry`s are useful for allowing access to existing values in a map while also allowing default values to be inserted for absent keys. The existing API is similar to that of `Option`, where `or` and `or_with` can be used if the option variant is `None`. The `Entry` API is, however, missing an equivalent of `Option`'s `and_then` method. If it were present it would be possible to modify an existing entry before calling `or_insert` without resorting to matching on the entry variant. Tracking issue: https://github.com/rust-lang/rust/issues/44733.
2017-10-06Auto merge of #44965 - oconnor663:res_init_glibc, r=dtolnaybors-4/+92
replace libc::res_init with res_init_if_glibc_before_2_26 The previous workaround for gibc's res_init bug is not thread-safe on other implementations of libc, and it can cause crashes. Use a runtime check to make sure we only call res_init when we need to, which is also when it's safe. See https://github.com/rust-lang/rust/issues/43592. ~This PR is returning an InvalidData IO error if the glibc version string fails to parse. We could also have treated that case as "not glibc", and gotten rid of the idea that these functions could return an error. (Though I'm not a huge fan of ignoring error returns from `res_init` in any case.) Do other folks agree with these design choices?~ I'm pretty new to hacking on libstd. Is there an easy way to build a toy rust program against my changes to test this, other than doing an entire `sudo make install` on my system? What's the usual workflow?
2017-10-06Implement `entry_and_modify`mchlrhw-0/+35
2017-10-06Add current_pid functionThayne McCombs-0/+30
Fixes #44971
2017-10-05replace libc::res_init with res_init_if_glibc_before_2_26Jack O'Connor-4/+92
The previous workaround for gibc's res_init bug is not thread-safe on other implementations of libc, and it can cause crashes. Use a runtime check to make sure we only call res_init when we need to, which is also when it's safe. See https://github.com/rust-lang/rust/issues/43592.
2017-10-05Auto merge of #44943 - nivkner:fixme_fixup, r=dtolnaybors-5/+5
address some FIXME whose associated issues were marked as closed part of #44366
2017-10-05Rollup merge of #45017 - GuillaumeGomez:mutex-links, r=estebankkennytm-7/+17
Add missing urls for Mutex r? @rust-lang/docs
2017-10-05Remove nacl from libstdest31-232/+4
2017-10-04zircon: update some more zx and lp constantsJames Tucker-22/+16
* Use size_t where size_t is used, while it's not critical on our specifically supported architectures, this is more accurate. * Update HND_SPECIAL_COUNT to the correct value, and give it the size that enum is likely to be.
2017-10-04zircon: the type of zx_handle_t is now unsignedJames Tucker-1/+6
This is a kernel ABI change that landed today. I noticed some other ABI issues and have left a note to cleanup once they are better defined.
2017-10-04Auto merge of #44890 - nvzqz:str-box-transmute, r=alexcrichtonbors-23/+28
Remove mem::transmute used in Box<str> conversions Given that https://github.com/rust-lang/rust/pull/44877 is failing, I decided to make a separate PR. This is done with the same motivation: to avoid `mem::transmute`-ing non `#[repr(C)]` types.
2017-10-04Add missing urls for MutexGuillaume Gomez-7/+17
2017-10-04Auto merge of #44905 - Pirh:process_abort_docs, r=steveklabnikbors-2/+13
Update docs for process::abort Remove a typo and explain the relationship to `panic!`. Part of #29370 r? @steveklabnik
2017-10-04Auto merge of #44979 - hinaria:master, r=dtolnaybors-0/+13
make `backtrace = false` compile for windows targets. when building for windows with `backtrace = false`, `libstd` fails to compile because some modules that use items from `sys_common::backtrace::*` are still included, even though those modules aren't used or referenced by anything. `sys_common::backtrace` doesn't exist when the backtrace feature is turned off. -- i've also added `#[cfg(feature = "backtrace")]` to various items that exist exclusively to support `mod backtrace` since the compilation would fail since they would be unused in a configuration with backtraces turned off.
2017-10-03Auto merge of #44895 - stephaneyfx:master, r=dtolnaybors-7/+22
Made `fs::copy` return the length of the main stream On Windows with the NTFS filesystem, `fs::copy` would return the sum of the lengths of all streams, which can be different from the length reported by `metadata` and thus confusing for users unaware of this NTFS peculiarity. This makes `fs::copy` return the same length `metadata` reports which is the value it used to return before PR #26751. Note that alternate streams are still copied; their length is just not included in the returned value. This change relies on the assumption that the stream with index 1 is always the main stream in the `CopyFileEx` callback. I could not find any official document confirming this but empirical testing has shown this to be true, regardless of whether the alternate stream is created before or after the main stream. Resolves #44532
2017-10-02Fix broken links in documentationFederico Mena Quintero-3/+3
2017-10-02Clarify the ffi module's toplevel docs, per @clarcharr's commentsFederico Mena Quintero-54/+65
2017-10-02Document that process::abort will not call the panic hookPirh-1/+3
2017-10-02Remove the implication that CString contains UTF-8 data.Federico Mena Quintero-3/+4
2017-10-03windows: make `backtrace = false` compilehinaria-0/+13
2017-10-01Improve performance of spsc_queue and stream.Joshua Lockerman-99/+208
This commit makes two main changes. 1. It switches the spsc_queue node caching strategy from keeping a shared counter of the number of nodes in the cache to keeping a consumer only counter of the number of node eligible to be cached. 2. It separate the consumer and producers fields of spsc_queue and stream into a producer cache line and consumer cache line.
2017-09-30Merge remote-tracking branch 'upstream/master'Nikolai Vazquez-170/+448
2017-09-30Cast inner type in OsStr::bytesNikolai Vazquez-1/+1
The innermost type is not [u8] on all platforms but is assumed to have the same memory layout as [u8] since this conversion was done via mem::transmute before.
2017-09-30Auto merge of #44936 - Mark-Simulacrum:rollup, r=Mark-Simulacrumbors-3/+67
Rollup of 15 pull requests - Successful merges: #44124, #44287, #44320, #44694, #44708, #44794, #44797, #44824, #44836, #44840, #44845, #44854, #44889, #44900, #44903 - Failed merges:
2017-09-30address some `FIXME`s whose associated issues were marked as closedNiv Kaminer-5/+5
remove FIXME(#13101) since `assert_receiver_is_total_eq` stays. remove FIXME(#19649) now that stability markers render. remove FIXME(#13642) now the benchmarks were moved. remove FIXME(#6220) now that floating points can be formatted. remove FIXME(#18248) and write tests for `Rc<str>` and `Rc<[u8]>` remove reference to irelevent issues in FIXME(#1697, #2178...) update FIXME(#5516) to point to getopts issue 7 update FIXME(#7771) to point to RFC 628 update FIXME(#19839) to point to issue 26925
2017-09-29Rollup merge of #44824 - dtolnay:22really21, r=alexcrichtonMark Simulacrum-1/+1
Backport libs stabilizations to 1.21 beta Includes the following stabilizations: - tcpstream_connect_timeout https://github.com/rust-lang/rust/pull/44563 - iterator_for_each https://github.com/rust-lang/rust/pull/44567 - ord_max_min https://github.com/rust-lang/rust/pull/44593 - compiler_fences https://github.com/rust-lang/rust/pull/44595 - needs_drop https://github.com/rust-lang/rust/pull/44639 - vec_splice https://github.com/rust-lang/rust/pull/44640 These have been backported in https://github.com/rust-lang/rust/pull/44823.
2017-09-29Rollup merge of #44797 - lucasem:master, r=frewsxcvMark Simulacrum-2/+55
docs improvement std::sync::{PoisonError, TryLockError} Addresses the `PoisonError` and `TryLockError` parts of #29377. Adds examples and links. r? @steveklabnik
2017-09-29Rollup merge of #44794 - napen123:master, r=frewsxcvMark Simulacrum-0/+11
Add doc example to HashMap::hasher None
2017-09-29Auto merge of #44174 - jimmycuadra:try-from-infallible, r=sfacklerbors-0/+8
Add blanket TryFrom impl when From is implemented. Adds `impl<T, U> TryFrom<T> for U where U: From<T>`. Removes `impl<'a, T> TryFrom<&'a str> for T where T: FromStr` (originally added in #40281) due to overlapping impls caused by the new blanket impl. This removal is to be discussed further on the tracking issue for TryFrom. Refs #33417. /cc @sfackler, @scottmcm (thank you for the help!), and @aturon
2017-09-29Enable required features for core::array in libstdNikolai Vazquez-0/+2
2017-09-29Implement Error trait for TryFromSliceErrorNikolai Vazquez-0/+8
2017-09-28Fix imports in TcpStream::local_addr docs exampleleavehouse-1/+1
Add a missing import and remove unused imports
2017-09-28Fix TcpStream::local_addr example codeleavehouse-2/+2
The local address's port is not 8080 in this example, that's the remote peer address port. On my machine, the local address is different every time, so I've changed `assert_eq` to only test the IP address
2017-09-28Auto merge of #44278 - Binero:master, r=BurntSushibors-0/+30
Allow replacing HashMap entries This is an obvious API hole. At the moment the only way to retrieve an entry from a `HashMap` is to get an entry to it, remove it, and then insert a new entry. This PR allows entries to be replaced.
2017-09-28Migrate to eprint/eprintln macros where appropriate.Corey Farwell-3/+1
2017-09-28Fix errors in Box<Path> conversionsNikolai Vazquez-2/+4
2017-09-28Update to the `cc` crateAlex Crichton-3/+3
This is the name the `gcc` crate has moved to
2017-09-28Remove unused 'mem' import in 'path' moduleNikolai Vazquez-1/+0