Denis Vasilik
3c2eb18b9b
Use intra-doc links
2020-08-11 22:16:31 +02:00
Alexis Bourget
bd01bf9274
Remove two links by changing the doc for SystemTimeError::duration
2020-08-11 21:53:02 +02:00
Poliorcetics
a308e74e13
Add some texts to make the tidy check for unsafe documentation pass
2020-08-11 21:37:22 +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
Tyler Mandry
5d9a0b020c
Rollup merge of #75409 - pickfire:patch-4, r=GuillaumeGomez
...
Fix range term in alloc vec doc
`range` is not an element, it is a variable.
r? @GuillaumeGomez
2020-08-11 12:28:40 -07:00
Tyler Mandry
06eb274bfc
Rollup merge of #75407 - oliver-giersch:set_ptr_value, r=RalfJung
...
Requested changes to [*mut T|*const T]::set_ptr_value
This is a follow-up to PR #74774 (tracking issue #75091 ), acting on some change requests made after approval:
- adds `#[must_use]` attribute
- changes type of `val` pointer argument from `()` to `u8`
- adjusts documentation mentioning pointer provenance
2020-08-11 12:28:37 -07:00
Alexis Bourget
91ba92b6df
Change safety comment for usize with the one from LukasKalbertodt review
2020-08-11 21:23:00 +02:00
Lzu Tao
e8ea6e59f0
prefer pattern matching over indexing
2020-08-11 16:07:39 +00:00
Ivan Tham
e4f2de2e9a
Fix range term in alloc vec doc
...
`range` is not an element, it is a variable.
2020-08-11 23:57:13 +08:00
Prabakaran Kumaresshan
32fccc445a
Revert #tymethods
2020-08-11 19:50:17 +05:30
oliver-giersch
19c9674966
mentions provenance, changes argument type, adds must_use attr
2020-08-11 16:14:34 +02:00
bors
4b9ac51617
Auto merge of #75388 - JohnTitor:rollup-9tgkxnl, r=JohnTitor
...
Rollup of 10 pull requests
Successful merges:
- #74744 (Update RELEASES.md for 1.46.0)
- #75085 (Transmute big endian `s6_addr` and `[u16; 8]`)
- #75226 (Miri: Renamed "undef" to "uninit")
- #75333 (polymorphize: constrain unevaluated const handling)
- #75338 (move stack size check to const_eval machine)
- #75347 (Rustdoc: Fix natural ordering to look at all numbers.)
- #75352 (Tweak conditions for E0026 and E0769)
- #75353 (Tiny cleanup, remove unnecessary `unwrap`)
- #75359 (unused_delims: trim expr)
- #75360 (Add sample fix for E0749)
Failed merges:
r? @ghost
2020-08-11 12:31:56 +00:00
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
Stein Somers
3a02e06002
BTreeMap: purge innocent use of into_kv_mut
2020-08-11 12:20:18 +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
Oliver Scherer
34c3c0dae5
Make <*const T>::is_null
const fn
2020-08-11 11:45:47 +02:00
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
Ivan Tham
8ec348afdd
Remove branch in optimized is_ascii
...
Performs slightly better in short or medium bytes by eliminating
the last branch check on `byte_pos == len` and always check the
last byte as it is always at most one `usize`.
Benchmark, before `libcore`, after `libcore_new`. It improves
medium and short by 1ns but regresses unaligned_tail by 2ns,
either way we can get unaligned_tail have a tiny chance of 1/8
on a 64 bit machine. I don't think we should bet on that, the
probability is worse than dice.
test long::case00_libcore ... bench: 38 ns/iter (+/- 1) = 183947 MB/s
test long::case00_libcore_new ... bench: 38 ns/iter (+/- 1) = 183947 MB/s
test long::case01_iter_all ... bench: 227 ns/iter (+/- 6) = 30792 MB/s
test long::case02_align_to ... bench: 40 ns/iter (+/- 1) = 174750 MB/s
test long::case03_align_to_unrolled ... bench: 19 ns/iter (+/- 1) = 367894 MB/s
test medium::case00_libcore ... bench: 5 ns/iter (+/- 0) = 6400 MB/s
test medium::case00_libcore_new ... bench: 4 ns/iter (+/- 0) = 8000 MB/s
test medium::case01_iter_all ... bench: 20 ns/iter (+/- 1) = 1600 MB/s
test medium::case02_align_to ... bench: 6 ns/iter (+/- 0) = 5333 MB/s
test medium::case03_align_to_unrolled ... bench: 5 ns/iter (+/- 0) = 6400 MB/s
test short::case00_libcore ... bench: 7 ns/iter (+/- 0) = 1000 MB/s
test short::case00_libcore_new ... bench: 6 ns/iter (+/- 0) = 1166 MB/s
test short::case01_iter_all ... bench: 5 ns/iter (+/- 0) = 1400 MB/s
test short::case02_align_to ... bench: 5 ns/iter (+/- 0) = 1400 MB/s
test short::case03_align_to_unrolled ... bench: 5 ns/iter (+/- 1) = 1400 MB/s
test unaligned_both::case00_libcore ... bench: 4 ns/iter (+/- 0) = 7500 MB/s
test unaligned_both::case00_libcore_new ... bench: 4 ns/iter (+/- 0) = 7500 MB/s
test unaligned_both::case01_iter_all ... bench: 26 ns/iter (+/- 0) = 1153 MB/s
test unaligned_both::case02_align_to ... bench: 13 ns/iter (+/- 2) = 2307 MB/s
test unaligned_both::case03_align_to_unrolled ... bench: 11 ns/iter (+/- 0) = 2727 MB/s
test unaligned_head::case00_libcore ... bench: 5 ns/iter (+/- 0) = 6200 MB/s
test unaligned_head::case00_libcore_new ... bench: 5 ns/iter (+/- 0) = 6200 MB/s
test unaligned_head::case01_iter_all ... bench: 19 ns/iter (+/- 1) = 1631 MB/s
test unaligned_head::case02_align_to ... bench: 10 ns/iter (+/- 0) = 3100 MB/s
test unaligned_head::case03_align_to_unrolled ... bench: 14 ns/iter (+/- 0) = 2214 MB/s
test unaligned_tail::case00_libcore ... bench: 3 ns/iter (+/- 0) = 10333 MB/s
test unaligned_tail::case00_libcore_new ... bench: 5 ns/iter (+/- 0) = 6200 MB/s
test unaligned_tail::case01_iter_all ... bench: 19 ns/iter (+/- 0) = 1631 MB/s
test unaligned_tail::case02_align_to ... bench: 10 ns/iter (+/- 0) = 3100 MB/s
test unaligned_tail::case03_align_to_unrolled ... bench: 13 ns/iter (+/- 0) = 2384 MB/s
Rough (unfair) maths on improvements for fun: 1ns * 7/8 - 2ns * 1/8 = 0.625ns
Inspired by fish and zsh clever trick to highlight missing linefeeds (⏎)
and branchless implementation of binary_search in rust.
2020-08-11 14:40:39 +08:00
bors
441fd22557
Auto merge of #75329 - ssomers:btree_cleanup_8, r=Mark-Simulacrum
...
BTreeMap: better distinguish the root holder from the root node
Renames and intermediate variables
2020-08-11 06:17:02 +00: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
Dylan DPC
0a738d41b1
Rollup merge of #75379 - denisvasilik:intra-docs-links-core-cmp, r=Dylan-DPC
...
Use intra-doc links in /library/core/src/cmp.rs
Helps with #75080 .
@rustbot modify labels: T-doc, A-intra-doc-links, T-rustdoc
Known issues:
* Links from `core` to `std` (#74481 ):
* [`Vec::sort_by_key`]
2020-08-11 01:56:47 +02:00
Dylan DPC
d00c70363f
Rollup merge of #75369 - denisvasilik:intra-doc-links-core-borrow, r=Manishearth
...
Move to intra-doc links in /library/core/src/borrow.rs
Helps with #75080 .
@rustbot modify labels: T-doc, A-intra-doc-links, T-rustdoc
Known issues:
* Links from `core` to `std` (#74481 ):
* [`Box<T>`]
* [`Mutex<T>`]
* [`Rc<T>`]
* [`String`]
* [`HashMap<K, V>`]
2020-08-11 01:56:45 +02:00
Denis Vasilik
eea85814e1
Use intra-doc links
2020-08-10 23:16:01 +02:00
Denis Vasilik
f260462c32
Remove links that are in scope
2020-08-10 23:14:43 +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
Denis Vasilik
d7e7271085
Remove AsRef link as it is in the prelude
2020-08-10 20:29:20 +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
64d71095c3
Rollup merge of #75348 - denisvasilik:intra-doc-links-core-time, r=jyn514
...
Move to intra-doc links in library/core/src/time.rs
Helps with #75080 .
2020-08-10 09:08:01 +09: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
Denis Vasilik
9e71c13f28
Add link for Duration
...
Co-authored-by: Joshua Nelson <joshua@yottadb.com>
2020-08-09 23:26:42 +02:00
Denis Vasilik
ce244210b1
Remove liNone as it is in the prelude
2020-08-09 23:12:30 +02:00
Denis Vasilik
7dba693f0e
Use intra-doc links
2020-08-09 23:06:44 +02:00
Denis Vasilik
e9e319c460
Use intra-doc links
2020-08-09 21:20:57 +02: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
Alexis Bourget
5a0de2f828
Improve safety comments for usize, fix some other unclear parts
2020-08-09 16:43:24 +02: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
Stein Somers
ef753fc6ed
BTreeMap: better distinguish the root holder from the root node
2020-08-09 13:43:13 +02:00
bors
f50f1c8e17
Auto merge of #75280 - overdrivenpotato:psp-unwind, r=dtolnay
...
Add back unwinding support for Sony PSP
This PR adds back unwinding support for the Sony PSP. The `mipsel-sony-psp` target works well with unwinding. In [rust-psp], we use the `panic_unwind` crate along with LLVM's libunwind to catch panics, run destructors, and print them to the debug screen without aborting all threads.
[rust-psp]: https://github.com/overdrivenpotato/rust-psp
2020-08-09 03:07:00 +00:00
bors
dcf107728c
Auto merge of #75308 - JohnTitor:rollup-vnnny43, r=JohnTitor
...
Rollup of 15 pull requests
Successful merges:
- #74712 (Update E0271 explanation)
- #74842 (adjust remaining targets)
- #75151 (Consistent variable name alloc for raw_vec)
- #75162 (Fix the documentation for move about Fn traits implementations)
- #75248 (Add `as_mut_ptr` to `NonNull<[T]>`)
- #75262 (Show multi extension example for Path in doctests)
- #75266 (Add safety section to `NonNull::as_*` method docs)
- #75284 (Show relative example for Path ancestors)
- #75285 (Separate example for Path strip_prefix)
- #75287 (Show Path extension example change multi extension)
- #75288 (Use assert! for Path exists example to check bool)
- #75289 (Remove ambiguity from PathBuf pop example)
- #75290 (fix `min_const_generics` version)
- #75291 (Clean up E0750)
- #75292 (Clean up E0502)
Failed merges:
r? @ghost
2020-08-08 23:05:49 +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
cb75fea1cc
Rollup merge of #75266 - aticu:master, r=RalfJung
...
Add safety section to `NonNull::as_*` method docs
This basically adds the safety section of `*mut T::as_{ref,mut}` to the
same methods on `NonNull` with minor modifications to fit the
differences.
Part of #48929 .
2020-08-09 06:41:25 +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