Commit Graph

5880 Commits

Author SHA1 Message Date
Nicholas Thompson
c65c35b3ef Reduced amount of int_pow benches
Also simplified the macros
2024-01-11 14:00:01 -05:00
Nicholas Thompson
7dcce97686 Edited int_pow micro-benchmarks 2024-01-11 11:30:12 -05:00
Nicholas Thompson
33a47df84a Added int_pow micro-benchmarks 2024-01-11 11:30:12 -05:00
Jakub Stasiak
4621357d14 Make is_global/is_unicast_global special address handling complete
IANA explicitly documents 192.0.0.9/32, 192.0.0.9/32 and 2001:30::/28 as
globally reachable[1][2] and the is_global implementations declare
following IANA so let's make this happen.

In case of 2002::/16 IANA says N/A so I think it's safe to say we
shouldn't return true there either.

[1] https://www.iana.org/assignments/iana-ipv4-special-registry/iana-ipv4-special-registry.xhtml
[2] https://www.iana.org/assignments/iana-ipv6-special-registry/iana-ipv6-special-registry.xhtml
2024-01-11 01:03:34 +01:00
Matthias Krüger
3fcddf19e7
Rollup merge of #119782 - RalfJung:rint, r=cuviper
rint intrinsics: caution against actually trying to check for floating-point exceptions
2024-01-10 06:28:45 +01:00
Ralf Jung
fa5bef849e rint intrinsics: caution against actually trying to check for floating-point exceptions 2024-01-09 22:19:25 +01:00
bors
190f4c9611 Auto merge of #116846 - krtab:slice_compare_no_memcmp_opt, r=the8472
A more efficient slice comparison implementation for T: !BytewiseEq

(This is a follow up PR on #113654)

This PR changes the implementation for `[T]` slice comparison when `T: !BytewiseEq`. The previous implementation using zip was not optimized properly by the compiler, which didn't leverage the fact that both length were equal. Performance improvements are for example 20% when testing that `[Some(0_u64); 4096].as_slice() == [Some(0_u64); 4096].as_slice()`.
2024-01-09 20:52:34 +00:00
Miguel Ojeda
18a1ca6a17 core: panic: fix broken link
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2024-01-09 14:15:45 +01:00
Matthias Krüger
b0c492cd6e
Rollup merge of #118979 - ChrisDenton:unwrap-const, r=Nilstrieb,dtolnay
Use `assert_unsafe_precondition` for `char::from_u32_unchecked`

Use `assert_unsafe_precondition` in `char::from_u32_unchecked` so that it can be stabilized as `const`.
2024-01-09 05:33:21 +01:00
Matthias Krüger
668e8b5541
Rollup merge of #119598 - Laura7089:fix/deref-typo, r=Nilstrieb
Fix a typo in core::ops::Deref's doc
2024-01-09 00:19:33 +01:00
Arthur Carcano
5b041abc8c A more efficient slice comparison implementation for T: !BytewiseEq
The previous implementation was not optimized properly by the compiler,
which didn't leverage the fact that both length were equal.
2024-01-08 16:36:48 +01:00
Matthias Krüger
a9b6908e7f
Rollup merge of #116129 - fu5ha:better-pin-docs-2, r=Amanieu
Rewrite `pin` module documentation to clarify usage and invariants

The documentation of `pin` today does not give a complete treatment of pinning from first principles, nor does it adequately help build intuition and understanding for how the different elements of the pinning story fit together.

This rewrite attempts to address these in a way that makes the concept more approachable while also making the documentation more normative.

This PR picks up where `@mcy` left off in #88500 (thanks to him for the original work and `@Manishearth` for mentioning it such that I originally found it). I've directly incorporated much of the feedback left on the original PR and have rewritten and changed some of the main conceits of the prose to better adhere to the feedback from the reviewers on that PR or just explain something in (hopefully) a better way.
2024-01-08 00:38:33 +01:00
Manish Goregaokar
7fd841c098 link 2024-01-07 08:57:23 -08:00
Manish Goregaokar
df6d44961d Update library/core/src/pin.rs
Co-authored-by: Ralf Jung <post@ralfj.de>
2024-01-07 08:56:25 -08:00
Manish Goregaokar
b1830f130a clean up structural pinning 2024-01-07 08:56:24 -08:00
Manish Goregaokar
a573c7c409 footnote on dropping futures 2024-01-07 08:56:24 -08:00
Manish Goregaokar
6a54ed71c0 valid 2024-01-07 08:56:24 -08:00
Manish Goregaokar
6553d0d551 punctuation in parens 2024-01-07 08:56:24 -08:00
Manish Goregaokar
68bdeddb5c Apply suggestions from code review
Co-authored-by: Ralf Jung <post@ralfj.de>
Co-authored-by: Daniel Henry-Mantilla <daniel.henry.mantilla@gmail.com>
2024-01-07 08:56:24 -08:00
Manish Goregaokar
4c25246f3e Clean up guarantees wording
We don't need to go into that much depth at this stage
2024-01-07 08:56:24 -08:00
Manish Goregaokar
936ceb20f5 lifetime -> lifespan where relevant. improve docs on as_ref() 2024-01-07 08:56:24 -08:00
Manish Goregaokar
0050676440 Rephrase unpin docs in terms of pinning-agnosticness 2024-01-07 08:56:24 -08:00
Gray Olson
058fb50ecd trim section on managed-box model 2024-01-07 08:56:23 -08:00
Gray Olson
9997114e14 improve Pin::new_unchecked docs 2024-01-07 08:56:23 -08:00
Gray Olson
f0827b3055 fix broken link 2024-01-07 08:56:10 -08:00
Gray Olson
e0210e6e1d justify motivation of Unpin better 2024-01-07 08:56:09 -08:00
Gray Olson
469c78bcfd improve Pin and Pin::new docs 2024-01-07 08:56:09 -08:00
Gray Olson
6e882790b8 Pin<P> -> Pin<Ptr> 2024-01-07 08:56:09 -08:00
Gray Olson
de2e748a40 fix typos and edit prose 2024-01-07 08:56:08 -08:00
Gray Olson
6d5f43d77d edit new section for typos and better wording 2024-01-07 08:56:08 -08:00
Gray Olson
921d37dbd5 fix imports 2024-01-07 08:56:07 -08:00
Gray Olson
f2447a6a70 fix typos 2024-01-07 08:56:07 -08:00
Gray Olson
252a83b63f add section on manual owning ptr managed solution via @kpreid 2024-01-07 08:56:07 -08:00
Gray Olson
7c9c71260e improve structural Unpin + formatting 2024-01-07 08:56:06 -08:00
Gray Olson
e2e8746bb6 reword unpin auto impl section 2024-01-07 08:56:06 -08:00
Gray Olson
82a68171d3 fix link in footnote 2024-01-07 08:56:06 -08:00
Gray Olson
bebbe24a63 improve Pin struct docs and add examples 2024-01-07 08:56:05 -08:00
Gray Olson
6818d9278b improve intro and discussion of pinning as library contract 2024-01-07 08:56:05 -08:00
Gray Olson
db5b19e472 improve intro and Unpin-related discussion 2024-01-07 08:56:05 -08:00
Gray Olson
46f9d77bd1 update doubly linked list commentary and fix links 2024-01-07 08:56:04 -08:00
Gray Olson
ec8a01a479 fix one more broken link 2024-01-07 08:56:04 -08:00
Gray Olson
584f0986fc fix broken links 2024-01-07 08:56:04 -08:00
Gray Olson
ba3b9342cc Fix examples, finish polishing 2024-01-07 08:56:04 -08:00
Gray Olson
8241ca6056 mostly done 2024-01-07 08:56:03 -08:00
Miguel Young de la Sota
bfd63b20c8 Rewrite Pin<P> docs to clarify guarantees and uses
The documentation today does not give a complete treatment of pinning
from first principles, which appropriately describes how to design types
that use it, nor does it provide formal statements of the guarantees
users need to be aware of.

This rewrite attempts to address these in a way that makes the concept
more approachable while also making the documentation more normative.
2024-01-07 08:56:03 -08:00
Michael Goulet
5117dc7a5b
Rollup merge of #119657 - cls:slice_split_once-typo, r=ChrisDenton
Fix typo in docs for slice::split_once, slice::rsplit_once

This fixes a typo in the doc comments for these methods, which I tripped over while reading the docs: "If any matching elements are **resent** in the slice [...]", which is presumably meant to read **present**.

I mentioned this in #112811, the tracking issue for `slice_split_once`, and was encouraged to open a PR.
2024-01-06 21:51:46 -05:00
Michael Goulet
e63a32e622
Rollup merge of #119656 - RalfJung:round-docs, r=Mark-Simulacrum
document rounding behavior of rint/nearbyint for ties

It's not possible to change the rounding mode in Rust, so these intrinsics will always behave like `roundeven`.
2024-01-06 21:51:45 -05:00
bors
fde0e98247 Auto merge of #119599 - marthadev:position, r=the8472
Rewrite Iterator::position default impl

Storing the accumulating value outside the fold in an attempt to improve code generation has shown speedups on various handwritten benchmarks, see discussion at #119551.
2024-01-06 22:34:53 +00:00
Matthias Krüger
1d6ab69ab1
Rollup merge of #119624 - petrochenkov:dialoc4, r=compiler-errors
rustc_span: More consistent span combination operations

Also add more tests for using `tt` in addition to `ident`, and some other minor tweaks, see individual commits.

This is a part of https://github.com/rust-lang/rust/pull/119412 that doesn't yet add side tables for metavariable spans.
2024-01-06 16:07:48 +01:00
Matthias Krüger
cda0d08388
Rollup merge of #119595 - mbbill:patch-1, r=Mark-Simulacrum
Fixed ambiguity in hint.rs

Needle and haystack are actually not the same, they remain constant.
2024-01-06 16:07:48 +01:00