about summary refs log tree commit diff
path: root/src/libstd
AgeCommit message (Collapse)AuthorLines
2017-10-11ffi/c_str.rs: Make all descriptions have a single-sentence summary at the ↵Federico Mena Quintero-15/+16
beginning Per https://github.com/rust-lang/rust/pull/44855#discussion_r144048837 and subsequent ones.
2017-10-11Auto merge of #44963 - JLockerman:fix_spsc, r=alexcrichtonbors-107/+192
Improve performance of spsc_queue and stream. This PR 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 separates the consumer and producers fields of `spsc_queue` and `stream` into a producer cache line and consumer cache line. Overall, it speeds up `mpsc` in `spsc` mode by 2-10x. Variance is higher than I'd like (that 2-10x speedup is on one benchmark), I believe this is due to the drop check in `send` (`fn stream::Queue::send:107`). I think this check can be combined with the sleep detection code into a version which only uses 1 shared variable, and only one atomic access per `send`, but I haven't looked through the select implementation enough to be sure. The code currently assumes a cache line size of 64 bytes. I added a CacheAligned newtype in `mpsc` which I expect to reuse for `shared`. It doesn't really belong there, it would probably be best put in `core::sync::atomic`, but putting it in `core` would involve making it public, which I thought would require an RFC. Benchmark runner is [here](https://github.com/JLockerman/queues/tree/3eca46279c53eb75833c5ecd416de2ac220bd022/shootout), benchmarks [here](https://github.com/JLockerman/queues/blob/3eca46279c53eb75833c5ecd416de2ac220bd022/queue_bench/src/lib.rs#L170-L293). Fixes #44512.
2017-10-10Remove misleading line on Windows Subsystem stdioPirh-9/+0
2017-10-10Rollup merge of #44775 - MaloJaffre:debug-struct, r=sfacklerkennytm-46/+35
Refactor to use `debug_struct` in several Debug impls Also use `pad` and derive `Debug` for `Edge`. Fixes #44771.
2017-10-10Auto merge of #45141 - kennytm:rollup, r=kennytmbors-6/+115
Rollup of 9 pull requests - Successful merges: #44962, #45051, #45091, #45106, #45117, #45118, #45120, #45125, #45136 - Failed merges:
2017-10-10Auto merge of #44822 - frewsxcv:frewsxcv-eprintln, r=Kimundibors-3/+1
Migrate to eprint/eprintln macros where appropriate. None
2017-10-09Document defaults for stdin, stdout, and stderr methods of CommandPirh-0/+27
2017-10-09Refactor to use `debug_struct` in several Debug implsMalo Jaffré-46/+35
Fixes #44771.
2017-10-10Rollup merge of #45106 - Pirh:process_stdio_docs, r=dtolnaykennytm-1/+108
Add links and examples for std::process::Stdio As per #29370
2017-10-10Rollup merge of #44962 - shepmaster:no-ignore-result, r=steveklabnikkennytm-5/+7
Don't encourage people to ignore threading errors in the docs
2017-10-09Auto merge of #45041 - est31:master, r=alexcrichtonbors-232/+4
Remove support for the PNaCl target (le32-unknown-nacl) This removes support for the `le32-unknown-nacl` target which is currently supported by rustc on tier 3. Despite the "nacl" in the name, the target doesn't output native code (x86, ARM, MIPS), instead it outputs binaries in the PNaCl format. There are two reasons for the removal: * Google [has announced](https://blog.chromium.org/2017/05/goodbye-pnacl-hello-webassembly.html) deprecation of the PNaCl format. The suggestion is to migrate to wasm. Happens we already have a wasm backend! * Our PNaCl LLVM backend is provided by the fastcomp patch set that the LLVM fork used by rustc contains in addition to vanilla LLVM (`src/llvm/lib/Target/JSBackend/NaCl`). Upstream LLVM doesn't have PNaCl support. Removing PNaCl support will enable us to move away from fastcomp (#44006) and have a lighter set of patches on top of upstream LLVM inside our LLVM fork. This will help distribution packagers of Rust. Fixes #42420
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