about summary refs log tree commit diff
path: root/library/std/src/net
AgeCommit message (Collapse)AuthorLines
2022-06-23Assign issue number to the new const_socketaddrLinus Färnstrand-3/+3
2022-06-23Add IP structural_match testsLinus Färnstrand-0/+23
2022-06-23Remove ntohs/htons in favor of to_be/from_beLinus Färnstrand-14/+5
2022-06-23Implement IpV{4,6}Addr structs with native Rust encodingLinus Färnstrand-111/+38
2022-06-23Represent SocketAddrV4 and SocketAddrV6 as Rust native encodingLinus Färnstrand-91/+86
2022-05-24Fix stabilization version of `Ipv6Addr::to_ipv4_mapped`Tobias Bucher-1/+1
2022-05-23Implement `FusedIterator` for `std::net::[Into]Incoming`Chayim Refael Friedman-0/+7
They never return `None`, so they trivially fulfill the contract.
2022-05-23Auto merge of #96906 - tbu-:pr_stabilize_to_ipv4_mapped, r=dtolnaybors-5/+5
Stabilize `Ipv6Addr::to_ipv4_mapped` CC https://github.com/rust-lang/rust/issues/27709 (tracking issue for the `ip` feature which contains more functions) The function `Ipv6Addr::to_ipv4` is bad because it also returns an IPv4 address for the IPv6 loopback address `::1`. Stabilize `Ipv6Addr::to_ipv4_mapped` so we can recommend that function instead.
2022-05-10Recommend `Ipv6Addr::to_ipv4_mapped` over `Ipv6Addr::to_ipv4`Tobias Bucher-2/+4
Fixes #96718.
2022-05-10Stabilize `Ipv6Addr::to_ipv4_mapped`Tobias Bucher-3/+1
CC #27709 (tracking issue for the `ip` feature which contains more functions) The function `Ipv6Addr::to_ipv4` is bad because it also returns an IPv4 address for the IPv6 loopback address `::1`. Stabilize `Ipv6Addr::to_ipv4_mapped` so we can recommend that function instead.
2022-05-09Use Rust 2021 prelude in std itself.Mara Bos-2/+0
2022-05-09Auto merge of #95960 - jhpratt:remove-rustc_deprecated, r=compiler-errorsbors-8/+2
Remove `#[rustc_deprecated]` This removes `#[rustc_deprecated]` and introduces diagnostics to help users to the right direction (that being `#[deprecated]`). All uses of `#[rustc_deprecated]` have been converted. CI is expected to fail initially; this requires #95958, which includes converting `stdarch`. I plan on following up in a short while (maybe a bootstrap cycle?) removing the diagnostics, as they're only intended to be short-term.
2022-05-05Make it clear that `to_ipv4` returns an IPv4 address for the IPv6 loopbackTobias Bucher-1/+4
2022-04-19Improve AddrParseError descriptionChris Morgan-11/+28
The existing description was incorrect for socket addresses, and misleading: users would see “invalid IP address syntax” and suppose they were supposed to provide an IP address rather than a socket address. I contemplated making it two variants (IP, socket), but realised we can do still better for the IPv4 and IPv6 types, so here it is as six. I contemplated more precise error descriptions (e.g. “invalid IPv6 socket address syntax: expected a decimal scope ID after %”), but that’s a more invasive change, and probably not worthwhile anyway.
2022-04-14Remove use of `#[rustc_deprecated]`Jacob Pratt-8/+2
2022-03-31Adjust feature names that disagree on const stabilization versionDavid Tolnay-23/+23
2022-03-10Use implicit capture syntax in format_argsT-O-R-U-S-36/+35
This updates the standard library's documentation to use the new syntax. The documentation is worthwhile to update as it should be more idiomatic (particularly for features like this, which are nice for users to get acquainted with). The general codebase is likely more hassle than benefit to update: it'll hurt git blame, and generally updates can be done by folks updating the code if (and when) that makes things more readable with the new format. A few places in the compiler and library code are updated (mostly just due to already having been done when this commit was first authored).
2022-03-09Ignore `close_read_wakes_up` test on SGX platformRaoul Strackx-0/+1
2022-03-07Enable `close_read_wakes_up` on WindowsChris Denton-1/+0
2022-03-04Rollup merge of #88805 - krhancoc:master, r=dtolnayDylan DPC-0/+4
Clarification of default socket flags This PR outlines the decision to disable inheritance of socket objects when possible to child processes in the documentation.
2022-02-04Hide Repr details from io::Error, and rework `io::Error::new_const`.Thom Chiovoloni-4/+6
2022-02-01Fix incorrect panic message in exampleTheVoid-1/+1
2022-01-13fix stability attribute for `tcp::IntoIncoming`Ibraheem Ahmed-1/+3
2022-01-08export `tcp::IntoIncoming`Ibraheem Ahmed-1/+1
2022-01-06Rollup merge of #92288 - yescallop:patch-1, r=m-ou-seMatthias Krüger-2/+2
Fix a pair of mistyped test cases in `std::net::ip` These two test cases are not consistent with their comments, which I believe is unintended.
2021-12-31Make tidy check for magic numbers that spell thingsJosh Triplett-4/+4
Remove existing problematic cases.
2021-12-26fix typo: the use f.pad -> then use f.padHiroshi Kori-1/+1
2021-12-26Fix a pair of mistyped test cases in std::net::ipScallop Ye-2/+2
2021-12-14Fix a bunch of typosFrank Steffahn-1/+1
2021-12-09Auto merge of #81156 - DrMeepster:read_buf, r=joshtriplettbors-13/+1
Implement most of RFC 2930, providing the ReadBuf abstraction This replaces the `Initializer` abstraction for permitting reading into uninitialized buffers, closing #42788. This leaves several APIs described in the RFC out of scope for the initial implementation: * read_buf_vectored * `ReadBufs` Closes #42788, by removing the relevant APIs.
2021-11-06use matches!() macro in more placesMatthias Krüger-6/+1
2021-11-02read_bufDrMeepster-13/+1
2021-10-30Add #[must_use] to remaining std functions (A-N)John Kugelman-0/+13
2021-10-21Rollup merge of #86984 - Smittyvb:ipv4-octal-zero, r=m-ou-seYuki Okushi-10/+32
Reject octal zeros in IPv4 addresses This fixes #86964 by rejecting octal zeros in IP addresses, such that `192.168.00.00000000` is rejected with a parse error, since having leading zeros in front of another zero indicates it is a zero written in octal notation, which is not allowed in the strict mode specified by RFC 6943 3.1.1. Octal rejection was implemented in #83652, but due to the way it was implemented octal zeros were still allowed.
2021-10-13Rollup merge of #89794 - jkugelman:must-use-to_value-conversions, r=joshtriplettYuki Okushi-1/+13
Add #[must_use] to to_value conversions `NonNull<T>::cast` snuck in when I wasn't looking. What a scamp! Parent issue: #89692 r? ````@joshtriplett````
2021-10-11Add #[must_use] to is_condition testsJohn Kugelman-0/+31
A continuation of #89718.
2021-10-11Add #[must_use] to to_value conversionsJohn Kugelman-1/+13
2021-10-11Rollup merge of #89729 - jkugelman:must-use-core-std-constructors, ↵Guillaume Gomez-0/+5
r=joshtriplett Add #[must_use] to core and std constructors Parent issue: #89692 r? ``@joshtriplett``
2021-10-10Add #[must_use] to conversions that move selfJohn Kugelman-0/+1
2021-10-10Add #[must_use] to core and std constructorsJohn Kugelman-0/+5
2021-10-03Rollup merge of #89138 - newpavlov:patch-2, r=dtolnayManish Goregaokar-1/+1
Fix link in Ipv6Addr::to_ipv4 docs
2021-10-03Rollup merge of #86434 - CDirkx:ipv6-benchmarking, r=joshtriplettManish Goregaokar-32/+103
Add `Ipv6Addr::is_benchmarking` This PR adds the unstable method `Ipv6Addr::is_benchmarking`. This method is added for parity with `Ipv4Addr::is_benchmarking`, and I intend to use it in a future rework of `Ipv6Addr::is_global` (edit: #86634) to more accurately follow the [IANA Special Address Registry](https://www.iana.org/assignments/iana-ipv6-special-registry/iana-ipv6-special-registry.xhtml) (like is done in `Ipv4Addr::is_global`). With `Ipv6Addr::is_benchmarking` and `Ipv4Addr::is_benchmarking` now both existing, `IpAddr::is_benchmarking` is also added.
2021-09-25Auto merge of #88343 - steffahn:fix_code_spacing, r=jyn514bors-12/+11
Fix spacing of links in inline code. Similar to #80733, but the focus is different. This PR eliminates all occurrences of pieced-together inline code blocks like [`Box`]`<`[`Option`]`<T>>` and replaces them with good-looking ones (using HTML-syntax), like <code>[Box]<[Option]\<T>></code>. As far as I can tell, I should’ve found all of these in the standard library (regex search with `` r"`\]`|`\[`" ``) \[except for in `core::convert` where I’ve noticed other things in the docs that I want to fix in a separate PR]. In particular, unlike #80733, I’ve added almost no new instance of inline code that’s broken up into multiple links (or some link and some link-free part). I also added tooltips (the stuff in quotes for the markdown link listings) in places that caught my eye, but that’s by no means systematic, just opportunistic. [Box]: https://doc.rust-lang.org/std/boxed/struct.Box.html "Box" [`Box`]: https://doc.rust-lang.org/std/boxed/struct.Box.html "Box" [Option]: https://doc.rust-lang.org/std/option/enum.Option.html "Option" [`Option`]: https://doc.rust-lang.org/std/option/enum.Option.html "Option" Context: I got annoyed by repeatedly running into new misformatted inline code while reading the standard library docs. I know that once issue #83997 (and/or related ones) are resolved, these changes become somewhat obsolete, but I fail to notice much progress on that end right now. r? `@jyn514`
2021-09-25Apply 16 commits (squashed)Frank Steffahn-12/+11
---------- Fix spacing for links inside code blocks, and improve link tooltips in alloc::fmt ---------- Fix spacing for links inside code blocks, and improve link tooltips in alloc::{rc, sync} ---------- Fix spacing for links inside code blocks, and improve link tooltips in alloc::string ---------- Fix spacing for links inside code blocks in alloc::vec ---------- Fix spacing for links inside code blocks in core::option ---------- Fix spacing for links inside code blocks, and improve a few link tooltips in core::result ---------- Fix spacing for links inside code blocks in core::{iter::{self, iterator}, stream::stream, poll} ---------- Fix spacing for links inside code blocks, and improve a few link tooltips in std::{fs, path} ---------- Fix spacing for links inside code blocks in std::{collections, time} ---------- Fix spacing for links inside code blocks in and make formatting of `&str`-like types consistent in std::ffi::{c_str, os_str} ---------- Fix spacing for links inside code blocks, and improve link tooltips in std::ffi ---------- Fix spacing for links inside code blocks, and improve a few link tooltips in std::{io::{self, buffered::{bufreader, bufwriter}, cursor, util}, net::{self, addr}} ---------- Fix typo in link to `into` for `OsString` docs ---------- Remove tooltips that will probably become redundant in the future ---------- Apply suggestions from code review Replacing `…std/primitive.reference.html` paths with just `reference` Co-authored-by: Joshua Nelson <github@jyn.dev> ---------- Also replace `…std/primitive.reference.html` paths with just `reference` in `core::pin`
2021-09-21Fix link in Ipv6Addr::to_ipv4 docsArtyom Pavlov-1/+1
2021-09-17Rollup merge of #88339 - piegamesde:master, r=joshtriplettYuki Okushi-0/+51
Add TcpListener::into_incoming and IntoIncoming The `incoming` method is really useful, however for some use cases the borrow this introduces is needlessly restricting. Thus, an owned variant is added. r? ``@joshtriplett``
2021-09-09Run fmtRyan Hancock-1/+1
2021-09-09Clarification of default socket flags used by RustRyan Hancock-0/+4
2021-09-08Bump stage0 compiler to 1.56Mark Rousskov-2/+0
2021-08-31Rollup merge of #88524 - soenkehahn:master, r=jyn514Mara Bos-1/+1
Remove unnecessary `mut` from udp doctests I don't think this `mut` is necessary, since both `recv_from` and `send_to` take `&self`.