about summary refs log tree commit diff
path: root/src/libstd
AgeCommit message (Collapse)AuthorLines
2019-03-16Rollup merge of #59147 - jethrogb:jb/time-tests, r=sfacklerkennytm-9/+2
Make std time tests more robust for platform differences Previously, `time::tests::since_epoch` and `time::tests::system_time_math` would fail if the platform represents a SystemTime as unix epoch + `u64` nanoseconds. r? @sfackler
2019-03-16Rollup merge of #59082 - alexreg:cosmetic-2-doc-comments, r=Centrilkennytm-12/+12
A few improvements to comments in user-facing crates Not too many this time, and all concern comments (almost all doc comments) in user-facing crates (libstd, libcore, liballoc). r? @steveklabnik
2019-03-16Rollup merge of #59009 - sfackler:fix-sgx-vectors, r=alexcrichtonkennytm-32/+34
Fix SGX implementations of read/write_vectored.
2019-03-16Add UdpSocket peer_addr implementation for WasmLinus Unnebäck-0/+4
2019-03-16Add UdpSocket peer_addr implementation for L4ReLinus Unnebäck-1/+4
2019-03-16Fix test names regarding ip versionLinus Unnebäck-2/+2
2019-03-16Add test for UdpSocket peer_addrLinus Unnebäck-0/+10
2019-03-16Document UdpSocket peer_addr NotConnected errorLinus Unnebäck-0/+13
2019-03-16Mark UdpSocket peer_addr unstable w/ tracking issueLinus Unnebäck-1/+2
2019-03-16Add peer_addr function to UdpSocketLinus Unnebäck-0/+36
2019-03-16Rollup merge of #58949 - jethrogb:jb/sgx-thread-id, r=joshtriplettkennytm-0/+6
SGX target: Expose thread id function in os module In order to call `std::os::fortanix_sgx::usercalls::send`, you need the thread id. This exposes it through another function in `std::os::fortanix_sgx`. I looked at how other platforms do this. On Windows and `cfg(unix)` you can get the OS handle from a `thread::JoinHandle`, but that's not sufficient, I need it for a `thread::Thread`. In the future, this functionality could be added to `thread::Thread` and this platform can follow suit. r? @joshtriplett
2019-03-16Rollup merge of #58901 - ebarnard:just-copying, r=sfacklerkennytm-2/+108
Change `std::fs::copy` to use `copyfile` on MacOS and iOS `copyfile` on MacOS is similar to `CopyFileEx` on Windows. It supports copying resource forks, extended attributes, and file ACLs, none of which are copied by the current generic unix implementation. The API is available from MacOS 10.7 and iOS 4.3 (and possibly earlier but I haven't checked). Closes #58895.
2019-03-16Rollup merge of #58855 - alexcrichton:wasm-multithreaded-alloc, r=fitzgenkennytm-15/+80
std: Spin for a global malloc lock on wasm32 There's lots of comments in the code, but the main gist of this commit is that the acquisition of the global malloc lock on the `wasm32-unknown-unknown` target when threads are enabled will not spin on contention rather than block.
2019-03-15Auto merge of #58710 - EdorianDark:master, r=sfacklerbors-0/+43
Add clamp for ranges. Implements #44095 Ready for merge
2019-03-14Change "undefined" to "unspecified" in `Seek::stream_len` docsLukas Kalbertodt-1/+1
2019-03-14Overwrite Cursor's `Seek::stream_{len, position}` for performanceLukas Kalbertodt-0/+8
2019-03-14Avoid third seek operation in `Seek::stream_len` when possibleLukas Kalbertodt-5/+12
2019-03-14Don't run test launching `echo` since that doesn't exist on WindowsJohn Kåre Alsaker-1/+1
2019-03-12Stabilize Range*::contains.Steven Malis-1/+1
2019-03-12Make std time tests more robust for platform differencesJethro Beekman-9/+2
2019-03-11Resolved nits raised in review.Alexander Regueiro-6/+6
2019-03-11Improvements to comments in libstd, libcore, liballoc.Alexander Regueiro-12/+12
2019-03-10Add provided methods `Seek::{stream_len, stream_position}`Lukas Kalbertodt-2/+119
These two methods are defined in terms of `Seek::seek` and are added for convenience. Tests are included.
2019-03-09Use lifetime contravariance to elide more lifetimes in core+alloc+stdScott McMurray-38/+38
2019-03-09add feature clampDirk Leifeld-0/+3
2019-03-09Revert "Revert "Add clamp functions""Dirk Leifeld-0/+40
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-07Always call read/write from default vectored io methodsSteven Fackler-28/+32
2019-03-07Fix SGX implementations of read/write_vectored.Steven Fackler-12/+10
2019-03-06Fix buffer invalidation at BufReader.read_vectoredAndré Vicente Milack-9/+11
2019-03-06Fix buffer invalidation for BufReadAndré Vicente Milack-2/+43
There are two moments when a BufRead object needs to empty it's internal buffer: - In a seek call; - In a read call when all data in the internal buffer had been already consumed and the output buffer has a greater or equal size than the internal buffer. In both cases, the buffer was not being properly emptied, but only marked as consumed (self.pos = self.cap). That should be no problem if the inner reader is only Read, but if it is Seek as well, then it's possible to access the data in the buffer by using the seek_relative method. In order to prevent this from happening, both self.pos and self.cap should be set to 0. Two test cases were added to detect that failure: - test_buffered_reader_invalidated_after_read - test_buffered_reader_invalidated_after_seek Both tests are very similar to each other. The inner reader contains the following data: [5, 6, 7, 0, 1, 2, 3, 4]. The buffer capacity is 3 bytes. - First, we call fill_buffer, which loads [5, 6, 7] into the internal buffer, and then consume those 3 bytes. - Then we either read the 5 remaining bytes in a single read call or we move to the end of the stream by calling seek. In both cases the buffer should be emptied to prevent the previous data [5, 6, 7] from being read. - We now call seek_relative(-2) and read two bytes, which should give us the last 2 bytes of the stream: [3, 4]. Before this commit, the the seek_relative method would consider that we're still in the range of the internal buffer, so instead of fetching data from the inner reader, it would return the two last bytes that were incorrectly still in the buffer: [6, 7]. Therefore, the test would fail. Now, when seek_relative is called the buffer is empty. So the expected data [3, 4] is fetched from the inner reader and the test passes.
2019-03-05libstd: implement Error::source for io::ErrorSean McArthur-0/+8
2019-03-05SGX target: Expose thread id function in os moduleJethro Beekman-0/+6
2019-03-05std: Spin for a global malloc lock on wasm32Alex Crichton-15/+80
There's lots of comments in the code, but the main gist of this commit is that the acquisition of the global malloc lock on the `wasm32-unknown-unknown` target when threads are enabled will not spin on contention rather than block.
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-04Fix typoEdward Barnard-1/+1
2019-03-04Add test for the behaviour of `fs::copy` when `to` is a symlinkEdward Barnard-0/+20
2019-03-04Change `std::fs::copy` to use `copyfile` on MacOS and iOSEdward Barnard-2/+88
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`.