Commit Graph

13129 Commits

Author SHA1 Message Date
Kevin Reid
6f8a944ba4 Change return type of unstable Waker::noop() from Waker to &Waker.
The advantage of this is that it does not need to be assigned to a
variable to be used in a `Context` creation, which is the most common
thing to want to do with a noop waker.

If an owned noop waker is desired, it can be created by cloning, but the
reverse is harder. Alternatively, both versions could be provided, like
`futures::task::noop_waker()` and `futures::task::noop_waker_ref()`, but
that seems to me to be API clutter for a very small benefit, whereas
having the `&'static` reference available is a large benefit.

Previous discussion on the tracking issue starting here:
https://github.com/rust-lang/rust/issues/98286#issuecomment-1862159766
2024-01-17 11:53:16 -08:00
Matthias Krüger
3a33a4b8f5
Rollup merge of #119935 - joboet:move_pal_personality, r=ChrisDenton
Move personality implementation out of PAL

The module already follows the new convention described in #117276. This PR also includes a small fix in the tidy pal check, that was just an oversight in #117285.
2024-01-13 22:35:09 +01:00
joboet
cb052d57b3
std: move personality implementation out of PAL 2024-01-13 18:30:44 +01:00
bors
c6c4abf584 Auto merge of #119927 - matthiaskrgr:rollup-885ws57, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #119587 (Varargs support for system ABI)
 - #119891 (rename `reported_signature_mismatch` to reflect its use)
 - #119894 (Allow `~const` on associated type bounds again)
 - #119896 (Taint `_` placeholder types in trait impl method signatures)
 - #119898 (Remove unused `ErrorReporting` variant from overflow handling)
 - #119902 (fix typo in `fn()` docs)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-01-13 16:09:45 +00:00
bors
1d8d7b16cb Auto merge of #117285 - joboet:move_platforms_to_pal, r=ChrisDenton
Move platform modules into `sys::pal`

This is the initial step of #117276. `sys` just re-exports everything from the current `sys` for now, I'll move the implementations for the individual features one-by-one after this PR merges.
2024-01-13 14:10:56 +00:00
Matthias Krüger
f53caa1106
Rollup merge of #119902 - asquared31415:patch-1, r=the8472
fix typo in `fn()` docs
2024-01-13 15:10:30 +01:00
joboet
0cfc995814
don't break a good link
Co-authored-by: klensy <klensy@users.noreply.github.com>
2024-01-13 09:18:36 +01:00
asquared31415
51afc0922c
fix typo in fn() docs 2024-01-12 15:51:18 -05:00
bors
2319be8e26 Auto merge of #119452 - AngelicosPhosphoros:make_nonzeroint_get_assume_nonzero, r=scottmcm
Add assume into `NonZeroIntX::get`

LLVM currently don't support range metadata for function arguments so it fails to optimize non zero integers using their invariant if they are provided using by-value function arguments.

Related to https://github.com/rust-lang/rust/issues/119422
Related to https://github.com/llvm/llvm-project/issues/76628
Related to https://github.com/rust-lang/rust/issues/49572
2024-01-12 20:18:04 +00:00
bors
5431404b87 Auto merge of #118548 - Enselic:bench-padding, r=thomcc,ChrisDenton
libtest: Fix padding of benchmarks run as tests

### Summary

The first commit adds regression tests for libtest padding.

The second commit fixes padding for benches run as tests and updates the blessed output of the regression tests to make it clear what effect the fix has on padding.

Closes #104092 which is **E-help-wanted** and **regression-from-stable-to-stable**

### More details

Before this fix we applied padding _before_ manually doing what `convert_benchmarks_to_tests()` does which affects padding calculations. Instead use `convert_benchmarks_to_tests()` first if applicable and then apply padding afterwards so it becomes correct.

Benches should only be padded when run as benches to make it easy to compare the benchmark numbers. Not when run as tests.

r? `@ghost` until CI passes.
2024-01-12 05:06:03 +00:00
bors
6029085a6f Auto merge of #119430 - NCGThompson:int-pow-bench, r=cuviper
Add Benchmarks for int_pow Methods.

There is quite a bit of room for improvement in performance of the `int_pow` family of methods. I added benchmarks for those functions. In particular, there are benchmarks for small compile-time bases to measure the effect of  #114390. ~~I added a lot (245), but all but 22 of them are marked with `#[ignore]`. There are a lot of macros, and I would appreciate feedback on how to simplify them.~~

~~To run benches relevant to #114390, use `./x bench core --stage 1 -- pow_base_const --include-ignored`.~~
2024-01-12 03:04:45 +00:00
joboet
7c436a8af4
update paths in comments 2024-01-12 00:11:33 +01:00
joboet
d6efeadb06
std: fix module references on Windows 2024-01-11 20:26:20 +01:00
joboet
411f34b782
std: fix module references on UNIX 2024-01-11 20:26:06 +01:00
joboet
cac470cde1
std: fix module references on UEFI 2024-01-11 20:21:05 +01:00
joboet
4ab475dfb5
std: fix module reference on SGX 2024-01-11 20:18:17 +01:00
joboet
4da4958099
std: fix module references on hermit 2024-01-11 20:16:09 +01:00
joboet
99128b7e45
std: begin moving platform support modules into pal 2024-01-11 20:10:25 +01:00
Nicholas Thompson
c65c35b3ef Reduced amount of int_pow benches
Also simplified the macros
2024-01-11 14:00:01 -05:00
Matthias Krüger
b3d15ebb08
Rollup merge of #119853 - klensy:rustfmt-ignore, r=cuviper
rustfmt.toml: don't ignore just any tests path, only root one

Previously ignored any `tests` path, now only /tests at repo root.

For reference, https://git-scm.com/docs/gitignore#_pattern_format
2024-01-11 19:42:53 +01:00
Matthias Krüger
1a4d3c9c47
Rollup merge of #119845 - RalfJung:rint, r=nagisa
rint: further doc tweaks

r? ``@nagisa``
2024-01-11 19:42:52 +01:00
Matthias Krüger
6beb676990
Rollup merge of #119836 - hi-rustin:rustin-patch-docs-blank-line, r=ChrisDenton
chore: remove unnecessary blank line

It seems no need to add an unnecessary line here.
2024-01-11 19:42:50 +01: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
Nicholas Thompson
7c28a50a3a removed nonfunctioning benchmark
It could also have been fixed by removing a semicolon instead.
2024-01-11 11:30:12 -05:00
Ralf Jung
6b6f2a5a28 rint: further doc tweaks 2024-01-11 13:33:27 +01:00
klensy
aa696c5a22 apply fmt 2024-01-11 15:04:48 +03:00
Matthias Krüger
f92cde4f9a
Rollup merge of #119804 - tmccombs:stabilize-unpoison, r=cuviper
Stabilize mutex_unpoison feature

Closes #96469

`@rustbot` +T-libs-api
2024-01-11 03:02:44 +01:00
hi-rustin
784b50cece chore: remove unnecessary blank line
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2024-01-11 09:45:21 +08: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
Thayne McCombs
1ed855dedf Stabilize mutex_unpoison feature
Closes #96469

@rustbot +T-libs-api
2024-01-10 02:34:34 -07: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
Guillaume Gomez
d61b92f154
Rollup merge of #119768 - ojeda:panic-link, r=Nilstrieb
core: panic: fix broken link
2024-01-09 17:52:22 +01:00
Guillaume Gomez
87b0de6cb7
Rollup merge of #118645 - Patryk27:bump-compiler-builtins, r=Nilstrieb,dtolnay
chore: Bump compiler_builtins

Actually closes https://github.com/rust-lang/rust/issues/118079.
2024-01-09 17:52:20 +01:00
Guillaume Gomez
5e75d46b67
Rollup merge of #118241 - fortanix:raoul/gh-530-make_userspace_types_send, r=Nilstrieb,dtolnay
Making `User<T>` and `User<[T]>` `Send`

All `User` types in SGX point to owned memory in userspace. Special care is always needed when accessing this memory as it must be assumed that an attacker is always able to change its content. Therefore, we can also easily transfer this memory between thread boundaries.

cc: ``@mzohreva`` ``@vn971`` ``@belalH`` ``@jethrogb``
2024-01-09 17:52:19 +01: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
Guillaume Gomez
df2f4ae4ac
Rollup merge of #118748 - devnexen:fbsd_getrandom_simpl, r=Nilstrieb,dtolnay
std: getrandom simplification for freebsd.

it is in the libcs' crate too now.
2024-01-09 13:23:16 +01:00
Guillaume Gomez
4a24b5bc05
Rollup merge of #117556 - obeis:static-mut-ref-lint, r=davidtwco
Disallow reference to `static mut` and adding `static_mut_ref` lint

Closes #114447

r? `@scottmcm`
2024-01-09 13:23:15 +01:00
Matthias Krüger
50982bd4ab
Rollup merge of #119632 - ivmarkov:master, r=Nilstrieb,dtolnay
Fix broken build for ESP IDF due to #119026

`target_os = "espidf"` in `libc` lacks the `SOMAXCONN` constant, but that's probably irrelevant in this context, as `UnixListener` is not supported on ESP IDF - it being a single process "OS" only.

The PR just re-uses the `128` constant so that the code builds. Trying to use the listener on ESP IDF will fail with `ENOSYS`, which is fine.

*UPDATE* Might not fail with `ENOSYS` - need to test what error code would be returned, but that doesn`t change anything.
2024-01-09 05:33:22 +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