about summary refs log tree commit diff
path: root/src/libstd
AgeCommit message (Collapse)AuthorLines
2018-10-28Rollup merge of #55148 - SimonSapin:path-fromstr, r=oli-obkkennytm-0/+11
Implement FromStr for PathBuf Initially landed in https://github.com/rust-lang/rust/pull/48292 and reverted in https://github.com/rust-lang/rust/pull/50401. This time, use `std::string::ParseError` as suggested in https://github.com/rust-lang/rust/issues/44431#issuecomment-428112632
2018-10-27Correct alignment of atomic types and (re)add Atomic{I,U}128Oliver Middleton-0/+6
LLVM requires that atomic loads and stores be aligned to at least the size of the type.
2018-10-25Rollup merge of #55328 - raphlinus:copysign_typo, r=joshtriplettPietro Albini-8/+8
Fix doc for new copysign functions Thanks to @LukasKalbertodt for catching this. Addresses a comment raised in #55169 after it was merged.
2018-10-25Rollup merge of #55269 - matthiaskrgr:typos_oct, r=zackmdavisPietro Albini-3/+3
fix typos in various places
2018-10-25Rollup merge of #55247 - peterjoel:peterjoel-prim-char-doc-example, ↵Pietro Albini-2/+2
r=joshtriplett Clarified code example in char primitive doc The example was not as clear as it could be because it was making an assumption about the structure of the data in order to multiply the number of elements in the slice by the item size. This change demonstrates the idea more straightforwardly, without needing a calculation, by just comparing the size of the slices.
2018-10-25Rollup merge of #55200 - octronics:gh51430, r=kennytmPietro Albini-0/+88
Documents `From` implementations for `Stdio` This PR solves part of #51430 by adding a basic summary and an example to each `impl From` inside `process` module (`ChildStdin`, `ChildStdout`, `ChildStderr`, `File`). It does not document if the conversions allocate memory and how expensive they are.
2018-10-25Rollup merge of #54965 - chathaway-codes:update-tcp-stream-docs, ↵Pietro Albini-5/+5
r=GuillaumeGomez update tcp stream documentation A small styling issue that seemed inconsistent here when compared to other places (such as https://doc.rust-lang.org/beta/std/net/struct.TcpListener.html).
2018-10-25Rollup merge of #53931 - iirelu:keyword-docs, r=steveklabnikPietro Albini-28/+669
Gradually expanding libstd's keyword documentation I'm working on adding new keywords to the documentation and refreshing the incomplete older ones, and I'm hoping that I can eventually add all the standalone-usable keywords after a bunch of incremental work. It would be cool to see the keywords section of std's docs be a definitive reference as to what each keyword means when you see it, and that's what I'm aiming towards with this work. I'm far from a Rust expert so there will inevitably be things to fix in this, also I'm not sure if this should be a bunch of quickly-merged PRs or one gradually-updated PR that gets merged once it's done.
2018-10-24Fix doc for new copysign functionsRaph Levien-8/+8
Thanks to @LukasKalbertodt for catching this. Addresses a comment raised in #55169 after it was merged.
2018-10-24Documents `From` implementations for `Stdio`OCTronics-0/+88
Add a basic summary and an example to From `ChildStdin`, `ChildStdout`, `ChildStderr`, `File` implementations.
2018-10-23Hopefully fix compile erroriirelu-1/+0
This was added in the fortnight this PR spent stale. I'm hoping this one-liner fixes it.
2018-10-23fix typos in various placesMatthias Krüger-3/+3
2018-10-21Clarified code examplePeter Hall-2/+2
The example was not as clear as it could be because it was making an assumption about the structure of the data in order to multiply the number of collection elements by the item size. This change demonstrates the idea more straightforwardly, without the calculation.
2018-10-20Auto merge of #55014 - ljedrz:lazyboye_unwraps, r=matthewjasperbors-4/+4
Prefer unwrap_or_else to unwrap_or in case of function calls/allocations The contents of `unwrap_or` are evaluated eagerly, so it's not a good pick in case of function calls and allocations. This PR also changes a few `unwrap_or`s with `unwrap_or_default`. An added bonus is that in some cases this change also reveals if the object it's called on is an `Option` or a `Result` (based on whether the closure takes an argument).
2018-10-19Rollup merge of #55169 - raphlinus:copysign, r=joshtriplettkennytm-0/+58
Add a `copysign` function to f32 and f64 This patch adds a `copysign` function to the float primitive types. It is an exceptionally useful function for writing efficient numeric code, as it often avoids branches, is auto-vectorizable, and there are efficient intrinsics for most platforms. I think this might work as-is, as the relevant `copysign` intrinsic is already used internally for the implementation of `signum`. It's possible that an implementation might be needed in japaric/libm for portability across all platforms, in which case I'll do that also. Part of the work towards #55107
2018-10-19Prefer unwrap_or_else to unwrap_or in case of function calls/allocationsljedrz-4/+4
2018-10-18Add must_use on copysignRaph Levien-0/+2
Added a #[must_use] annotation on copysign, per review feedback.
2018-10-18Fix tidy checksjD91mZM2-1/+1
2018-10-18Revert liblibc submodule urljD91mZM2-7/+2
2018-10-18Interpret shebangs on redoxjD91mZM2-14/+80
This is no longer handled on the kernel side
2018-10-18Don't forget to close executable fileJeremy Soller-1/+2
2018-10-18Remove unused type parameterJeremy Soller-1/+1
2018-10-18Update to new system calls and enviromental variablesJeremy Soller-57/+167
2018-10-18Rollup merge of #54646 - vn971:fix_std_thread_sleep, r=frewsxcvkennytm-10/+14
improve documentation on std::thread::sleep
2018-10-17Fix inconsistent documentationRaph Levien-4/+5
I improved the f32 version and made a copy-paste error for f64.
2018-10-17Add a `copysign` function to f32 and f64Raph Levien-0/+55
This patch adds a `copysign` function to the float primitive types. It is an exceptionally useful function for writing efficient numeric code, as it often avoids branches, is auto-vectorizable, and there are efficient intrinsics for most platforms. I think this might work as-is, as the relevant `copysign` intrinsic is already used internally for the implementation of `signum`. It's possible that an implementation might be needed in japaric/libm for portability across all platforms, in which case I'll do that also. Part of the work towards #55107
2018-10-17Implement FromStr for PathBufSimon Sapin-0/+11
Initially landed in https://github.com/rust-lang/rust/pull/48292 and reverted in https://github.com/rust-lang/rust/pull/50401. This time, use `std::string::ParseError` as suggested in https://github.com/rust-lang/rust/issues/44431#issuecomment-428112632
2018-10-16adds tracking issue numberoliver-giersch-1/+1
2018-10-15Merge pull request #5 from oliver-giersch/masteroliver-giersch-25/+122
sync with upstream
2018-10-15adds feature gate to doc-test (example)oliver-giersch-0/+1
2018-10-15adds missing method call parenthesesoliver-giersch-1/+1
2018-10-15fixes misplaced semicolonoliver-giersch-2/+2
2018-10-15adds doc for `Builder::spawn_unchecked`oliver-giersch-1/+60
2018-10-14remove unnecessary lifetime boundsoliver-giersch-2/+2
generic lifetime bound `'a` can be inferred.
2018-10-14Fix incorrect link in println! documentationDiana-1/+1
The eprintln! link was incorrectly linking to eprint! instead
2018-10-13Update mod.rsoliver-giersch-3/+3
removes trailing whitespaces, replaces TODO with FIXME
2018-10-13Update mod.rsoliver-giersch-3/+2
removes unnecessary `unsafe`, adds `unstable` attribute
2018-10-13Auto merge of #54951 - alexcrichton:more-wasm-threads, r=sfacklerbors-25/+122
std: Implement TLS for wasm32-unknown-unknown This adds an implementation of thread local storage for the `wasm32-unknown-unknown` target when the `atomics` feature is implemented. This, however, comes with a notable caveat of that it requires a new feature of the standard library, `wasm-bindgen-threads`, to be enabled. Thread local storage for wasm (when `atomics` are enabled and there's actually more than one thread) is powered by the assumption that an external entity can fill in some information for us. It's not currently clear who will fill in this information nor whose responsibility it should be long-term. In the meantime there's a strategy being gamed out in the `wasm-bindgen` project specifically, and the hope is that we can continue to test and iterate on the standard library without committing to a particular strategy yet. As to the details of `wasm-bindgen`'s strategy, LLVM doesn't currently have the ability to emit custom `global` values (thread locals in a `WebAssembly.Module`) so we leverage the `wasm-bindgen` CLI tool to do it for us. To that end we have a few intrinsics, assuming two global values: * `__wbindgen_current_id` - gets the current thread id as a 32-bit integer. It's `wasm-bindgen`'s responsibility to initialize this per-thread and then inform libstd of the id. Currently `wasm-bindgen` performs this initialization as part of the `start` function. * `__wbindgen_tcb_{get,set}` - in addition to a thread id it's assumed that there's a global available for simply storing a pointer's worth of information (a thread control block, which currently only contains thread local storage). This would ideally be a native `global` injected by LLVM, but we don't have a great way to support that right now. To reiterate, this is all intended to be unstable and purely intended for testing out Rust on the web with threads. The story is very likely to change in the future and we want to make sure that we're able to do that!
2018-10-13adds unsafe `thread::Builder::spawn_unchecked` functionoliver-giersch-11/+17
moves code for `thread::Builder::spawn` into new public unsafe function `spawn_unchecked` and transforms `spawn` into a safe wrapper.
2018-10-12Rollup merge of #54956 - kzys:close-paren, r=varkorkennytm-1/+1
"(using ..." doesn't have the matching ")" Fixes #54948.
2018-10-12Rollup merge of #54913 - RalfJung:unwind-safe, r=alexcrichtonkennytm-1/+1
doc fix: it's auto traits that make for automatic implementations Being a marker trait is not good enough (that just means "no items in the trait"). r? @alexcrichton who [originally wrote these docs](https://github.com/RalfJung/rust/commit/0a13f1abafe70cddf34bf2b2ba3946c418ed6241).
2018-10-12Rollup merge of #54891 - rust-lang:SimonSapin-patch-1, r=nagisakennytm-1/+1
Fix tracking issue for Once::is_completed https://github.com/rust-lang/rust/pull/53027 was merged without a tracking issue. I just filed https://github.com/rust-lang/rust/issues/54890. CC @matklad
2018-10-12Rollup merge of #54755 - lucasloisp:document-reference-address-eq, ↵kennytm-0/+25
r=QuietMisdreavus Documents reference equality by address (#54197) Clarification of the use of `ptr::eq` to test equality of references via address by pointer coercion, regarding issue #54197 . The same example as in `ptr::eq` docs is shown here to clarify that `PartialEq` compares values pointed-to instead of via address (which can be desired in some cases)
2018-10-11Small changes to fix documentation auto compile issuesCharles Hathaway-1/+2
2018-10-11improve docs on thread::sleepVasya Novikov-4/+8
2018-10-11std: Implement TLS for wasm32-unknown-unknownAlex Crichton-25/+122
This adds an implementation of thread local storage for the `wasm32-unknown-unknown` target when the `atomics` feature is implemented. This, however, comes with a notable caveat of that it requires a new feature of the standard library, `wasm-bindgen-threads`, to be enabled. Thread local storage for wasm (when `atomics` are enabled and there's actually more than one thread) is powered by the assumption that an external entity can fill in some information for us. It's not currently clear who will fill in this information nor whose responsibility it should be long-term. In the meantime there's a strategy being gamed out in the `wasm-bindgen` project specifically, and the hope is that we can continue to test and iterate on the standard library without committing to a particular strategy yet. As to the details of `wasm-bindgen`'s strategy, LLVM doesn't currently have the ability to emit custom `global` values (thread locals in a `WebAssembly.Module`) so we leverage the `wasm-bindgen` CLI tool to do it for us. To that end we have a few intrinsics, assuming two global values: * `__wbindgen_current_id` - gets the current thread id as a 32-bit integer. It's `wasm-bindgen`'s responsibility to initialize this per-thread and then inform libstd of the id. Currently `wasm-bindgen` performs this initialization as part of the `start` function. * `__wbindgen_tcb_{get,set}` - in addition to a thread id it's assumed that there's a global available for simply storing a pointer's worth of information (a thread control block, which currently only contains thread local storage). This would ideally be a native `global` injected by LLVM, but we don't have a great way to support that right now. To reiterate, this is all intended to be unstable and purely intended for testing out Rust on the web with threads. The story is very likely to change in the future and we want to make sure that we're able to do that!
2018-10-10update tcp stream documentationCharles Hathaway-4/+3
2018-10-10"(using ..." doesn't have the matching ")"Kazuyoshi Kato-1/+1
Fixes #54948.
2018-10-08it's auto traits that make for automatic implementationsRalf Jung-1/+1
2018-10-08Auto merge of #54871 - u32i64:master, r=frewsxcvbors-1/+1
Remove unnecessary comma in `libstd/thread/mod.rs` doc comment Fix typo in `libstd/thread/mod.rs` doc comment: remove unnecessary comma.