about summary refs log tree commit diff
path: root/src/libstd
AgeCommit message (Collapse)AuthorLines
2020-04-29Rollup merge of #71296 - ChiefMilesEdgeworth:fix_doc_wording, r=Dylan-DPCDylan DPC-2/+3
Change wording on read_vectored docs Closes #70154 I'm happy to work with others to make the wording on this more clear. I think what I have is an improvement but may not be the final wording.
2020-04-27Rollup merge of #67841 - sfackler:can-vector, r=AmaneiuDylan DPC-0/+565
Add Read/Write::can_read/write_vectored When working with an arbitrary reader or writer, code that uses vectored operations may end up being slower than code that copies into a single buffer when the underlying reader or writer doesn't actually support vectored operations. These new methods allow you to ask the reader or witer up front if vectored operations are efficiently supported. Currently, you have to use some heuristics to guess by e.g. checking if the read or write only accessed the first buffer. Hyper is one concrete example of a library that has to do this dynamically: https://github.com/hyperium/hyper/blob/0eaf304644a396895a4ce1f0146e596640bb666a/src/proto/h1/io.rs#L582-L594
2020-04-27fix wasiSteven Fackler-2/+2
2020-04-26fix wasm buildSteven Fackler-0/+8
2020-04-26Suppress file length check temporarilySteven Fackler-0/+1
Will clean up in a separate PR
2020-04-26Fix stragglersSteven Fackler-9/+9
2020-04-26Update nameSteven Fackler-158/+158
2020-04-26Add Read/Write::can_read/write_vectoredSteven Fackler-0/+556
When working with an arbitrary reader or writer, code that uses vectored operations may end up being slower than code that copies into a single buffer when the underlying reader or writer doesn't actually support vectored operations. These new methods allow you to ask the reader or witer up front if vectored operations are efficiently supported. Currently, you have to use some heuristics to guess by e.g. checking if the read or write only accessed the first buffer. Hyper is one concrete example of a library that has to do this dynamically: https://github.com/hyperium/hyper/blob/0eaf304644a396895a4ce1f0146e596640bb666a/src/proto/h1/io.rs#L582-L594
2020-04-26fix more clippy warningsMatthias Krüger-1/+1
clippy::{redundant_pattern_matching, clone_on_copy, iter_cloned_collect, option_as_ref_deref, match_ref_pats}
2020-04-25Auto merge of #71556 - Dylan-DPC:rollup-9ll4shr, r=Dylan-DPCbors-11/+6
Rollup of 7 pull requests Successful merges: - #69041 (proc_macro: Stabilize `Span::resolved_at` and `Span::located_at`) - #69813 (Implement BitOr and BitOrAssign for the NonZero integer types) - #70712 (stabilize BTreeMap::remove_entry) - #71168 (Deprecate `{Box,Rc,Arc}::into_raw_non_null`) - #71544 (Replace filter_map().next() calls with find_map()) - #71545 (Fix comment in docstring example for Error::kind) - #71548 (Add missing Send and Sync impls for linked list Cursor and CursorMut.) Failed merges: r? @ghost
2020-04-25Rollup merge of #71545 - Askaholic:patch-1, r=jonas-schievinkDylan DPC-2/+2
Fix comment in docstring example for Error::kind Saw it while reading the docs.
2020-04-25Rollup merge of #71544 - cuviper:filter_map_next, r=Mark-SimulacrumDylan DPC-9/+4
Replace filter_map().next() calls with find_map() These are semantically the same, but `find_map()` is more concise.
2020-04-25Auto merge of #71439 - Mark-Simulacrum:stage0-next, r=jonas-schievinkbors-154/+24
Bump bootstrap compiler This bumps the bootstrap compiler and the rustfmt that x.py fmt uses.
2020-04-25Bump rustfmt to most recently shippedMark Rousskov-7/+19
2020-04-25Bump bootstrap compilerMark Rousskov-147/+5
2020-04-25Fix comment in docstring example for Error::kindAskaholic-2/+2
2020-04-24Replace filter_map().next() calls with find_map()Josh Stone-9/+4
These are semantically the same, but `find_map()` is more concise.
2020-04-25Rollup merge of #71535 - workingjubilee:jubilee-markdown-fix, r=Mark-SimulacrumDylan DPC-2/+2
Fix typos in docs for keyword "in" Erroneous .md formatting was causing the link to not work on the currently-nightly keyword docs for `in`, and also there was a simple typo.
2020-04-24Fix typos in docs for keyword "in"Jubilee Young-2/+2
2020-04-24Avoid unused Option::map resultsJosh Stone-5/+11
These are changes that would be needed if we add `#[must_use]` to `Option::map`, per #71484.
2020-04-22Rollup merge of #71256 - cuviper:must_use_replace, r=estebankDylan DPC-1/+1
Lint must_use on mem::replace This adds a hint on `mem::replace`, "if you don't need the old value, you can just assign the new value directly". This is in similar spirit to the `must_use` on `ManuallyDrop::take`.
2020-04-22Rollup merge of #71414 - phansch:more-diagnostic-items, r=ManishearthDylan DPC-0/+3
More diagnostic items for Clippy usage This adds a couple of more diagnostic items to be used in Clippy. I chose these particular ones because they were the types which we seem to check for the most in Clippy. I'm not sure if the `cfg_attr(not(test))` is needed, but it was also used for `Vec` and a few other types. cc https://github.com/rust-lang/rust-clippy/issues/5393 r? @Manishearth
2020-04-22More diagnostic items for Clippy usagePhilipp Hansch-0/+3
This adds a couple of more diagnostic items to be used in Clippy. I chose these particular ones because they were the types which we seem to check for the most in Clippy. I'm not sure if the `cfg_attr(not(test))` is needed, but it was also used for `Vec` and a few other types.
2020-04-22Rollup merge of #71366 - faern:use-assoc-int-consts3, r=dtolnayYuki Okushi-12/+12
Use assoc int consts3 Define module level int consts with associated constants instead of `min_value()` and `max_value()`. So the code become consistent with what the docs recommend etc. Seems natural. Also remove the last usages of the int module constants from this repo (except src/test/ directory which I have still not really done anything in). Some places were missed in the previous PRs because the code uses `crate::<IntTy>` to reach the constants. This is a continuation of #70857 r? @dtolnay
2020-04-20Use assoc float consts instead of module levelLinus Färnstrand-11/+11
2020-04-20Stop accessing module level int consts via crate::<Ty>Linus Färnstrand-1/+1
2020-04-20Rollup merge of #71328 - Mark-Simulacrum:stabilize-pathbuf-capacity, r=sfacklerDylan DPC-8/+7
Stabilize PathBuf capacity methods Closes https://github.com/rust-lang/rust/issues/58234. Stabilization FCP finished in https://github.com/rust-lang/rust/issues/58234#issuecomment-616048777.
2020-04-20Auto merge of #71007 - Amanieu:deprecate_asm, r=Mark-Simulacrumbors-0/+2
Deprecate the asm! macro in favor of llvm_asm! Since we will be changing the syntax of `asm!` soon, deprecate it and encourage people to use `llvm_asm!` instead (which preserves the old syntax). This will avoid breakage when `asm!` is changed. RFC: https://github.com/rust-lang/rfcs/pull/2843
2020-04-19Stabilize PathBuf capacity methodsMark Rousskov-8/+7
2020-04-18Change wording on read_vectored docsNathan Abel-2/+3
2020-04-17Rollup merge of #71167 - RalfJung:big-o, r=shepmasterDylan DPC-6/+6
big-O notation: parenthesis for function calls, explicit multiplication I saw `O(n m log n)` in the docs and found that really hard to parse. In particular, I don't think we should use blank space as syntax for *both* multiplication and function calls, that is just confusing. This PR makes both multiplication and function calls explicit using Rust-like syntax. If you prefer, I can also leave one of them implicit, but I believe explicit is better here. While I was at it I also added backticks consistently.
2020-04-17Fix unused results from mem::replaceJosh Stone-1/+1
2020-04-16Dogfood or_patterns in the standard libraryJosh Stone-2/+3
2020-04-15Deprecate the asm! macroAmanieu d'Antras-0/+2
2020-04-15big-O notation: parenthesis, multiplication and backticksRalf Jung-6/+6
2020-04-15Use fcntl() to set nonblock for solarish socketsPatrick Mooney-0/+8
The ioctl(FIONBIO) method of setting a file descriptor to be non-blocking does not notify the underlying resource in the same way that fcntl(F_SETFL, O_NONBLOCK) does on illumos and Solaris.
2020-04-14Add illumos triplePatrick Mooney-16/+275
Co-Authored-By: Jason King <jason.brian.king@gmail.com> Co-Authored-By: Joshua M. Clulow <jmc@oxide.computer>
2020-04-14Add missing commaYoungsuk Kim-1/+1
2020-04-12Rollup merge of #71029 - Mark-Simulacrum:cargo-build, r=Mark-SimulacrumDylan DPC-1/+1
Partial work on building with Cargo This cherry picks the commits I'm directly approving from #70999, I want to land them so that that PR is smaller.
2020-04-11Make panic-unwind a default feature for libstdLuca Barbieri-1/+1
x.py sets it unconditionally, so want it for plain "cargo build". We need to load one of the panic runtimes that is in src (vs. pre-built in the compiler's sysroot) to ensure that we don't load libpanic_unwind from the sysroot. That would lead to a load of libcore, also from the sysroot, and create lots of errors about duplicate lang items.
2020-04-11Change issue number to point to tracking issueChai T. Rex-1/+1
2020-04-10Fixed doc tests for added methodsChai T. Rex-0/+1
2020-04-10Add or_insert_with_key to Entry of HashMap/BTreeMapChai T. Rex-0/+27
Going along with or_insert_with, or_insert_with_key provides the Entry's key to the lambda, avoiding the need to either clone the key or the need to reimplement this body of this method from scratch each time. This is useful when the initial value for a map entry is derived from the key. For example, the introductory Rust book has an example Cacher struct that takes an expensive-to-compute lambda and then can, given an argument to the lambda, produce either the cached result or execute the lambda.
2020-04-09Rollup merge of #67705 - lzutao:wmemchr, r=wesleywiserMazdak Farrokhzad-2/+46
Use unrolled loop for searching NULL in [u16] on Windows
2020-04-08Rollup merge of #70565 - Zoxc:inlines-query-system, r=davidtwcoDylan DPC-0/+1
Add inline attributes for functions used in the query system
2020-04-08Rollup merge of #70134 - hermitcore:osstrext, r=dtolnayDylan DPC-1/+54
add basic support of OsStrExt for HermitCore - this patch increases the compatibility to other operating systems - in principle `ffi.rs` is derived from `src/libstd/sys/unix/ext/ffi.rs`
2020-04-07Rollup merge of #70857 - faern:use-assoc-int-float-consts, r=dtolnayDylan DPC-1/+0
Don't import integer and float modules, use assoc consts 2 Follow up to #70777. I missed quite a lot of places. Partially because I wanted to keep the size of the last PR down, and partially because my regexes were not good enough :) r? @dtolnay
2020-04-07Rollup merge of #70201 - cuviper:clone_into, r=dtolnayDylan DPC-2/+30
Small tweaks in ToOwned::clone_into - `<[T]>::clone_into` is slightly more optimized. - `CStr::clone_into` is new, letting it reuse its allocation. - `OsStr::clone_into` now forwards to the underlying slice/`Vec`.
2020-04-06Forward OsStr::clone_into to the inner VecJosh Stone-2/+13
Despite OS differences, they're all just `Vec<u8>` inside, so we can just forward `clone_into` calls to that optimized implementation.
2020-04-06Implement ToOwned::clone_into for CStrJosh Stone-0/+17
It can try to keep its allocation by converting the inner `Box` to `Vec`, using `clone_into` on the bytes, then convert back to `Box`.