about summary refs log tree commit diff
path: root/src/libstd
AgeCommit message (Collapse)AuthorLines
2019-03-09Rollup merge of #59018 - alexcrichton:omg, r=sfacklerMazdak Farrokhzad-15/+0
std: Delete a by-definition spuriously failing test This commit deletes the `connect_timeout_unbound` test from the standard library which, unfortunately, is by definition eventually going to be a spuriously failing test. There's no way to reserve a port as unbound so we can rely on ecosystem testing for this feature for now. Closes #52590
2019-03-09Auto merge of #57882 - euclio:unused-doc-attributes, r=estebankbors-2/+2
overhaul unused doc comments lint This PR contains a number of improvements to the `unused_doc_comments` lint. - Extends the span to cover the entire comment when using sugared doc comments. - Triggers the lint for all unused doc comments on a node, instead of just the first one. - Triggers the lint on macro expansions, and provides a help note explaining that doc comments must be expanded by the macro. - Adds a label pointing at the node that cannot be documented. Furthermore, this PR fixes any instances in rustc where a macro expansion was erroneously documented.
2019-03-08expand unused doc comment diagnosticAndy Russell-2/+2
Report the diagnostic on macro expansions, and add a label indicating why the comment is unused.
2019-03-08std: Delete a by-definition spuriously failing testAlex Crichton-15/+0
This commit deletes the `connect_timeout_unbound` test from the standard library which, unfortunately, is by definition eventually going to be a spuriously failing test. There's no way to reserve a port as unbound so we can rely on ecosystem testing for this feature for now. Closes #52590
2019-03-08Rollup merge of #58963 - seanmonstar:patch-3, r=cramertjPietro Albini-0/+8
libstd: implement Error::source for io::Error
2019-03-08Rollup merge of #58893 - benaryorg:thread_local_example_join, r=alexcrichtonPietro Albini-1/+4
race condition in thread local storage example The example had a potential race condition that would still pass the test. If the thread which was supposed to modify it's own thread local was slower than the instruction to modify in the main thread, then the test would pass even in case of a failure. This is would be minor if the child thread was waited for since it check using an `assert_eq` for the same thing, but vice versa. However, if the `assert_eq` failed this would trigger a panic, which is not at all caught by the example since the thread is not waited on. Signed-off-by: benaryorg <binary@benary.org>
2019-03-08Rollup merge of #58369 - nox:sync-hash-map-entry, r=AmanieuPietro Albini-0/+10
Make the Entry API of HashMap<K, V> Sync and Send Fixes #45219
2019-03-05libstd: implement Error::source for io::ErrorSean McArthur-0/+8
2019-03-05Auto merge of #58423 - nox:relax-bounds-buf-reader, r=dtolnaybors-0/+2
Relax Read bounds on a bunch of BufReader<R> methods
2019-03-04Make the Entry API of HashMap<K, V> Sync and Send (fixes #45219)Anthony Ramine-0/+10
2019-03-03race condition in thread local storage examplebenaryorg-1/+4
The example had a potential race condition that would still pass the test. If the thread which was supposed to modify it's own thread local was slower than the instruction to modify in the main thread, then the test would pass even in case of a failure. This is would be minor if the child thread was waited for since it check using an `assert_eq` for the same thing, but vice versa. However, if the `assert_eq` failed this would trigger a panic, which is not at all caught by the example since the thread is not waited on. Signed-off-by: benaryorg <binary@benary.org>
2019-03-03Auto merge of #58793 - Mark-Simulacrum:master-next, r=alexcrichtonbors-18/+8
Bootstrap compiler update for 1.35 release r? @alexcrichton
2019-03-03Auto merge of #58464 - jethrogb:jb/std-test-panic-output, r=alexcrichtonbors-19/+41
Use the correct stderr when testing libstd When compiling the unit tests for libstd, there are two copies of `std` in existence, see [lib.rs](https://github.com/rust-lang/rust/blob/919cf42/src/libstd/lib.rs#L335-L341). This means there are two copies of everything, including thread local variable definitions. Before this PR, it's possible that libtest would configure a stderr sink in one of those copies, whereas the panic logic would inspect the sink in the other copy, resulting in libtest missing the relevant panic message. This PR makes sure that when testing, the panic logic always accesses the stderr sink from “realstd”, using the same logic that libtest uses.
2019-03-02Bootstrap compiler update for 1.35 releaseMark Rousskov-18/+8
2019-03-02Auto merge of #58216 - pitdicker:sqos_flags, r=alexcrichtonbors-8/+25
Set secure flags when opening a named pipe on Windows Fixes https://github.com/rust-lang/rust/issues/42036, see also the previous attempt in https://github.com/rust-lang/rust/pull/44556. Whether this is correct depends on if it is somehow possible to create a symlink to a named pipe, outside the named pipe filesystem (NPFS). But as far as I can tell that should be impossible. Also fixes that `security_qos_flags(SECURITY_ANONYMOUS)` does not set the `SECURITY_SQOS_PRESENT` flag, and the incorrect documentation about the default value of `security_qos_flags`.
2019-02-28Use the correct stderr when testing libstdJethro Beekman-19/+41
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.