about summary refs log tree commit diff
path: root/src/libstd
AgeCommit message (Collapse)AuthorLines
2019-03-28Rollup merge of #59456 - ↵Mazdak Farrokhzad-5/+12
czipperz:for-keyword-document-higher-ranked-trait-bounds, r=Centril Add documentation about `for` used as higher ranked trait bounds Resolves #55416
2019-03-28Rollup merge of #59448 - benesch:macro-doc, r=CentrilMazdak Farrokhzad-22/+24
Use consistent phrasing for all macro summaries None
2019-03-28Rollup merge of #58803 - haraldh:fs_copy_fix, r=alexcrichtonMazdak Farrokhzad-55/+74
fs::copy() unix: set file mode early A convenience method like fs::copy() should try to prevent pitfalls a normal user doesn't think about. In case of an empty umask, setting the file mode early prevents temporarily world readable or even writeable files, because the default mode is 0o666. In case the target is a named pipe or special device node, setting the file mode can lead to unwanted side effects, like setting permissons on `/dev/stdout` or for root setting permissions on `/dev/null`. copy_file_range() returns EINVAL, if the destination is a FIFO/pipe or a device like "/dev/null", so fallback to io::copy, too. Fixes: https://github.com/rust-lang/rust/issues/26933 Fixed: https://github.com/rust-lang/rust/issues/37885
2019-03-27Fix link capitalization in documentation of std::io::BufWriter.Chris Gregory-2/+2
2019-03-27Document that `std::io::BufReader` discards contents on dropChris Gregory-0/+4
Resolves #55546
2019-03-27Move link to rust book to next line to pass 100 column limitChris Gregory-1/+2
2019-03-27Rollup merge of #59460 - xfix:include-id-in-thread-debug, r=AmanieuJosh Stone-1/+4
Include id in Thread's Debug implementation Since Rust 1.19.0, `id` is a stable method, so there is no reason to not include it in Debug implementation.
2019-03-27Rollup merge of #59451 - TimDiekmann:patch-1, r=sfacklerJosh Stone-1/+1
Add `Default` to `std::alloc::System` `System` is a unit struct, thus, it can be constructed without any additional information. Therefore `Default` is a noop. However, in generic code, a `T: Default` may happen as in ```rust #[derive(Default)] struct Foo<A> { allocator: A } ``` Does this need a feature gate? Should I also add `PartialEq/Eq/PartialOrd/Ord/Hash`?
2019-03-27Rollup merge of #59284 - RalfJung:maybe-uninit, r=sfacklerJosh Stone-6/+6
adjust MaybeUninit API to discussions uninitialized -> uninit into_initialized -> assume_init read_initialized -> read set -> write
2019-03-27Document std::fs::File close behavior ignoring errorsChris Gregory-1/+4
2019-03-27Add higher-ranked trait bounds linkChris Gregory-0/+1
2019-03-27Clarify behavior of dbg macroNikhil Benesch-1/+2
2019-03-27Include id in Thread's Debug implementationKonrad Borowski-1/+4
Since Rust 1.19.0, id is a stable method, so there is no reason to not include it in Debug implementation.
2019-03-27Make into itemized list and fix some wordingChris Gregory-7/+10
2019-03-27Add documentation about `for` used as higher ranked trait boundsChris Gregory-5/+7
Resolves #55416
2019-03-27Add `Default` to `std::alloc::System`Tim Diekmann-1/+1
2019-03-26Use consistent phrasing for all macro summariesNikhil Benesch-22/+23
2019-03-26fix some uses I missedRalf Jung-6/+6
2019-03-26Rollup merge of #59410 - tbu-:pr_doc_clarifyclamp, r=joshtriplettMazdak Farrokhzad-12/+31
Clarify `{Ord,f32,f64}::clamp` docs a little Explicitly call out when it returns NaN, adhere to the panic doc guidelines.
2019-03-26Rollup merge of #59374 - faern:simplify-checked-duration-since, r=shepmasterMazdak Farrokhzad-37/+29
Simplify checked_duration_since This follows the same design as we updated to in #56490. Internally, all the system specific time implementations are checked, no panics. Then the panicking publicly exported API can just call the checked version of itself and make do with a single panic (`expect`) at the top. Since the internal sys implementations are now checked, this gets rid of the extra `if self >= &earlier` check in `checked_duration_since`. Except likely making the generated machine code simpler, it also reduces the algorithm from "Check panic condition -> call possibly panicking method" to just "call non panicking method". Added two test cases: * Edge case: Make sure `checked_duration_since` on two equal `Instant`s produce a zero duration, not a `None`. * Most common/intended usage: Make sure `later.checked_duration_since(earlier)`, returns an expected value.
2019-03-26Auto merge of #59136 - jethrogb:jb/sgx-std-test, r=sanxiynbors-94/+235
SGX target: fix std unit tests This fixes some tests and some code in the SGX sys implementation to make the `std` unit test suite pass. #59009 must be merged first.
2019-03-25SGX target: fix std unit testsJethro Beekman-94/+235
2019-03-25Clarify `{Ord,f32,f64}::clamp` docs a littleTobias Bucher-12/+31
Explicitly call out when it returns NaN, adhere to the panic doc guidelines.
2019-03-23fs::copy() set file mode earlyHarald Hoyer-55/+74
A convenience method like fs::copy() should try to prevent pitfalls a normal user doesn't think about. In case of an empty umask, setting the file mode early prevents temporarily world readable or even writeable files, because the default mode is 0o666. In case the target is a named pipe or special device node, setting the file mode can lead to unwanted side effects, like setting permissons on `/dev/stdout` or for root setting permissions on `/dev/null`. copy_file_range() returns EINVAL, if the destination is a FIFO/pipe or a device like "/dev/null", so fallback to io::copy, too. Use `fcopyfile` on MacOS instead of `copyfile`. Fixes: https://github.com/rust-lang/rust/issues/26933 Fixed: https://github.com/rust-lang/rust/issues/37885
2019-03-22Update sys::time impls to have checked_sub_instantLinus Färnstrand-25/+18
2019-03-22Make duration_since use checked_duration_sinceLinus Färnstrand-6/+2
2019-03-22Add/rename checked_duration_since testsLinus Färnstrand-6/+9
2019-03-22Auto merge of #59370 - Centril:rollup, r=Centrilbors-8/+120
Rollup of 18 pull requests Successful merges: - #59106 (Add peer_addr function to UdpSocket) - #59170 (Add const generics to rustdoc) - #59172 (Update and clean up several parts of CONTRIBUTING.md) - #59190 (consistent naming for Rhs type parameter in libcore/ops) - #59236 (Rename miri component to miri-preview) - #59266 (Do not complain about non-existing fields after parse recovery) - #59273 (some small HIR doc improvements) - #59291 (Make Option<ThreadId> no larger than ThreadId, with NonZeroU64) - #59297 (convert field/method confusion help to suggestions) - #59304 (Move some bench tests back from libtest) - #59309 (Add messages for different verbosity levels. Output copy actions.) - #59321 (Unify E0109, E0110 and E0111) - #59322 (Tweak incorrect escaped char diagnostic) - #59323 (use suggestions for "enum instead of variant" error) - #59327 (Add NAN test to docs) - #59329 (cleanup: Remove compile-fail-fulldeps directory again) - #59347 (Move one test from run-make-fulldeps to ui) - #59360 (Add tracking issue number for `seek_convenience`) Failed merges: r? @ghost
2019-03-22Rollup merge of #59360 - LukasKalbertodt:patch-2, r=rkruppeMazdak Farrokhzad-2/+2
Add tracking issue number for `seek_convenience` We forgot to do that in #58422
2019-03-22Rollup merge of #59327 - Xaeroxe:clamp-doc, r=scottmcmMazdak Farrokhzad-0/+38
Add NAN test to docs Documents and tests NAN behavior for the new (f32, f64)::clamp function.
2019-03-22Rollup merge of #59291 - SimonSapin:nonzero-thread-id, r=alexcrichtonMazdak Farrokhzad-4/+11
Make Option<ThreadId> no larger than ThreadId, with NonZeroU64
2019-03-22Rollup merge of #59106 - LinusU:udp-peer-addr, r=kennytmMazdak Farrokhzad-2/+69
Add peer_addr function to UdpSocket Fixes #59104 This is my first pull request to Rust, so opening early for some feedback. My biggest question is: where do I add tests? Any comments very much appreciated!
2019-03-22Auto merge of #58953 - jethrogb:jb/unify-ffi, r=alexcrichtonbors-809/+186
Unify OsString/OsStr for byte-based implementations As requested in #57860 r? @joshtriplett
2019-03-22Auto merge of #57810 - MikaelUrankar:stack_t_bsd, r=nagisabors-2/+2
FreeBSD 10.x is EOL, in FreeBSD 11 and later, ss_sp is actually a void* …d* [1] dragonflybsd still uses c_char [2] [1] https://svnweb.freebsd.org/base/releng/11.2/sys/sys/signal.h?revision=334459&view=markup#l438 [2] https://github.com/DragonFlyBSD/DragonFlyBSD/blob/master/sys/sys/signal.h#L339
2019-03-22Add tracking issue number for `seek_convenience`Lukas Kalbertodt-2/+2
2019-03-21Unify OsString/OsStr for byte-based implementationsJethro Beekman-809/+186
2019-03-21FreeBSD 10.x is EOL, in FreeBSD 11 and later, ss_sp is actually a void* [1]MikaelUrankar-2/+2
dragonflybsd still uses c_char [2] [1] https://svnweb.freebsd.org/base/releng/11.2/sys/sys/signal.h?revision=334459&view=markup#l438 [2] https://github.com/DragonFlyBSD/DragonFlyBSD/blob/master/sys/sys/signal.h#L339
2019-03-21Auto merge of #58422 - LukasKalbertodt:seek-convenience, r=alexcrichtonbors-2/+134
Add provided methods `Seek::{stream_len, stream_position}` This adds two new, provided methods to the `io::Seek` trait: - `fn stream_len(&mut self) -> Result<u64>` - `fn stream_position(&mut self) -> Result<u64>` Both are added for convenience and to improve readability in user code. Reading `file.stream_len()` is much better than to manually seek two or three times. Similarly, `file.stream_position()` is much more clear than `file.seek(SeekFrom::Current(0))`. You can find prior discussions [in this internals thread](https://internals.rust-lang.org/t/pre-rfc-idea-extend-io-seek-with-convenience-methods-with-e-g-stream-len/9262). I think I addressed all concerns in that thread. I already wrote three RFCs to add a small new API to libstd but I noticed that many public changes to libstd happen without an RFC. So I figured I can try opening a PR directly without going through RFCs first. After all, we do have rfcbot here too. If you think this change is too big to merge without an RFC, I can still close this PR and write an RFC.
2019-03-21Auto merge of #58913 - Milack27:patch_buf_reader, r=joshtriplettbors-2/+45
Add new test case for possible bug in BufReader When reading a large chunk from a BufReader, if all the bytes from the buffer have been already consumed, the internal buffer is bypassed entirely. However, it is not invalidated, and it's possible to access its contents using the `seek_relative` method, because it tries to reuse the existing buffer.
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).