Commit Graph

2198 Commits

Author SHA1 Message Date
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
Nazım Can Altınova 8faf550e5f Remove the unused bounds from Debug impl of HashMap::{IntoKeys,IntoValues} 2020-08-11 20:42:02 +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
* https://github.com/freebsd/freebsd/blob/1d6e4247415d264485ee94b59fdbc12e0c566fd0/contrib/ntp/lib/isc/include/isc/ipv6.h#L63
* https://github.com/zephyrproject-rtos/zephyr/blob/8b531aa996bba254c03129658490af59597acd78/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
Marcel Hellwig 00d537dcd0 deny(unsafe_op_in_unsafe_fn) in libstd/path.rs 2020-08-11 09:22:27 +02:00
Marcel Hellwig 73e27b3e18 deny(unsafe_op_in_unsafe_fn) in libstd/process.rs 2020-08-11 09:11:55 +02: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
Nazım Can Altınova 456738e3d1 Only print values in the Debug of HashMap::ValuesMut struct 2020-08-10 23:06:04 +02: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
Ryan Levick b9b8b5c96b Reverse formatting 2020-08-10 18:04:44 +02:00
Ryan Levick 6778baf516 Fix up docs 2020-08-10 17:39:06 +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
* https://github.com/freebsd/freebsd/blob/1d6e4247415d264485ee94b59fdbc12e0c566fd0/contrib/ntp/lib/isc/include/isc/ipv6.h#L63
* https://github.com/zephyrproject-rtos/zephyr/blob/8b531aa996bba254c03129658490af59597acd78/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