bors
3df25ae186
Auto merge of #75019 - nanpuyue:to_ipv4_mapped, r=LukasKalbertodt
...
Add Ipv6Addr::to_ipv4_mapped
* add Ipv6Addr::to_ipv4_mapped
* ~~deprecate Ipv4Addr::to_ipv6_compatible & Ipv6Addr::to_ipv4~~ reference: #75150
According to [IETF RFC 4291](https://tools.ietf.org/html/rfc4291#page-10 ), the "IPv4-Compatible IPv6 address" is deprecated.
> 2.5.5.1. IPv4-Compatible IPv6 Address
>
> The "IPv4-Compatible IPv6 address" was defined to assist in the IPv6
> transition. The format of the "IPv4-Compatible IPv6 address" is as
> follows:
>
> | 80 bits | 16 | 32 bits |
> +--------------------------------------+--------------------------+
> |0000..............................0000|0000| IPv4 address |
> +--------------------------------------+----+---------------------+
>
> Note: The IPv4 address used in the "IPv4-Compatible IPv6 address"
> must be a globally-unique IPv4 unicast address.
>
> The "IPv4-Compatible IPv6 address" is now deprecated because the
> current IPv6 transition mechanisms no longer use these addresses.
> New or updated implementations are not required to support this
> address type.
And the current implementation of `Ipv4Addr::to_ipv6_compatible`is incorrect: it does not check whether the IPv4 address is a globally-unique IPv4 unicast address.
Please let me know if there are any issues with this pull request.
2020-08-12 16:30:46 +00:00
Yuki Okushi
7a900835c1
Rollup merge of #75395 - nixphix:docs/os-fs, r=jyn514
...
Switch to intra-doc links in library/std/src/os/*/fs.rs
Partial fix for #75080
@rustbot modify labels: T-doc, T-rustdoc, A-intra-doc-links
2020-08-12 12:07:17 +09:00
Yuki Okushi
261773e185
Rollup merge of #75371 - poliorcetics:intra-doc-links-std-time, r=jyn514
...
Move to doc links inside std/time.rs
Helps with #75080 .
@rustbot modify labels: T-doc, A-intra-doc-links, T-rustdoc
2020-08-12 12:07:14 +09:00
Yuki Okushi
c423fdeb74
Rollup merge of #75368 - poliorcetics:intra-doc-links-std-prelude, r=jyn514
...
Move to doc links inside the prelude
Helps with #75080 .
@rustbot modify labels: T-doc, A-intra-doc-links, T-rustdoc
2020-08-12 12:07:12 +09:00
Alexis Bourget
bd01bf9274
Remove two links by changing the doc for SystemTimeError::duration
2020-08-11 21:53:02 +02:00
Alexis Bourget
3ff06a9f2c
Move the std::vec link back to a path-based link to make it compile with --stage 0
2020-08-11 21:30:20 +02:00
Lzu Tao
e8ea6e59f0
prefer pattern matching over indexing
2020-08-11 16:07:39 +00:00
Prabakaran Kumaresshan
32fccc445a
Revert #tymethods
2020-08-11 19:50:17 +05:30
Prabakaran Kumaresshan
29045b699e
Switch to intra-doc links in library/std/src/os/*/fs.rs
2020-08-11 15:20:01 +05:30
Yuki Okushi
f26f201d42
Rollup merge of #75085 - lzutao:ip_union, r=cuviper
...
Transmute big endian `s6_addr` and `[u16; 8]`
The old code already made the assumption to reinterpret
`Ipv6Addr` as `[u16; 8]`.
Glibc, Linux, FreeBSD, Win32 all makes this assumption.
The main motivation of using union it to better optimize code.
Godbolt: https://rust.godbolt.org/z/b4bGvo
Const is introducing unsafe when transmuting.
ref:
* https://docs.microsoft.com/en-us/windows/win32/api/in6addr/ns-in6addr-in6_addr
* 1d6e424741/contrib/ntp/lib/isc/include/isc/ipv6.h (L63)
* 8b531aa996/include/net/net_ip.h (L137)
* https://sourceware.org/git/?p=glibc.git;a=blob;f=inet/netinet/in.h;h=f6355c7efe5192b88337b136ef687fe9a5ed648c;hb=HEAD#l216
2020-08-11 16:23:45 +09:00
bors
a9025c571e
Auto merge of #74621 - LukasKalbertodt:float-docs, r=GuillaumeGomez
...
Improve `f32` and `f64` primitive documentation
I noticed that the docs for the primitive floats were fairly short. I first only wanted to add the IEEE specification information (compare [the reference](https://doc.rust-lang.org/reference/types/numeric.html )), but then also added some more beginner-friendly docs. Let me know what you think!
Random doc team assign:
r? @rylev
2020-08-11 04:10:39 +00:00
南浦月
d892a07c67
add Ipv6Addr::to_ipv4_mapped
2020-08-11 09:15:08 +08:00
Alexis Bourget
a6e492b5db
Move to doc links inside the prelude
2020-08-10 21:09:37 +02:00
Alexis Bourget
26792a65cd
Move to doc links inside std/time.rs
2020-08-10 21:01:58 +02:00
Lzu Tao
0210fd3d73
Transmute between big endian s6_addr
and [u16; 8]
.
...
The old code already made the assumption to reinterpret
`Ipv6Addr` as `[u16; 8]`.
Glibc, Linux, FreeBSD, Win32 all makes this assumption.
The main motivation of using union it to better optimize code.
ref:
* https://docs.microsoft.com/en-us/windows/win32/api/in6addr/ns-in6addr-in6_addr
* 1d6e424741/contrib/ntp/lib/isc/include/isc/ipv6.h (L63)
* 8b531aa996/include/net/net_ip.h (L137)
* https://sourceware.org/git/?p=glibc.git;a=blob;f=inet/netinet/in.h;h=f6355c7efe5192b88337b136ef687fe9a5ed648c;hb=HEAD#l216
Co-authored-by: Josh Stone <cuviper@gmail.com>
Co-authored-by: Peter Atashian <retep998@gmail.com>
2020-08-10 00:50:26 +00:00
Yuki Okushi
df2da4637f
Rollup merge of #75286 - pickfire:patch-9, r=jyn514
...
Add additional case for Path starts with
Show what happens if there is an extra extension
2020-08-10 09:07:52 +09:00
Yuki Okushi
62e5488198
Rollup merge of #74200 - poliorcetics:std-panicking-unsafe-block-in-unsafe-fn, r=Mark-Simulacrum
...
Std panicking unsafe block in unsafe fn
Partial fix of #73904 .
This encloses `unsafe` operations in `unsafe fn` in `libstd/ffi/panicking.rs`.
I also made a two lines change to `libstd/thread/local.rs` to add the necessary `unsafe` block without breaking everything else.
@rustbot modify labels: F-unsafe-block-in-unsafe-fn
2020-08-10 09:07:46 +09:00
Ivan Tham
4b549fa043
show multiple slashes starts_with Path example
...
Co-authored-by: Joshua Nelson <joshua@yottadb.com>
2020-08-10 00:43:45 +08:00
bors
8bc801b050
Auto merge of #75293 - poliorcetics:intra-doc-links-std-path, r=jyn514
...
Move to intra-doc links in library/std/src/path.rs
Helps with #75080 .
@rustbot modify labels: T-doc, A-intra-doc-links, T-rustdoc
Known issue: The following links are broken (they are inside trait impls, undocumented in this file, inheriting from the original doc):
- [`Hasher`]
- [`Self`] (referencing `../primitive.slice.html`)
- [`Ordering`]
2020-08-09 12:31:03 +00:00
Yuki Okushi
3038ecb07b
Rollup merge of #75289 - pickfire:patch-12, r=jonas-schievink
...
Remove ambiguity from PathBuf pop example
2020-08-09 06:41:33 +09:00
Yuki Okushi
6baee9557a
Rollup merge of #75288 - pickfire:patch-11, r=jonas-schievink
...
Use assert! for Path exists example to check bool
2020-08-09 06:41:32 +09:00
Yuki Okushi
42e163bf40
Rollup merge of #75287 - pickfire:patch-10, r=jonas-schievink
...
Show Path extension example change multi extension
2020-08-09 06:41:30 +09:00
Yuki Okushi
28ab318f57
Rollup merge of #75285 - pickfire:patch-8, r=jonas-schievink
...
Separate example for Path strip_prefix
2020-08-09 06:41:28 +09:00
Yuki Okushi
27b864b154
Rollup merge of #75284 - pickfire:patch-7, r=LukasKalbertodt
...
Show relative example for Path ancestors
2020-08-09 06:41:27 +09:00
Yuki Okushi
cbc6914baa
Rollup merge of #75262 - pickfire:patch-6, r=jyn514
...
Show multi extension example for Path in doctests
2020-08-09 06:41:23 +09:00
Yuki Okushi
ccffe18c3e
Rollup merge of #75162 - poliorcetics:move-documentation-fix, r=jyn514
...
Fix the documentation for move about Fn traits implementations
Fixes #74997 .
This uses the note from the [reference](https://doc.rust-lang.org/reference/types/closure.html#call-traits-and-coercions ) but I can also just put a link to it or do both.
@rusbot modify labels: C-bug T-doc T-libs
2020-08-09 06:41:20 +09:00
Yuki Okushi
dde4fb3fd2
Rollup merge of #74842 - hermitcore:thread_local, r=Mark-Simulacrum
...
adjust remaining targets
- fix commit 7dc3886
- previous commit doesn't adjust all targets
2020-08-09 06:41:16 +09:00
bors
1facd4a77b
Auto merge of #75163 - canova:map_into_keys_values, r=dtolnay
...
Implement `into_keys` and `into_values` for associative maps
This PR implements `into_keys` and `into_values` for HashMap and BTreeMap types. They are implemented as unstable, under `map_into_keys_values` feature.
Fixes #55214 .
r? @dtolnay
2020-08-08 18:15:50 +00:00
Nazım Can Altınova
4cd2637e2b
Update the tracking issue number of map_into_keys_values
2020-08-08 16:35:54 +02:00
Alexis Bourget
1cd8dffdae
Add an example about the behaviour of move and Fn* traits
2020-08-08 15:57:17 +02:00
Alexis Bourget
6d77e40afe
Move to intra-doc links in library/std/src/path.rs
2020-08-08 14:21:27 +02:00
bors
c989ac132a
Auto merge of #74289 - lzutao:unroll, r=LukasKalbertodt
...
Remove some redundant parts from `unrolled_find_u16s`
See each commit message for details.
r? @wesleywiser from old PR #67705 .
2020-08-08 11:34:18 +00:00
Ivan Tham
4b15b809eb
Remove abmiguity from PathBuf pop example
2020-08-08 18:28:55 +08:00
Ivan Tham
b3ae88f6bb
Use assert! for Path exists example to check bool
2020-08-08 18:23:18 +08:00
Ivan Tham
9532b83912
Show Path extension example change multi extension
2020-08-08 18:14:29 +08:00
Ivan Tham
e7e41a8465
Add additonal case for Path starts with
...
Show what happens if there is an extra extension
2020-08-08 18:06:04 +08:00
Ivan Tham
6dffd2d18e
Separate example for Path strip_prefix
2020-08-08 18:01:34 +08:00
Ivan Tham
a11c27925d
Show relative example for Path ancestors
2020-08-08 17:53:16 +08:00
Alan Egerton
5792840bf5
Prevent __rust_begin_short_backtrace
frames from being tail-call optimised away
2020-08-07 19:31:25 +01:00
Ivan Tham
06cf40f8a1
Show multi extension example for Path in doctests
2020-08-08 00:48:12 +08:00
Nazım Can Altınova
25545ed180
Only print the fields that are relevant to iterators for Debug of IntoKeys and IntoValues
2020-08-07 13:47:04 +02:00
Nazım Can Altınova
41dd4ee7ff
Add unit tests for new HashMap::into_{keys,values}
methods
2020-08-07 13:13:41 +02:00
Nazım Can Altınova
e31116af50
Add into_{keys,values}
methods for HashMap
2020-08-07 13:13:37 +02:00
bors
8b26609481
Auto merge of #70052 - Amanieu:hashbrown7, r=Mark-Simulacrum
...
Update hashbrown to 0.8.1
This update includes:
- https://github.com/rust-lang/hashbrown/pull/146 , which improves the performance of `Clone` and implements `clone_from`.
- https://github.com/rust-lang/hashbrown/pull/159 , which reduces the size of `HashMap` by 8 bytes.
- https://github.com/rust-lang/hashbrown/pull/162 , which avoids creating small 1-element tables.
Fixes #28481
2020-08-07 08:36:15 +00:00
Amanieu d'Antras
d51b7b229a
Update hashbrown to 0.8.1
2020-08-07 07:03:12 +01:00
Yuki Okushi
1b61fd3ccf
Rollup merge of #75179 - lzutao:unsed-ipv4-frominner, r=alexcrichton
...
Remove unused FromInner impl for Ipv4Addr
The removed is a unused unstable implementation.
2020-08-07 09:35:16 +09:00
Yuki Okushi
c9c7048038
Rollup merge of #75175 - lzutao:doctest-ipv4-fromu32, r=cuviper
...
Make doctests of Ipv4Addr::from(u32) easier to read
There are many zeroes in `0x0d0c0b0au32` which makes it hard to read.
2020-08-07 09:35:14 +09:00
Tomasz Miąsko
888bc07c6b
Keep stdout open in limit_vector_count test
2020-08-06 00:00:00 +00:00
bors
c15bae53b5
Auto merge of #75086 - lzutao:u32const, r=oli-obk
...
Use u32::from_ne_bytes to fix a FIXME and add comment about that
`u32::from_ne_bytes` has been const stable since 1.44.
2020-08-06 14:21:48 +00:00
Adam Reichold
9073acdc98
Add fallback for cfg(unix) targets that do not define libc::_SC_IOV_MAX.
2020-08-05 17:15:08 +02:00