about summary refs log tree commit diff
path: root/library/std/src
AgeCommit message (Collapse)AuthorLines
2021-06-15Fix copy-paste error in sys/hermit error message.Mara Bos-1/+1
2021-06-15Redefine `ErrorKind::Other` and stop using it in std.Mara Bos-74/+86
2021-06-15Rollup merge of #86314 - Veykril:patch-2, r=JohnTitorYuki Okushi-2/+1
Remove trailing triple backticks in `mut_keyword` docs
2021-06-15Rollup merge of #86294 - m-ou-se:edition-prelude-modules, r=joshtriplettYuki Okushi-10/+23
Stabilize {std, core}::prelude::rust_*. This stabilizes the `{core, std}::prelude::{rust_2015, rust_2018, rust_2021}` modules. The usage of these modules as the prelude in those editions was already stabilized. This just stabilizes the modules themselves, making it possible for a user to explicitly refer to them. Tracking issue: https://github.com/rust-lang/rust/issues/85684 FCP on the RFC that included this finished here: https://github.com/rust-lang/rfcs/pull/3114#issuecomment-840577395
2021-06-15Rollup merge of #85792 - mjptree:refactor-windows-sockets, r=JohnTitorYuki Okushi-133/+173
Refactor windows sockets impl methods No behavioural changes, but a bit tidier visual flow.
2021-06-15Rollup merge of #82179 - mbartlett21:patch-5, r=joshtriplettYuki Okushi-0/+4
Add functions `Duration::try_from_secs_{f32, f64}` These functions allow constructing a Duration from a floating point value that could be out of range without panicking. Tracking issue: #83400
2021-06-15Rollup merge of #80269 - pickfire:patch-4, r=joshtriplettYuki Okushi-7/+46
Explain non-dropped sender recv in docs Original senders that are still hanging around could cause Receiver::recv to not block since this is a potential footgun for beginners, clarify more on this in the docs for readers to be aware about it. Maybe it would be better to show an example of the pattern where `drop(tx)` is used when it is being cloned multiple times? Although I have seen it in quite a few articles but I am surprised that this part is not very clear with the current words without careful reading. > If the corresponding Sender has disconnected, or it disconnects while this call is blocking, this call will wake up and return Err to indicate that no more messages can ever be received on this channel. However, since channels are buffered, messages sent before the disconnect will still be properly received. Some words there may seemed similar if I carefully read and relate it but if I am new, I probably does not know "drop" makes it "disconnected". So I mention the words "drop" and "alive" to make it more relatable to lifetime.
2021-06-15add explicit hidden file name testsMichael Hall-0/+26
2021-06-15simplify logic for split_file_at_dotMichael Hall-8/+4
2021-06-15Update keyword_docs.rsLukas Wirth-2/+1
2021-06-14Stabilize {std, core}::prelude::rust_*.Mara Bos-10/+23
2021-06-14Add functions `Duration::try_from_secs_{f32, f64}`mbartlett21-0/+4
This also adds the error type used, `FromSecsError` and its `impl`s.
2021-06-14run tidyEthan Brierley-1/+1
2021-06-14stabilize `int_error_matching`Ethan Brierley-7/+1
2021-06-14Stabilize `maybe_uninit_ref`Yuki Okushi-1/+0
2021-06-13Change tracking issueltdk-2/+2
2021-06-13More lerp tests, altering lerp docsltdk-26/+118
2021-06-12Explain non-dropped sender recv in docsIvan Tham-7/+46
Original senders that are still hanging around could cause Receiver::recv to not block since this is a potential footgun for beginners, clarify more on this in the docs for readers to be aware about it. Fix minor tidbits in sender recv doc Co-authored-by: Dylan DPC <dylan.dpc@gmail.com> Add example for unbounded receive loops in doc Show the drop(tx) pattern, based on tokio docs https://tokio-rs.github.io/tokio/doc/tokio/sync/index.html Fix example code for drop sender recv Fix wording in sender docs Co-authored-by: Josh Triplett <josh@joshtriplett.org>
2021-06-10Specialize `io::Bytes::size_hint` for more typesBenoît du Garreau-3/+96
2021-06-10Rollup merge of #86051 - erer1243:update_move_keyword_docs, r=Mark-SimulacrumYuki Okushi-11/+9
Updated code examples and wording in move keyword documentation Had a conversation with someone on the Rust Discord who was confused by the move keyword documentation. Some of the wording is odd sounding ("owned by value" - what else can something be owned by?). Also, some of the examples used Copy types when demonstrating move, leading to variables still being accessible in the outer scope after the move, contradicting the examples' comments. I changed the move keyword documentation a bit, removing that odd wording and changing all the examples to use non-Copy types
2021-06-10Rollup merge of #84687 - a1phyr:improve_rwlock, r=m-ou-seYuki Okushi-133/+111
Multiple improvements to RwLocks This PR replicates #77147, #77380 and #84650 on RWLocks : - Split `sys_common::RWLock` in `StaticRWLock` and `MovableRWLock` - Unbox rwlocks on some platforms (Windows, Wasm and unsupported) - Simplify `RwLock::into_inner` Notes to reviewers : - For each target, I copied `MovableMutex` to guess if `MovableRWLock` should be boxed. - ~A comment says that `StaticMutex` is not re-entrant, I don't understand why and I don't know whether it applies to `StaticRWLock`.~ r? `@m-ou-se`
2021-06-09optimize Eq implementation for pathsThe8472-1/+1
Filesystems generally have a tree-ish structure which means paths are more likely to share a prefix than a suffix. Absolute paths are especially prone to share long prefixes.
2021-06-09Remove `is_unicast_site_local`Christiaan Dirkx-52/+1
2021-06-09Rollup merge of #86121 - ↵Yuki Okushi-0/+10
nickshiling:forwarding_impl_for_seek_trait_stream_position, r=dtolnay Forwarding implementation for Seek trait's stream_position method Forwarding implementations for `Seek` trait's `stream_position` were missed when it was stabilized in `1.51.0`
2021-06-09Rollup merge of #85791 - CDirkx:is_unicast, r=joshtriplettYuki Okushi-1/+29
Add `Ipv6Addr::is_unicast` Adds an unstable utility method `Ipv6Addr::is_unicast` under the feature flag `ip` (tracking issue: #27709). Added for completeness with the other unicast methods (see also https://github.com/rust-lang/rust/issues/85604#issuecomment-848220455) and opposite of `is_multicast`.
2021-06-09Rollup merge of #85676 - CDirkx:ip-style, r=JohnTitorYuki Okushi-26/+26
Fix documentation style inconsistencies for IP addresses Pulled out of #85655 as it is unrelated. Fixes some inconsistencies in the docs for IP addresses: - Currently some addresses are backticked, some are not, this PR backticks everything consistently. (looks better imo) - Lowercase hex-literals are used when writing addresses.
2021-06-08Link reference in `dyn` keyword documentationAdrien Morison-2/+5
The "read more" sentence formatted "object safety" as inline code instead of providing a link to more information. This PR adds a link to the Reference about this matter, as well as the page regarding trait objects.
2021-06-07Forwarding implementation for Seek trait's stream_position methodmyshylin-0/+10
2021-06-07make both panic display formats collapse framesAshley Mannix-6/+4
2021-06-07format symbols under shared framesAshley Mannix-2/+3
2021-06-06A few lerp testsltdk-0/+43
2021-06-06Default panic message should print Box<dyn Any>Reagan McFarland-1/+1
Prior to this patch, the default panic message (resulting from calling `panic_any(42);` for example), would print the following error message: ``` thread 'main' panicked at 'Box<Any>', ... ``` However, this should be `Box<dyn Any>` instead.
2021-06-06Update doc library/std/src/path.rsMax Wase-1/+0
Co-authored-by: Mara Bos <m-ou.se@m-ou.se>
2021-06-05Updated code examples and wordingerer1243-11/+9
2021-06-05Rollup merge of #85974 - GuillaumeGomez:td-align, r=jshaGuillaume Gomez-2/+2
td align attribute This is a follow-up of #85972. I have put this one on its own because it changes the display: ![Screenshot from 2021-06-03 21-49-11](https://user-images.githubusercontent.com/3050060/120703622-d533d280-c4b5-11eb-9519-ea1131a40bee.png) Without align: ![Screenshot from 2021-06-03 21-49-15](https://user-images.githubusercontent.com/3050060/120703623-d5cc6900-c4b5-11eb-95f9-878d3915c7fb.png) I also opened an issue about it: raphlinus/pulldown-cmark#533. However, I'm not sure if this is the right course of action... Should we instead ignore the warning? r? ``@jsha``
2021-06-05Rollup merge of #85760 - ChrisDenton:path-doc-platform-specific, r=m-ou-seGuillaume Gomez-9/+9
Possible errors when accessing file metadata are platform specific In particular the `is_dir`, `is_file` and `exists` functions suggests that querying a file requires querying the directory. On Windows this is not normally true. r? `@m-ou-se`
2021-06-05Rollup merge of #85710 - fee1-dead:document-path, r=m-ou-seGuillaume Gomez-0/+24
Document `From` impls in path.rs
2021-06-05Implement `Cursor::{remaining, is_empty}`Sören Meier-4/+59
2021-06-05Rename IoSlice(Mut)::advance_slice to advance_slicesThomas de Zeeuw-24/+24
2021-06-05Rollup merge of #84942 - jyn514:channel-replace, r=ManishearthYuki Okushi-1/+0
rustdoc: link to stable/beta docs consistently in documentation This is an alternative to https://github.com/rust-lang/rust/pull/84941 which fixes the problem consistently by linking to stable/beta for *all* items, not just for primitives. ## User-facing changes - Intra-doc links to primitives that currently go to rust-lang.org/nightly/std/primitive.x.html will start going to channel that rustdoc was built with. Nightly will continue going to /nightly; Beta will link to /beta; stable compilers will link to /1.52.1 (or whatever version they were built as). - Cross-crate links from std to core currently go to /nightly unconditionally. They will start going to /1.52.0 on stable channels (but remain the same on nightly channels). - Intra-crate links from std to std (or core to core) currently go to the same URL they are hosted at; they will continue to do so. Notably, this is different from everything else because it can preserve the distinction between /stable and /1.52.0 by using relative links. Note that "links" includes both intra-doc links and rustdoc's own automatically generated hyperlinks. ## Implementation changes - Update the testsuite to allow linking to /beta and /1.52.1 in docs - Use an html_root_url for the standard library that's dependent on the channel This avoids linking to nightly docs on stable. - Update rustdoc to use channel-dependent links for primitives from an unknown crate - Set DOC_RUST_LANG_ORG_CHANNEL from bootstrap to ensure it's in sync - Include doc.rust-lang.org in the channel cc Mark-Simulacrum - I know [you were dubious about this in the past](https://rust-lang.zulipchat.com/#narrow/stream/122651-general/topic/Rustdoc.20unconditionally.20links.20to.20nightly.20libstd.20docs/near/231223124), but I'm not quite sure why? I see this as "just a bugfix", I don't know why rustdoc should unconditionally link to nightly. cc dtolnay who commented in https://github.com/rust-lang/rust/issues/30693: > I would welcome a PR to solve this permanently if anyone has ideas for how. I don't believe we need an RFC. Fixes https://github.com/rust-lang/rust/issues/30693 (note that issue is marked as feature-accepted, although I don't see where it was discussed).
2021-06-04rustdoc: link to stable/beta docs consistently in documentationJoshua Nelson-1/+0
## User-facing changes - Intra-doc links to primitives that currently go to rust-lang.org/nightly/std/primitive.x.html will start going to channel that rustdoc was built with. Nightly will continue going to /nightly; Beta will link to /beta; stable compilers will link to /1.52.1 (or whatever version they were built as). - Cross-crate links from std to core currently go to /nightly unconditionally. They will start going to /1.52.0 on stable channels (but remain the same on nightly channels). - Intra-crate links from std to std (or core to core) currently go to the same URL they are hosted at; they will continue to do so. Notably, this is different from everything else because it can preserve the distinction between /stable and /1.52.0 by using relative links. Note that "links" includes both intra-doc links and rustdoc's own automatically generated hyperlinks. ## Implementation changes - Update the testsuite to allow linking to /beta and /1.52.1 in docs - Use an html_root_url for the standard library that's dependent on the channel This avoids linking to nightly docs on stable. - Update rustdoc to use channel-dependent links for primitives from an unknown crate - Set DOC_RUST_LANG_ORG_CHANNEL from bootstrap to ensure it's in sync - Include doc.rust-lang.org in the channel
2021-06-04Auto merge of #85806 - ATiltedTree:android-ndk-beta, r=petrochenkovbors-1/+0
Support Android ndk versions `r23-beta3` and up Since android ndk version `r23-beta3`, `libgcc` has been replaced with `libunwind`. This moves the linking of `libgcc`/`libunwind` into the `unwind` crate where we check if the system compiler can find `libunwind` and fall back to `libgcc` if needed.
2021-06-04Fix invalid align attribute generation on <td> elementsGuillaume Gomez-2/+2
2021-06-01Add lerp methodltdk-0/+56
2021-06-02Auto merge of #85687 - m-ou-se:new-prelude, r=yaahcbors-7/+7
New prelude RFC: rust-lang/rfcs#3114 Tracking issue: https://github.com/rust-lang/rust/issues/85684
2021-06-01Support Android ndk versions `r23-beta3` and upTilmann Meyer-1/+0
Since android ndk version `r23-beta3`, `libgcc` has been replaced with `libunwind`. This moves the linking of `libgcc`/`libunwind` into the `unwind` crate where we check if the system compiler can find `libunwind` and fall back to `libgcc` if needed.
2021-06-01Multiple improvements to RwLocksBenoît du Garreau-133/+111
- Split `sys_common::RWLock` between `StaticRWLock` and `MovableRWLock` - Unbox `RwLock` on some platforms (Windows, Wasm and unsupported) - Simplify `RwLock::into_inner`
2021-05-31Use `is_unicast` instead of ``!is_multicast`Christiaan Dirkx-1/+1
2021-05-31Add `Ipv6Addr::is_unicast`Christiaan Dirkx-0/+28
2021-05-30Remove `is_unicast_link_local_strict`Christiaan Dirkx-101/+27