Commit graph

186 commits

Author SHA1 Message Date
bors
7a4fb355c6 Auto merge of #75567 - poliorcetics:intra-links-std-net, r=jyn514
Move to intra doc links in std::net

Helps with #75080.

@rustbot modify labels: T-doc, A-intra-doc-links, T-rustdoc

The links for `true` and `false` had to stay else `rustdoc` complained, it is intended ?
2020-08-16 13:15:52 +00:00
Alexis Bourget
5fc187cd97 Fix a link, improve method resolution 2020-08-16 14:41:12 +02:00
bors
de32266a17 Auto merge of #75565 - nixphix:docs/vxworks-ext, r=jyn514
Switch to intra-doc links in std/src/sys/vxworks/ext/{fs,process}.rs

Partial fix for #75080

@rustbot modify labels: T-doc, A-intra-doc-links, T-rustdoc

r? @jyn514
2020-08-16 08:45:52 +00:00
bors
3f3250500f Auto merge of #75246 - pickfire:patch-5, r=Amanieu
Add more examples to Path ends_with

We faced a footgun when using ends_with to check extension,
showing an example could prevent that.

2c155e50b2
2020-08-15 19:51:44 +00:00
Alexis Bourget
15cad1c465 Move to intra doc links in std::net 2020-08-15 19:17:19 +02:00
Prabakaran Kumaresshan
c5849ae3e0 inline linking 2020-08-15 22:11:09 +05:30
Prabakaran Kumaresshan
f615b6d338 remove empty lines 2020-08-15 21:53:02 +05:30
Prabakaran Kumaresshan
b54341a9d7 resolve comments 2020-08-15 20:53:41 +05:30
Prabakaran Kumaresshan
9463380b0c Switch to intra-doc links in std/src/sys/vxworks/ext/{fs,process}.rs 2020-08-15 19:39:17 +05:30
bors
80fb3f3139 Auto merge of #74576 - myfreeweb:freebsd-sanitizers, r=oli-obk
Add sanitizer support on FreeBSD

Restarting #47337. Everything is better now, no more weird llvm problems, well not everything:

Unfortunately, the sanitizers don't have proper support for versioned symbols (https://github.com/google/sanitizers/issues/628), so `libc`'s usage of `stat@FBSD_1.0` and so on explodes, e.g. in calling `std::fs::metadata`.

Building std (now easy thanks to cargo `-Zbuild-std`) and libc with `freebsd12/13` config via the `LIBC_CI=1` env variable is a good workaround…

```
LIBC_CI=1 RUSTFLAGS="-Z sanitizer=address" cargo +san-test -Zbuild-std run --target x86_64-unknown-freebsd --verbose
```

…*except* std won't build because there's no `st_lspare` in the ino64 version of the struct, so an std patch is required:

```diff
--- i/src/libstd/os/freebsd/fs.rs
+++ w/src/libstd/os/freebsd/fs.rs
@@ -66,8 +66,6 @@ pub trait MetadataExt {
     fn st_flags(&self) -> u32;
     #[stable(feature = "metadata_ext2", since = "1.8.0")]
     fn st_gen(&self) -> u32;
-    #[stable(feature = "metadata_ext2", since = "1.8.0")]
-    fn st_lspare(&self) -> u32;
 }

 #[stable(feature = "metadata_ext", since = "1.1.0")]
@@ -136,7 +134,4 @@ impl MetadataExt for Metadata {
     fn st_flags(&self) -> u32 {
         self.as_inner().as_inner().st_flags as u32
     }
-    fn st_lspare(&self) -> u32 {
-        self.as_inner().as_inner().st_lspare as u32
-    }
 }
```

I guess std could like.. detect that `libc` isn't built for the old ABI, and replace the implementation of `st_lspare` with a panic?
2020-08-15 11:38:24 +00:00
Ivan Tham
446fccf1b8
Use resolve.conf as example for Path ends_with 2020-08-15 17:25:07 +08:00
Tyler Mandry
29a946203a
Rollup merge of #75545 - eddyb:instant-sub-branchless, r=sfackler
std/sys/unix/time: make it easier for LLVM to optimize `Instant` subtraction.

This PR is the minimal change necessary to get LLVM to optimize `if self.t.tv_nsec >= other.t.tv_nsec` to branchless instructions (at least on x86_64), inspired by @m-ou-se's own attempts at optimizing `Instant` subtraction.

I stumbled over this by looking at the total number of instructions executed by `rustc -Z self-profile`, and found that after disabling ASLR, the largest source of non-determinism remaining was from this `if` taking one branch or the other, depending on the values involved.

The reason this code is even called so many times to make a difference, is that `measureme` (the `-Z self-profile` implementation) currently uses `Instant::elapsed` for its event timestamps (of which there can be millions).

I doubt it's critical to land this, although perhaps it could slightly improve some forms of benchmarking.
2020-08-14 20:07:16 -07:00
Eduard-Mihai Burtescu
a7ad899f9d std/sys/unix/time: make it easier for LLVM to optimize Instant subtraction. 2020-08-15 04:13:25 +03:00
Tyler Mandry
6d09e29f5e
Rollup merge of #75530 - nixphix:docs/os-raw, r=jyn514
Switch to intra-doc links in os/raw/*.md

Partial fix for #75080

@rustbot modify labels: T-doc, A-intra-doc-links, T-rustdoc

r? @jyn514
2020-08-14 14:47:03 -07:00
Tyler Mandry
83c04392c8
Rollup merge of #75515 - workingjubilee:patch-4, r=Mark-Simulacrum
Bump std's libc version to 0.2.74

It's been a while and this should really be using a recent version, that's all. 💖
2020-08-14 14:46:57 -07:00
Tyler Mandry
ad1bfd2f3e
Rollup merge of #75501 - poliorcetics:intra-links-std-ffi, r=jyn514
Move to intra doc links in std::ffi

Helps with #75080.

@rustbot modify labels: T-doc, A-intra-doc-links, T-rustdoc
2020-08-14 14:46:52 -07:00
Tyler Mandry
b0261814f1
Rollup merge of #75432 - camelid:intra-doc-links-for-std-process, r=jyn514
Switch to intra-doc links in `std::process`

Part of #75080.
2020-08-14 14:46:49 -07:00
Tyler Mandry
5b61230303
Rollup merge of #74409 - LukasKalbertodt:improve-debug-impl-of-socketaddr-ipaddr, r=Amanieu
Change Debug impl of SocketAddr and IpAddr to match their Display output

This has already been done for `SocketAddrV4`, `SocketAddrV6`, `IpAddrV4` and `IpAddrV6`. I don't see a point to keep the rather bad to read derived impl, especially so when pretty printing:

    V4(
        127.0.0.1
    )

From the `Display`, one can easily and unambiguously see if it's V4 or V6. Two examples:

```
127.0.0.1:443
[2001:db8:85a3::8a2e:370:7334]:443
```

Luckily the docs explicitly state that `Debug` output is not stable and that it may be changed at any time.

Using `Display` as `Debug` is very convenient for configuration structs (e.g. for webservers) that often just have a `derive(Debug)` and are printed that way to the one starting the server.
2020-08-14 14:46:44 -07:00
Tyler Mandry
dae020d491
Rollup merge of #74192 - xkr47:patch-1, r=Mark-Simulacrum
Improve documentation on process::Child.std* fields

As a relative beginner, it took a while for me to figure out I could just steal the references to avoid partially moving the child and thus retain ability to call functions on it (and store it in structs etc).
2020-08-14 14:46:41 -07:00
Tyler Mandry
fba3989052
Rollup merge of #74062 - poliorcetics:unsafe-in-unsafe-c_str, r=Mark-Simulacrum
deny(unsafe_op_in_unsafe_fn) in libstd/ffi/c_str.rs

Partial fix of #73904.

This encloses `unsafe` operations in `unsafe fn` in `libstd/ffi/c_str.rs`.
2020-08-14 14:46:33 -07:00
Alexis Bourget
0e610bb31e Document the unsafe keyword 2020-08-14 22:52:23 +02:00
Alexis Bourget
e97fa1e3da libstd/ffi/c_str.rs: #![deny(unsafe_op_in_unsafe_fn)], enclose unsafe operations in unsafe blocks 2020-08-14 19:33:04 +02:00
Poliorcetics
ee4f893e27
Apply suggestions from code review
Co-authored-by: Joshua Nelson <joshua@yottadb.com>
2020-08-14 19:08:09 +02:00
Prabakaran Kumaresshan
84539eb7b5 remove primitive type links 2020-08-14 21:57:42 +05:30
Prabakaran Kumaresshan
232e3d04b3 Switch to intra-doc links in os/raw/*.md 2020-08-14 21:09:35 +05:30
Jonas Berlin
90e4c905d3 Improve documentation on process::Child.std* fields
As a relative beginner, it took a while for me to figure out I could just steal the references to avoid partially moving the child and thus retain ability to call functions on it (and store it in structs etc).
2020-08-14 08:25:45 -04:00
Jubilee
28bca67708
Bump std's libc version to 0.2.74 2020-08-14 00:37:19 -07:00
Tyler Mandry
33fca5ab8a
Rollup merge of #75477 - RalfJung:fn-ptrs, r=Mark-Simulacrum
Expand function pointer docs

Be more explicit in the ABI section, and add a section on how to obtain a function pointer, which can be somewhat confusing.

Cc https://github.com/rust-lang/rust/issues/75239
2020-08-13 18:00:21 -07:00
Alexis Bourget
2adc8c0e5f Move to intra doc links in std::ffi 2020-08-13 23:19:45 +02:00
Ralf Jung
2338903260 fn type: structure, and talk a bit more about ABIs and how to create them 2020-08-13 20:18:00 +02:00
Yuki Okushi
5526c1a8cd
Rollup merge of #75469 - camelid:intra-doc-links-std-io-mod, r=KodrAus
Switch to intra-doc links in `std/io/mod.rs`

Part of #75080.
2020-08-13 11:05:47 +09:00
Yuki Okushi
e94f7437bd
Rollup merge of #75466 - poliorcetics:intra-links-std-lib, r=KodrAus
Move to intra doc links whenever possible within std/src/lib.rs

Helps with #75080.

@rustbot modify labels: T-doc, A-intra-doc-links, T-rustdoc

There are some things like

```rust
`//! [`Option<T>`]: option::Option`
```

that will either be fixed in the future or have open issues about them.
2020-08-13 11:05:45 +09:00
Yuki Okushi
9ea03ddd0b
Rollup merge of #75455 - pickfire:patch-3, r=jyn514
Use explicit path link in place for doc in time

r? @jyn514

More worth for your time. :P
2020-08-13 11:05:42 +09:00
Yuki Okushi
66157e27e2
Rollup merge of #75400 - LukasKalbertodt:fix-f32-docs, r=KodrAus
Fix minor things in the `f32` primitive docs

All of these were review comments in #74621 that I first fixed in that PR, but later accidentally overwrote by a force push.

Thanks @the8472 for noticing.

r? @KodrAus
2020-08-13 11:05:37 +09:00
Yuki Okushi
ed543ae2f6
Rollup merge of #75189 - kawamuray:bugfix-wasi-append, r=KodrAus
Fix wasi::fs::OpenOptions to imply write when append is on

This PR fixes a bug in `OpenOptions` of `wasi` platform that it currently doesn't imply write mode when only `append` is enabled.
As explained in the [doc of OpenOptions#append](https://doc.rust-lang.org/std/fs/struct.OpenOptions.html#method.append), calling `.append(true)` should imply `.write(true)` as well.

## Reproduce

Given below simple Rust program:

```rust
use std::fs::OpenOptions;
use std::io::Write;

fn main() {
    let mut file = OpenOptions::new()
        .write(true)
        .create(true)
        .open("foo.txt")
        .unwrap();
    writeln!(file, "abc").unwrap();
}
```

it can successfully compiled into wasm and execute by `wasmtime` runtime:

```sh
$ rustc --target wasm32-wasi write.rs
$ ~/wasmtime/target/debug/wasmtime run --dir=. write.wasm
$ cat foo.txt
abc
```

However when I change `.write(true)` to `.append(true)`, it fails to execute by the error "Capabilities insufficient":

```sh
$ ~/wasmtime/target/debug/wasmtime run --dir=. append.wasm
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 76, kind: Other, message: "Capabilities insufficient" }', append.rs:10:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Error: failed to run main module `append.wasm`
...
```

This is because of lacking "rights" on the opened file:

```sh
$ RUST_LOG=trace ~/wasmtime/target/debug/wasmtime run --dir=. append.wasm 2>&1 | grep validate_rights
 TRACE wasi_common::entry                                  >      | validate_rights failed: required rights = HandleRights { base: fd_write (0x40), inheriting: empty (0x0) }; actual rights = HandleRights { base: fd_seek|fd_fdstat_set_flags|fd_sync|fd_tell|fd_advise|fd_filestat_set_times|poll_fd_readwrite (0x88000bc), inheriting: empty (0x0) }
```
2020-08-13 11:05:31 +09:00
Camelid
a7749fe451 Fix intra-doc link 2020-08-12 15:30:15 -07:00
Camelid
bc8367617e Switch to intra-doc links in std/io/mod.rs 2020-08-12 15:11:17 -07:00
Alexis Bourget
aa1fb31bf1 Move to intra doc links in std/src/fs.rs 2020-08-12 23:59:10 +02:00
Alexis Bourget
3f16597a6a Move to intra doc links whenever possible within std/src/lib.rs 2020-08-12 23:23:07 +02:00
Alexis Bourget
0e010a6992 Move to intra doc links for ascii.rs and panic.rs, updating the docs a little 2020-08-12 22:58:18 +02:00
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
Ivan Tham
cda660b5fc
Use explicit path link in place for doc in time 2020-08-12 22:17:12 +08:00
Camelid
d8f96146e8 Use Child::std{in,out,err} instead of Child.
These links were broken before.
2020-08-11 20:10:41 -07: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
Camelid
e005b71125 Switch to intra-doc links in std::process 2020-08-11 18:02:24 -07: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
Lukas Kalbertodt
709d1056b8
Fix minor things in the f32 primitive docs
All of these were review comments in #74621 that I first fixed
in that PR, but later accidentally overwrote by a force push.
2020-08-11 13:50:54 +02:00
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
Greg V
ddbc45673b Add RUST_STD_FREEBSD_12_ABI env variable
Unfortunately, sanitizers do not support versioned symbols[1],
so they break filesystem access via the legacy, pre-ino64 ABI.

To use sanitizers on FreeBSD >= 12, we need to build the libc
crate with LIBC_CI=1 to use the new ABI -- including the libc
used for std. But that removes the st_lspare field std was
expecting for the deprecated metadata extension.

Add a way to skip that field to allow the build to work.

[1]: https://github.com/google/sanitizers/issues/628
2020-08-09 17:52:00 +03: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
Eric Seppanen
f85d231301 clarify documentation of remove_dir errors
remove_dir will error if the path doesn't exist or isn't a directory.

It's useful to clarify that this is "remove dir or fail" not "remove dir
if it exists".

I don't think this belongs in the title. "Removes an existing, empty
directory" is strangely worded-- there's no such thing as a non-existing
directory.  Better to just say explicitly it will return an error.
2020-08-08 22:50:56 -07: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
Ivan Tham
3d1388f514
Add more examples to Path ends_with
We faced a footgun when using ends_with to check extension,
showing an example could prevent that.
2020-08-07 14:16:52 +08: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
Adam Reichold
04a0114e7e Rely only on POSIX semantics for I/O vector count
All #[cfg(unix)] platforms follow the POSIX standard and define _SC_IOV_MAX so
that we rely purely on POSIX semantics to determine the limits on I/O vector
count.
2020-08-05 16:57:02 +02:00
Adam Reichold
87edccf0f0 Reduce synchronization overhead of I/O vector count memoization 2020-08-05 16:57:02 +02:00
Adam Reichold
6672f7be03 Memoize the I/O vector count limit
Keep the I/O vector count limit in a `SyncOnceCell` to avoid the overhead of
repeatedly calling `sysconf` as these limits are guaranteed to not change during
the lifetime of a process by POSIX.
2020-08-05 16:57:02 +02:00