Commit Graph

14959 Commits

Author SHA1 Message Date
许杰友 Jieyou Xu (Joe)
3cc59aeaae
Rollup merge of #125226 - madsmtm:fix-mac-catalyst-tests, r=workingjubilee
Make more of the test suite run on Mac Catalyst

Combined with https://github.com/rust-lang/rust/pull/125225, the only failing parts of the test suite are in `tests/rustdoc-js`, `tests/rustdoc-js-std` and `tests/debuginfo`. Tested with:
```console
./x test --target=aarch64-apple-ios-macabi library/std
./x test --target=aarch64-apple-ios-macabi --skip=tests/rustdoc-js --skip=tests/rustdoc-js-std --skip=tests/debuginfo tests
```

Will probably put up a PR later to enable _running_ on (not just compiling for) Mac Catalyst in CI, though not sure where exactly I should do so? `src/ci/github-actions/jobs.yml`?

Note that I've deliberately _not_ enabled stack overflow handlers on iOS/tvOS/watchOS/visionOS (see https://github.com/rust-lang/rust/issues/25872), but rather just skipped those tests, as it uses quite a few APIs that I'd be weary about getting rejected by the App Store (note that Swift doesn't do it on those platforms either).

r? ``@workingjubilee``

CC ``@thomcc``

``@rustbot`` label O-ios O-apple
2024-05-29 03:25:08 +01:00
许杰友 Jieyou Xu (Joe)
2d3b1e014b
Rollup merge of #124251 - scottmcm:unop-ptr-metadata, r=oli-obk
Add an intrinsic for `ptr::metadata`

The follow-up to #123840, so we can remove `PtrComponents` and `PtrRepr` from libcore entirely (well, after a bootstrap update).

As discussed in <https://rust-lang.zulipchat.com/#narrow/stream/189540-t-compiler.2Fwg-mir-opt/topic/.60ptr_metadata.60.20in.20MIR/near/435637808>, this introduces `UnOp::PtrMetadata` taking a raw pointer and returning the associated metadata value.

By no longer going through a `union`, this should also help future PRs better optimize pointer operations.

r? ``@oli-obk``
2024-05-29 03:25:07 +01:00
Scott McMurray
7150839552 Add custom mir support for PtrMetadata 2024-05-28 09:28:51 -07:00
Scott McMurray
459ce3f6bb Add an intrinsic for ptr::metadata 2024-05-28 09:28:51 -07:00
Matthias Krüger
faabc74625
Rollup merge of #125637 - nnethercote:rustfmt-fixes, r=GuillaumeGomez
rustfmt fixes

The `rmake.rs` entries in `rustfmt.toml` are causing major problems for `x fmt`. This PR removes them and does some minor related cleanups.

r? ``@GuillaumeGomez``
2024-05-28 18:04:33 +02:00
Mads Marquart
e6b9bb7b72 Make more of the test suite run on Mac Catalyst
This adds the `only-apple`/`ignore-apple` compiletest directive, and
uses that basically everywhere instead of `only-macos`/`ignore-macos`.

Some of the updates in `run-make` are a bit redundant, as they use
`ignore-cross-compile` and won't run on iOS - but using Apple in these
is still more correct, so I've made that change anyhow.
2024-05-28 12:31:33 +02:00
Mads Marquart
37ae2b68b1 Disable stack overflow handler tests on iOS-like platforms 2024-05-28 12:31:12 +02:00
Nicholas Nethercote
f1b0ca08a4 Don't format tests/run-make/*/rmake.rs.
It's reasonable to want to, but in the current implementation this
causes multiple problems.

- All the `rmake.rs` files are formatted every time even when they
  haven't changed. This is because they get whitelisted unconditionally
  in the `OverrideBuilder`, before the changed files get added.

- The way `OverrideBuilder` works, if any files gets whitelisted then no
  unmentioned files will get traversed. This is surprising, and means
  that the `rmake.rs` entries broke the use of explicit paths to `x
  fmt`, and also broke `GITHUB_ACTIONS=true git check --fmt`.

The commit removes the `rmake.rs` entries, fixes the formatting of a
couple of files that were misformatted (not previously caught due to the
`GITHUB_ACTIONS` breakage), and bans `!`-prefixed entries in
`rustfmt.toml` because they cause all these problems.
2024-05-28 19:28:46 +10:00
Jubilee
4aaf9f645e
Rollup merge of #125647 - tspiteri:track-lazy_cell_consume, r=workingjubilee
update tracking issue for lazy_cell_consume

<!--
If this PR is related to an unstable feature or an otherwise tracked effort,
please link to the relevant tracking issue here. If you don't know of a related
tracking issue or there are none, feel free to ignore this.

This PR will get automatically assigned to a reviewer. In case you would like
a specific user to review your work, you can assign it to them by using

    r​? <reviewer name>
-->
2024-05-28 02:07:49 -07:00
Jubilee
941bf8bee1
Rollup merge of #125551 - clarfonthey:ip-bits, r=jhpratt
Stabilise `IpvNAddr::{BITS, to_bits, from_bits}` (`ip_bits`)

This completed FCP in #113744. (Closes #113744.)

Stabilises the following APIs:

```rust
impl Ipv4Addr {
    pub const BITS: u32 = 32;
    pub const fn from_bits(bits: u32) -> Ipv4Addr;
    pub const fn to_bits(self) -> u32;
}

impl Ipv6Addr {
    pub const BITS: u32 = 128;
    pub const fn from_bits(bits: u128) -> Ipv4Addr;
    pub const fn to_bits(self) -> u128;
}
```
2024-05-28 02:07:48 -07:00
Trevor Spiteri
402a649e75 update tracking issue for lazy_cell_consume 2024-05-28 11:02:03 +02:00
bors
c0d600385b Auto merge of #125636 - workingjubilee:bump-backtrace-0.3.72, r=workingjubilee
Bump backtrace to 0.3.72

This removes a bunch of dead code, contains critical aarch64-windows fixes, some less-critical windows-in-general improvements, adds visionOS support (and probably improves support for a bunch of Apple platforms...), and harmonizes backtrace's dependencies with rustc/std's.

See https://github.com/rust-lang/backtrace-rs/compare/0.3.71...0.3.72

r? `@ghost`
2024-05-28 04:58:04 +00:00
Jubilee Young
3ec9d8db27 Sync libstd deps with backtrace 2024-05-27 19:53:41 -07:00
Jubilee Young
00b759530e Bump backtrace to 0.3.72 2024-05-27 19:53:31 -07:00
bors
d86e122941 Auto merge of #125609 - diondokter:opt-size-char-count, r=thomcc
Always use the general case char count with `optimize_for_size`

The faster algo is really expensive, over a kilobyte if the full algo is present in a binary.
With this PR the general case algo is picked always instead of only for small strings.

In a test of mine this change makes the total binary go from 3116 bytes to 2032 bytes in opt-level 3 and from 1652 bytes to 1428 bytes in opt-level z. I've seen it much worse in real application, so the savings (especially on 'z') will be higher in many cases.

This is the second pr of this kind after #125606
2024-05-28 02:47:32 +00:00
Guillaume Gomez
6dddc888fc
Rollup merge of #124870 - Lokathor:update-result-docs, r=dtolnay
Update Result docs to the new guarantees

The `Option` docs already explain the guarantees given in [RFC 3391](https://github.com/rust-lang/rfcs/blob/master/text/3391-result_ffi_guarantees.md), so all that we need is a paragraph saying that some `Result` type combinations will also qualify.

Part of https://github.com/rust-lang/rust/issues/110503
2024-05-27 13:10:33 +02:00
Dion Dokter
05fa647dc7 Always use the general case char count 2024-05-27 12:05:00 +02:00
Jubilee
25b079a1cf
Rollup merge of #125559 - scottmcm:simplify-shift-ubcheck, r=workingjubilee
Simplify the `unchecked_sh[lr]` ub-checks a bit

It can use the constant in the check, rather than passing it as a parameter.
2024-05-26 15:28:28 -07:00
bors
b0925697fd Auto merge of #122079 - tbu-:pr_copy_file_range_probe, r=the8472
Less syscalls for the `copy_file_range` probe

If it's obvious from the actual syscall results themselves that the syscall is supported or unsupported, don't do an extra syscall with an invalid file descriptor.

CC #122052
2024-05-26 15:48:29 +00:00
bors
785eb65377 Auto merge of #125574 - matthiaskrgr:rollup-1oljoup, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #125307 (tidy: stop special-casing tests/ui entry limit)
 - #125375 (Create a triagebot ping group for Rust for Linux)
 - #125473 (fix(opt-dist): respect existing config.toml)
 - #125508 (Stop SRoA'ing `DynMetadata` in MIR)
 - #125561 (Stabilize `slice_flatten`)
 - #125571 (f32: use constants instead of reassigning a dummy value as PI)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-05-26 13:09:58 +00:00
Matthias Krüger
27cdb36ec5
Rollup merge of #125571 - tesuji:dummy-pi, r=Nilstrieb
f32: use constants instead of reassigning a dummy value as PI
2024-05-26 13:43:08 +02:00
Matthias Krüger
f775fffac5
Rollup merge of #125561 - Cyborus04:stabilize-slice-flatten, r=scottmcm
Stabilize `slice_flatten`
2024-05-26 13:43:07 +02:00
bors
a6a017d3f3 Auto merge of #125570 - tesuji:stdout-handle, r=Nilstrieb
Use STD_OUTPUT_HANDLE instead of magic number
2024-05-26 10:57:58 +00:00
Lzu Tao
96a731e5b8 f32: use constants instead of reassigning a dummy value as PI 2024-05-26 09:32:39 +00:00
Lzu Tao
b06b122d8c use proper name instead of magic number 2024-05-26 09:19:18 +00:00
Cyborus
824ffd29ee
Stabilize slice_flatten 2024-05-26 01:26:24 -04:00
bors
bd184cc3e1 Auto merge of #125070 - tbu-:pr_set_extension_panic, r=jhpratt
Panic if `PathBuf::set_extension` would add a path separator

This is likely never intended and potentially a security vulnerability if it happens.

I'd guess that it's mostly literal strings that are passed to this function in practice, so I'm guessing this doesn't break anyone.

CC #125060
2024-05-26 04:14:32 +00:00
bors
75e2c5dcd0 Auto merge of #125518 - saethlin:check-arguments-new-in-const, r=joboet
Move the checks for Arguments constructors to inline const

Thanks `@Skgland` for pointing out this opportunity: https://github.com/rust-lang/rust/pull/117804#discussion_r1612964362
2024-05-26 01:10:39 +00:00
Lokathor
9b480da367 It seems that anchor names are implicitly all lowercase 2024-05-25 17:44:48 -06:00
Scott McMurray
0c84361342 Simplify the unchecked_sh[lr] ub-checks a bit 2024-05-25 15:58:26 -07:00
Lokathor
f8279b10c3 Fix URL target, it's in the module not the type. 2024-05-25 16:46:58 -06:00
Lokathor
2b2f83e5ff github showed that weird. 2024-05-25 16:05:22 -06:00
Lokathor
2e8f14fb37 correct for copy paste errors when fixing wrapping. 2024-05-25 16:04:26 -06:00
Lokathor
22668e83f6 Resolve https://github.com/rust-lang/rust/pull/124870#issuecomment-2128824959 2024-05-25 15:46:55 -06:00
Lokathor
939f2671a0 revert to the inconsistent paragraph wrapping. 2024-05-25 15:41:18 -06:00
Matthias Krüger
80aea305d3
Rollup merge of #124667 - newpavlov:stabilize_div_duration, r=jhpratt
Stabilize `div_duration`

Closes #63139
2024-05-25 22:15:18 +02:00
Matthias Krüger
7fb81229d3
Rollup merge of #123803 - Sp00ph:shrink_to_fix, r=Mark-Simulacrum
Fix `VecDeque::shrink_to` UB when `handle_alloc_error` unwinds.

Fixes #123369

For `VecDeque` it's relatively simple to restore the buffer into a consistent state so this PR does just that.

Note that with its current implementation, `shrink_to` may change the internal arrangement of elements in the buffer, so e.g. `[D, <uninit>, A, B, C]` will become `[<uninit>, A, B, C, D]` and `[<uninit>, <uninit>, A, B, C]` may become `[B, C, <uninit>, <uninit>, A]` if `shrink_to` unwinds. This shouldn't be an issue though as we don't make any guarantees about the stability of the internal buffer arrangement (and this case is impossible to hit on stable anyways).

This PR also includes a test with code adapted from #123369 which fails without the new `shrink_to` code. Does this suffice or do we maybe need more exhaustive tests like in #108475?

cc `@Amanieu`

`@rustbot` label +T-libs
2024-05-25 22:15:17 +02:00
Matthias Krüger
2a1b63251a
Rollup merge of #122986 - taiki-e:aix-c-char, r=Mark-Simulacrum
Fix c_char on AIX

Closes https://github.com/rust-lang/rust/issues/122985
2024-05-25 22:15:16 +02:00
Matthias Krüger
890982e47b
Rollup merge of #121377 - pitaj:lazy_cell_fn_pointer, r=dtolnay
Stabilize `LazyCell` and `LazyLock`

Closes #109736

This stabilizes the [`LazyLock`](https://doc.rust-lang.org/stable/std/sync/struct.LazyLock.html) and [`LazyCell`](https://doc.rust-lang.org/stable/std/cell/struct.LazyCell.html) types:

```rust
static HASHMAP: LazyLock<HashMap<i32, String>> = LazyLock::new(|| {
    println!("initializing");
    let mut m = HashMap::new();
    m.insert(13, "Spica".to_string());
    m.insert(74, "Hoyten".to_string());
    m
});

let lazy: LazyCell<i32> = LazyCell::new(|| {
    println!("initializing");
    92
});
```

r? libs-api
2024-05-25 22:15:16 +02:00
ltdk
0d42cf7afe Stabilise ip_bits feature 2024-05-25 15:00:59 -04:00
bors
48f00110d0 Auto merge of #121571 - clarfonthey:unchecked-math-preconditions, r=saethlin
Add assert_unsafe_precondition to unchecked_{add,sub,neg,mul,shl,shr} methods

(Old PR is haunted, opening a new one. See #117494 for previous discussion.)

This ensures that these preconditions are actually checked in debug mode, and hopefully should let people know if they messed up. I've also replaced the calls (I could find) in the code that use these intrinsics directly with those that use these methods, so that the asserts actually apply.

More discussions on people misusing these methods in the tracking issue: https://github.com/rust-lang/rust/issues/85122.
2024-05-25 18:07:32 +00:00
Matthias Krüger
1d54ba8402
Rollup merge of #125527 - programmerjake:patch-2, r=workingjubilee
Add manual Sync impl for ReentrantLockGuard

Fixes: #125526
Tracking Issue: #121440

this impl is even shown in the summary in the tracking issue, but apparently was forgotten in the actual implementation
2024-05-25 12:54:38 +02:00
Matthias Krüger
4d13c96c65
Rollup merge of #125498 - zmodem:avx512er, r=workingjubilee
Stop using the avx512er and avx512pf x86 target features

They are no longer supported by LLVM 19.

Fixes #125492
2024-05-25 12:54:35 +02:00
Matthias Krüger
e58a0a8961
Rollup merge of #125478 - Urgau:check-cfg-config-bump-stage0, r=Mark-Simulacrum
Bump bootstrap compiler to the latest beta compiler

This PR updates the bootstrap compiler, aka stage0 to the latest beta version, since it contains rust-lang/cargo#13925.

It removes those unconditional Cargo warnings:

```
warning: [...]/rust/library/core/Cargo.toml: unused manifest key: lints.rust.unexpected_cfgs.check-cfg
warning: [...]/rust/library/std/Cargo.toml: unused manifest key: lints.rust.unexpected_cfgs.check-cfg
warning: [...]/rust/library/alloc/Cargo.toml: unused manifest key: lints.rust.unexpected_cfgs.check-cfg
```

for all contributors/users of this repository (including CI).

I don't know if that's something we do, or if it's even advisable, feel free to close.

r? `@Mark-Simulacrum`
2024-05-25 12:54:35 +02:00
Matthias Krüger
f28d36899c
Rollup merge of #125271 - RalfJung:posix_memalign, r=workingjubilee
use posix_memalign on almost all Unix targets

Seems nice to be able to use a single common codepath for all of them. :) The `libc` crate says this symbol exists for all Unix targets. I did locally do check-builds to ensure this still builds, but I can't really test more than that.

- For redox, I found indications posix_memalign really exists [here](https://gitlab.redox-os.org/redox-os/relibc/-/merge_requests/271)
- For esp-idf, I found indications [here](c5b297a86f)
- ~~For horizon and vita (these seem to be gaming console OSes? "Horizon OS" also has some hits for a Facebook product but that seems unrelated), they seem to be based on "newlib", where posix_memalign [seems to exist](https://sourceware.org/git/?p=newlib-cygwin.git;a=commitdiff;h=3ba2c39fb2a12cd7332ef16b1b3e3df994f7c6f5).~~ Turns out no, this 20-year-old standard POSIX function is unfortunately [not supported](https://github.com/rust-lang/rust/pull/125271#issuecomment-2119221419) here.
2024-05-25 12:54:34 +02:00
Ben Kimock
9763222f59 Move the checks for Arguments constructors to inline const 2024-05-24 21:09:15 -04:00
Jacob Lifshay
f4b9ac68f3
Add manual Sync impl for ReentrantLockGuard
Fixes: #125526
2024-05-24 17:44:37 -07:00
Matthias Krüger
363fbb967e
Rollup merge of #125497 - meesfrensel:patch-1, r=calebzulawski
Fix some SIMD intrinsics documentation

Spotted some mistakes in the docs of some SIMD intrinsics.
2024-05-24 23:01:10 +02:00
bors
697ac29a80 Auto merge of #125499 - matthiaskrgr:rollup-84i5z5w, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - #125455 (Make `clamp` inline)
 - #125477 (Run rustfmt on files that need it.)
 - #125481 (Fix the dead link in the bootstrap README)
 - #125482 (Notify kobzol after changes to `opt-dist`)
 - #125489 (Revert problematic opaque type change)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-05-24 18:53:03 +00:00
Hans Wennborg
3fe3157858 Stop using the avx512er and avx512pf x86 target features
They are no longer supported by LLVM 19.

Fixes #125492
2024-05-24 20:12:42 +02:00