about summary refs log tree commit diff
path: root/src/libstd
AgeCommit message (Collapse)AuthorLines
2019-02-28Use the correct stderr when testing libstdJethro Beekman-19/+41
2019-02-28Clarify distinction between floor() and trunc()Jon Gjengset-8/+16
2019-02-28Fix rebase failTaiki Endo-7/+8
2019-02-28Fix some imports and pathsTaiki Endo-6/+2
2019-02-28Revert removed #![feature(nll)]Taiki Endo-0/+1
2019-02-28Fix #[macro_use] extern crate in sys/cloudabiTaiki Endo-2/+1
2019-02-28libstd => 2018Taiki Endo-2040/+2005
2019-02-27Rollup merge of #58746 - ipetkov:std-process-docs, r=cramertjMazdak Farrokhzad-2/+2
std: docs: Disable running several Stdio doctests * A number of `Stdio` related doc examples include running the "rev" command to illustrate piping commands. The majority of these tests are marked as `no_run` except for two tests which were not * Not running these tests is unlikely to cause any negative impact, and doing so also allows the test suite to pass in environments where the "rev" command is unavailable
2019-02-27Rollup merge of #58703 - shepmaster:read_line_return, r=centrilMazdak Farrokhzad-1/+1
Fix copy-pasted typo for read_string return value
2019-02-27Auto merge of #58709 - kornelski:book, r=QuietMisdreavusbors-1/+1
Update book submodule Updates the book to the latest commit This is to include [documentation SEO fix](https://github.com/rust-lang/book/pull/1788) ASAP.
2019-02-25Disable running several Stdio doctestsIvan Petkov-2/+2
* A number of `Stdio` related doc examples include running the "rev" command to illustrate piping commands. The majority of these tests are marked as `no_run` except for two tests which were not * Not running these tests is unlikely to cause any negative impact, and doing so also allows the test suite to pass in environments where the "rev" command is unavailable
2019-02-26Auto merge of #58357 - sfackler:vectored-io, r=alexcrichtonbors-94/+1049
Add vectored read and write support This functionality has lived for a while in the tokio ecosystem, where it can improve performance by minimizing copies. r? @alexcrichton
2019-02-25Auto merge of #58302 - SimonSapin:tryfrom, r=alexcrichtonbors-6/+4
Stabilize TryFrom and TryInto with a convert::Infallible empty enum This is the plan proposed in https://github.com/rust-lang/rust/issues/33417#issuecomment-423073898
2019-02-25Fix copy-pasted typo for read_string return valueJake Goulding-1/+1
2019-02-25Update book submoduleKornel-1/+1
2019-02-24Fix redoxSteven Fackler-3/+3
2019-02-25Rollup merge of #58370 - nox:relax-bounds, r=dtolnayMazdak Farrokhzad-354/+343
Relax some Hash bounds on HashMap<K, V, S> and HashSet<T, S> Notably, hash iterators don't require any trait bounds to be iterated.
2019-02-24Fix sgxSteven Fackler-3/+3
2019-02-24Fix cloudabiSteven Fackler-1/+9
2019-02-24Rollup merge of #58454 - pitdicker:windows_stdio, r=alexcrichtonMazdak Farrokhzad-241/+273
Refactor Windows stdio and remove stdin double buffering I was looking for something nice and small to work on, tried to tackle a few FIXME's in Windows stdio, and things grew from there. This part of the standard library contains some tricky code, and has changed over the years to handle more corner cases. It could use some refactoring and extra comments. Changes/fixes: - Made `StderrRaw` `pub(crate)`, to remove the `Write` implementations on `sys::Stderr` (used unsynchronised for panic output). - Remove the unused `Read` implementation on `sys::windows::stdin` - The `windows::stdio::Output` enum made sense when we cached the handles, but we can use simple functions like `is_console` now that we get the handle on every read/write - `write` can now calculate the number of written bytes as UTF-8 when we can't write all `u16`s. - If `write` could only write one half of a surrogate pair, attempt another write for the other because user code can't reslice in any way that would allow us to write it otherwise. - Removed the double buffering on stdin. Documentation on the unexposed `StdinRaw` says: 'This handle is not synchronized or buffered in any fashion'; which is now true. - `sys::windows::Stdin` now always only partially fills its buffer, so we can guarantee any arbitrary UTF-16 can be re-encoded without losing any data. - `sys::windows::STDIN_BUF_SIZE` is slightly larger to compensate. There should be no real change in the number of syscalls the buffered `Stdin` does. This buffer is a little larger, while the extra buffer on Stdin is gone. - `sys::windows::Stdin` now attempts to handle unpaired surrogates at its buffer boundary. - `sys::windows::Stdin` no langer allocates for its buffer, but the UTF-16 decoding still does. ### Testing I did some manual testing of reading and writing to console. The console does support UTF-16 in some sense, but doesn't supporting displaying characters outside the BMP. - compile stage 1 stdlib with a tiny value for `MAX_BUFFER_SIZE` to make it easier to catch corner cases - run a simple test program that reads on stdin, and echo's to stdout - write some lines with plenty of ASCII and emoji in a text editor - copy and paste in console to stdin - return with `\r\n\` or CTRL-Z - copy and paste in text editor - check it round-trips ----- Fixes https://github.com/rust-lang/rust/issues/23344. All but one of the suggestions in that issue are now implemented. the missing one is: > * When reading data, we require the entire set of input to be valid UTF-16. We should instead attempt to read as much of the input as possible as valid UTF-16, only returning an error for the actual invalid elements. For example if we read 10 elements, 5 of which are valid UTF-16, the 6th is bad, and then the remaining are all valid UTF-16, we should probably return the first 5 on a call to `read`, then return an error, then return the remaining on the next call to `read`. Stdin in Console mode is dealing with text directly input by a user. In my opinion getting an unpaired surrogate is quite unlikely in that case, and a valid reason to error on the entire line of input (which is probably short). Dealing with it is incompatible with an unbuffered stdin, which seems the more interesting guarantee to me.
2019-02-24Rollup merge of #58442 - cuviper:unix-weak, r=alexcrichtonMazdak Farrokhzad-8/+7
Simplify the unix `Weak` functionality - We can avoid allocation by adding a NUL to the function name. - We can get `Option<F>` directly, rather than aliasing the inner `AtomicUsize`.
2019-02-23Correct OpenOptions::security_qos_flags documentationPaul Dicker-6/+20
2019-02-23Remove pub(crate) from stderr_rawPaul Dicker-13/+6
2019-02-23Rollup merge of #58595 - stjepang:make-duration-consts-associated, r=oli-obkMazdak Farrokhzad-3/+0
Turn duration consts into associated consts As suggested in https://github.com/rust-lang/rust/issues/57391#issuecomment-459658236, I'm moving `Duration` constants (`SECOND`, `MILLISECOND` and so on; currently behind unstable `duration_constants` feature) into the `impl Duration` block. cc @frewsxcv @SimonSapin
2019-02-23Rollup merge of #58453 - jethrogb:jb/sgx-panic-abort, r=nagisaMazdak Farrokhzad-0/+1
SGX target: fix panic = abort What is the difference between `no_mangle` and `rustc_std_internal_symbol`?
2019-02-22Rollup merge of #58632 - matklad:reduce-contention, r=CentrilMazdak Farrokhzad-23/+26
Make std feature list sorted This helps to avoid merge conflicts when concurrent PRs append features to the end of the list.
2019-02-22Rollup merge of #58059 - RalfJung:before_exec, r=alexcrichtonMazdak Farrokhzad-12/+56
deprecate before_exec in favor of unsafe pre_exec Fixes https://github.com/rust-lang/rust/issues/39575 As per the [lang team decision](https://github.com/rust-lang/rust/issues/39575#issuecomment-442993358): > The language team agreed that before_exec should be unsafe, and leaves the details of a transition plan to the libs team. Cc @alexcrichton @rust-lang/libs how would you like to proceed?
2019-02-22Make std feature list sortedAleksey Kladov-23/+26
This helps to avoid merge conflicts when concurrent PRs append features to the end of the list.
2019-02-20Use standard Read/Write traits in sys::stdioPaul Dicker-75/+114
2019-02-20Address review commentsPaul Dicker-22/+36
2019-02-20Turn duration consts into associated constsStjepan Glavina-3/+0
2019-02-20Refactor Windows stdio and remove stdin double bufferingPaul Dicker-116/+178
2019-02-20Remove unused Read implementation on sys::Windows::StdinPaul Dicker-9/+0
2019-02-20Remove sys::*::Stderr Write implementationPaul Dicker-80/+13
2019-02-20Rollup merge of #58553 - scottmcm:more-ihle, r=Centrilkennytm-158/+158
Use more impl header lifetime elision Inspired by seeing explicit lifetimes on these two: - https://doc.rust-lang.org/nightly/std/slice/struct.Iter.html#impl-FusedIterator - https://doc.rust-lang.org/nightly/std/primitive.u32.html#impl-Not And a follow-up to https://github.com/rust-lang/rust/pull/54687, that started using IHLE in libcore. Most of the changes in here fall into two big categories: - Removing lifetimes from common traits that can essentially never user a lifetime from an input (particularly `Drop`, `Debug`, and `Clone`) - Forwarding impls that are only possible because the lifetime doesn't matter (like `impl<R: Read + ?Sized> Read for &mut R`) I omitted things that seemed like they could be more controversial, like the handful of iterators that have a `Item: 'static` despite the iterator having a lifetime or the `PartialEq` implementations [where the flipped one cannot elide the lifetime](https://internals.rust-lang.org/t/impl-type-parameter-aliases/9403/2?u=scottmcm). I also removed two lifetimes that turned out to be completely unused; see https://github.com/rust-lang/rust/issues/41960#issuecomment-464557423
2019-02-20Rollup merge of #58551 - ssomers:master, r=oli-obkkennytm-2/+6
Explain a panic in test case net::tcp::tests::double_bind Those who try to build libstd on the Windows Subsystem for Linux experience a single failing test, where the point of failure is an explicit but anonymous panic, as reported in https://github.com/rust-lang/rust/issues/49367 This commit somewhat explains why and allows diagnosing a little.
2019-02-20Rollup merge of #58539 - aaronstillwell:master, r=Mark-Simulacrumkennytm-0/+81
Add alias methods to PathBuf for underlying OsString (#58234) Implemented the following methods on PathBuf which forward to the underlying OsString. - capacity - with_capacity - clear - reserve - reserve_exact - shrink_to_fit - shrink_to These methods have been documented with reference to the original docs for `OsString`. @Mark-Simulacrum please let me know if you feel this does not suffice. Further, I've not yet included tests for these definitions - please advise on how comprehensive tests need to be for methods such as these that simply alias other (already tested) methods. (This PR addresses issue #58234)
2019-02-20Rollup merge of #58530 - scottmcm:monomorphize-less, r=TimNNkennytm-9/+18
Monomorphize less code in fs::{read|write} Since the generic-ness is only for the as_refs, might as well have std just compile the important part once instead of on every use.
2019-02-20Rollup merge of #58392 - scottmcm:less-shifting-in-net-ip, r=oli-obkkennytm-25/+58
Use less explicit shifting in std::net::ip Now that we have `{to|from}_be_bytes` the code can be simpler. (Inspired by PR #57740)
2019-02-18Fixed doc example for Path::with_capacityAaron Stillwell-1/+2
2019-02-17Use more impl header lifetime elisionScott McMurray-158/+158
There are two big categories of changes in here - Removing lifetimes from common traits that can essentially never user a lifetime from an input (particularly `Drop` & `Debug`) - Forwarding impls that are only possible because the lifetime doesn't matter (like `impl<R: Read + ?Sized> Read for &mut R`) I omitted things that seemed like they could be more controversial, like the handful of iterators that have a `Item: 'static` despite the iterator having a lifetime or the `PartialEq` implementations where the flipped one cannot elide the lifetime.
2019-02-18Auto merge of #58373 - RalfJung:maybe-uninit, r=gnzlbgbors-1/+6
update stdsimd and remove now-unused MaybeUninit::into_inner That's a huge diff for stdsimd... Cc @gnzlbg @alexcrichton
2019-02-18Merge remote-tracking branch 'upstream/master'Stein Somers-816/+1085
2019-02-18Explain a panic in test case net::tcp::tests::double_bindStein Somers-2/+6
2019-02-17Changed feature gate for new PathBuf methodsAaron Stillwell-7/+7
Feature gate changed to `path_buf_capacity` as per advice from @Mark-Simulacrum
2019-02-17Fixes for implementation of PathBuf methods (aliases for OsString)Aaron Stillwell-19/+19
- Fixed incorrect `mut` usage - Fixed style in accordance with tidy - Marked all methods as unstable - Changed feature identifier to path_buf_alias_os_string_methods
2019-02-17Add alias methods to PathBuf for underlying OsStringAaron Stillwell-1/+81
Implemented the following methods on PathBuf which forward to the underlying OsString. - capacity - with_capacity - clear - reserve - reserve_exact - shrink_to_fit - shrink_to
2019-02-16Monomorphize less code in fs::{read|write}Scott McMurray-9/+18
Since the generic-ness is only for the as_refs, might as well have std just compile the important part once instead of on every use.
2019-02-17Rollup merge of #58521 - sfackler:error-iter-issue, r=withoutboatskennytm-4/+4
Fix tracking issue for error iterators
2019-02-17Rollup merge of #58496 - nathan:doc-std-path-pathbuf-pop, r=frewsxcvkennytm-2/+1
Fix documentation for std::path::PathBuf::pop Closes #58474.