about summary refs log tree commit diff
path: root/src/libstd
AgeCommit message (Collapse)AuthorLines
2019-03-20Fix f64 testJacob Kiesel-1/+1
2019-03-20Fix formatting and add unit tests for panic casesJacob Kiesel-2/+38
2019-03-20Add NAN test to docsJacob Kiesel-0/+2
2019-03-20Add a test for size_of Option<ThreadId>Simon Sapin-1/+7
2019-03-19Rollup merge of #58812 - jonhoo:floor_v_trunc, r=alexcrichtonMazdak Farrokhzad-8/+16
Clarify distinction between floor() and trunc() `floor()` rounds towards `-INF`, `trunc()` rounds towards 0. This PR clarifies this in the examples.
2019-03-19Rollup merge of #57847 - clarcharr:dbg_no_params, r=CentrilMazdak Farrokhzad-0/+6
dbg!() without parameters Fixes #57845.
2019-03-19Make Option<ThreadId> no larger than ThreadId, with NonZeroU64Simon Sapin-3/+4
2019-03-18Add todo!() macroAleksey Kladov-1/+2
The use-case of `todo!()` macro is to be a much easier to type alternative to `unimplemented!()` macro.
2019-03-17Apply suggestions from code review Tobias Bucher-2/+2
Fix typos in the documentation Co-Authored-By: LukasKalbertodt <lukas.kalbertodt@gmail.com>
2019-03-16Rollup merge of #59175 - Zoxc:fix-process-test, r=alexcrichtonkennytm-1/+1
Don't run test launching `echo` since that doesn't exist on Windows
2019-03-16Rollup merge of #59152 - smmalis37:range_contains, r=SimonSapinkennytm-1/+1
Stabilize Range*::contains. Closes https://github.com/rust-lang/rust/issues/32311. There's also a bit of rustfmt on range.rs thrown in for good measure (I forgot to turn off format-on-save in VSCode).
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