Commit graph

18945 commits

Author SHA1 Message Date
82ccba1fd7 Make algebraic intrinsics into 'const fn' items; Make algebraic functions of 'f16', 'f32', 'f64', and 'f128' into 'const fn' items; 2025-04-22 21:54:35 +02:00
Chris Denton
07a28ec2fb
Rollup merge of #140081 - Berrysoft:update-libc-172, r=tgross35
Update `libc` to 0.2.172

r? ````@joboet````
2025-04-22 01:22:13 +00:00
bors
d6c1e454aa Auto merge of #140127 - ChrisDenton:rollup-2kye32h, r=ChrisDenton
Rollup of 11 pull requests

Successful merges:

 - #134213 (Stabilize `naked_functions`)
 - #139711 (Hermit: Unify `std::env::args` with Unix)
 - #139795 (Clarify why SGX code specifies linkage/symbol names for certain statics)
 - #140036 (Advent of `tests/ui` (misc cleanups and improvements) [4/N])
 - #140047 (remove a couple clones)
 - #140052 (Fix error when an intra doc link is trying to resolve an empty associated item)
 - #140074 (rustdoc-json: Improve test for auto-trait impls)
 - #140076 (jsondocck: Require command is at start of line)
 - #140107 (rustc-dev-guide subtree update)
 - #140111 (cleanup redundant pattern instances)
 - #140118 ({B,C}Str: minor cleanup)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-04-21 19:28:16 +00:00
Chris Denton
1cb9a0d450
Rollup merge of #140118 - tamird:cstr-cleanup, r=joboet
{B,C}Str: minor cleanup

(hopefully) uncontroversial bits extracted from #139994.
2025-04-21 18:53:21 +00:00
Chris Denton
8ecaf148e7
Rollup merge of #140111 - jogru0:redundant_pattern, r=compiler-errors
cleanup redundant pattern instances

Just two small code cleanups.
2025-04-21 18:53:20 +00:00
Chris Denton
cac8bc3d1f
Rollup merge of #139795 - jethrogb:jb/sgx-linkage-comments, r=joboet
Clarify why SGX code specifies linkage/symbol names for certain statics

Specifying linkage/symbol name is solely to ensure a single instance between the `std` crate and its unit tests.

Also update the symbol names as items have moved around a bit. The actual name isn't that important, it just needs to be unique. But for debugging it can be useful for it to point to the right place.
2025-04-21 18:53:16 +00:00
Chris Denton
5779843eda
Rollup merge of #139711 - thaliaarchi:hermit-args, r=jhpratt
Hermit: Unify `std::env::args` with Unix

The only differences between these implementations of `std::env::args` are that Unix uses relaxed ordering, but Hermit uses acquire/release, and Unix truncates `argv` at the first null pointer, but Hermit doesn't. Since Hermit aims for Unix compatibility, unify it with Unix.

The atomic orderings were established in https://github.com/rust-lang/rust/pull/74006 (cc `@euclio)` for Unix and https://github.com/rust-lang/rust/pull/100579 (cc `@joboet)` for Hermit and, before those, they used mutexes and non-atomic statics. I think the difference in orderings is simply from them being changed at different times. The commented explanation for using acquire/release for Hermit is “to broadcast writes by the OS”. I'm not experienced enough with atomics to accurately judge, but I think acquire/release is stronger than needed. Either way, they should match.

Truncating at the first null pointer seems desirable, though I don't know whether it is necessary in practice on Hermit.

cc `@mkroening` `@stlankes` for Hermit
2025-04-21 18:53:16 +00:00
Chris Denton
1ca5e4f1c1
Rollup merge of #134213 - folkertdev:stabilize-naked-functions, r=tgross35,Amanieu,traviscross
Stabilize `naked_functions`

tracking issue: https://github.com/rust-lang/rust/issues/90957
request for stabilization on tracking issue: https://github.com/rust-lang/rust/issues/90957#issuecomment-2539270352
reference PR: https://github.com/rust-lang/reference/pull/1689

# Request for Stabilization

Two years later, we're ready to try this again. Even though this issue is already marked as having passed FCP, given the amount of time that has passed and the changes in implementation strategy, we should follow the process again.

## Summary

The `naked_functions` feature has two main parts: the `#[naked]` function attribute, and the `naked_asm!` macro.

An example of a naked function:

```rust
const THREE: usize = 3;

#[naked]
pub extern "sysv64" fn add_n(number: usize) -> usize {
    // SAFETY: the validity of the used registers
    // is guaranteed according to the "sysv64" ABI
    unsafe {
        core::arch::naked_asm!(
            "add rdi, {}",
            "mov rax, rdi",
            "ret",
            const THREE,
        )
    }
}
```

When the `#[naked]` attribute is applied to a function, the compiler won't emit a [function prologue](https://en.wikipedia.org/wiki/Function_prologue_and_epilogue) or epilogue when generating code for this function. This attribute is analogous to [`__attribute__((naked))`](https://developer.arm.com/documentation/100067/0608/Compiler-specific-Function--Variable--and-Type-Attributes/--attribute----naked---function-attribute) in C. The use of this feature allows the programmer to have precise control over the assembly that is generated for a given function.

The body of a naked function must consist of a single `naked_asm!` invocation, a heavily restricted variant of the `asm!` macro: the only legal operands are `const` and `sym`, and the only legal options are `raw` and `att_syntax`. In lieu of specifying operands, the `naked_asm!` within a naked function relies on the function's calling convention to determine the validity of registers.

## Documentation

The Rust Reference: https://github.com/rust-lang/reference/pull/1689
(Previous PR: https://github.com/rust-lang/reference/pull/1153)

## Tests

* [tests/run-make/naked-symbol-visiblity](https://github.com/rust-lang/rust/tree/master/tests/codegen/naked-fn) verifies that `pub`, `#[no_mangle]` and `#[linkage = "..."]` work correctly for naked functions
* [tests/codegen/naked-fn](https://github.com/rust-lang/rust/tree/master/tests/codegen/naked-fn) has tests for function alignment, use of generics, and validates the exact assembly output on linux, macos, windows and thumb
* [tests/ui/asm/naked-*](https://github.com/rust-lang/rust/tree/master/tests/ui/asm) tests for incompatible attributes, generating errors around incorrect use of `naked_asm!`, etc

## Interaction with other (unstable) features

### [fn_align](https://github.com/rust-lang/rust/issues/82232)

Combining `#[naked]` with `#[repr(align(N))]` works well, and is tested e.g. here

- https://github.com/rust-lang/rust/blob/master/tests/codegen/naked-fn/aligned.rs
- https://github.com/rust-lang/rust/blob/master/tests/codegen/naked-fn/min-function-alignment.rs

It's tested extensively because we do need to explicitly support the `repr(align)` attribute (and make sure we e.g. don't mistake powers of two for number of bytes).

## History

This feature was originally proposed in [RFC 1201](https://github.com/rust-lang/rfcs/pull/1201), filed on 2015-07-10 and accepted on 2016-03-21. Support for this feature was added in [#32410](https://github.com/rust-lang/rust/pull/32410), landing on 2016-03-23. Development languished for several years as it was realized that the semantics given in RFC 1201 were insufficiently specific. To address this, a minimal subset of naked functions was specified by [RFC 2972](https://github.com/rust-lang/rfcs/pull/2972), filed on 2020-08-07 and accepted on 2021-11-16. Prior to the acceptance of RFC 2972, all of the stricter behavior specified by RFC 2972 was implemented as a series of warn-by-default lints that would trigger on existing uses of the `naked` attribute; these lints became hard errors in [#93153](https://github.com/rust-lang/rust/pull/93153) on 2022-01-22. As a result, today RFC 2972 has completely superseded RFC 1201 in describing the semantics of the `naked` attribute.

More recently, the `naked_asm!` macro was added to replace the earlier use of a heavily restricted `asm!` invocation. The `naked_asm!` name is clearer in error messages, and provides a place for documenting the specific requirements of inline assembly in naked functions.

The implementation strategy was changed to emitting a global assembly block. In effect, an extern function

```rust
extern "C" fn foo() {
    core::arch::naked_asm!("ret")
}
```

is emitted as something similar to

```rust
core::arch::global_asm!(
    "foo:",
    "ret"
);

extern "C" {
    fn foo();
}
```

The codegen approach was chosen over the llvm naked function attribute because:

- the rust compiler can guarantee the behavior (no sneaky additional instructions, no inlining, etc.)
- behavior is the same on all backends (llvm, cranelift, gcc, etc)

Finally, there is now an allow list of compatible attributes on naked functions, so that e.g. `#[inline]` is rejected with an error. The `#[target_feature]` attribute on naked functions was later made separately unstable, because implementing it is complex and we did not want to block naked functions themselves on how target features work on them. See also https://github.com/rust-lang/rust/issues/138568.

relevant PRs for these recent changes

- https://github.com/rust-lang/rust/pull/127853
- https://github.com/rust-lang/rust/pull/128651
- https://github.com/rust-lang/rust/pull/128004
- https://github.com/rust-lang/rust/pull/138570
-
### Various historical notes

#### `noreturn`
[RFC 2972](https://github.com/rust-lang/rfcs/blob/master/text/2972-constrained-naked.md) mentions that naked functions

> must have a body which contains only a single asm!() statement which:
> iii. must contain the noreturn option.

Instead of `asm!`, the current implementation mandates that the body contain a single `naked_asm!` statement. The `naked_asm!` macro is a heavily restricted version of the `asm!` macro, making it easier to talk about and document the rules of assembly in naked functions and give dedicated error messages.

For `naked_asm!`, the behavior of the `asm!`'s `noreturn` option is implicit. The `noreturn` option means that it is UB for control flow to fall through the end of the assembly block. With `asm!`, this option is usually used for blocks that diverge (and thus have no return and can be typed as `!`). With `naked_asm!`, the intent is different: usually naked funtions do return, but they must do so from within the assembly block. The `noreturn` option was used so that the compiler would not itself also insert a `ret` instruction at the very end.

#### padding / `ud2`

A `naked_asm!` block that violates the safety assumption that control flow must not fall through the end of the assembly block is UB. Because no return instruction is emitted, whatever bytes follow the naked function will be executed, resulting in truly undefined behavior. There has been discussion whether rustc should emit an invalid instruction (e.g. `ud2`  on x86) after the `naked_asm!` block to at least fail early in the case of an invalid `naked_asm!`. It was however decided that it is more useful to guarantee that `#[naked]` functions NEVER contain any instructions besides those in the `naked_asm!` block.

# unresolved questions

None

r? ``@Amanieu``

I've validated the tests on x86_64 and aarch64
2025-04-21 18:53:15 +00:00
Chris Denton
24bd5649b1
Rollup merge of #140009 - ShE3py:tls-abort, r=thomcc
docs(LocalKey<T>): clarify that T's Drop shouldn't panic

Clarify that should a TLS destructor panics, the process will abort.

Also, an abort may be obfuscated as the process can be terminated with `SIGSEGV` or [`STATUS_STACK_BUFFER_OVERRUN`](https://devblogs.microsoft.com/oldnewthing/20190108-00/?p=100655) (i.e., `SIGABRT` is not guaranteed), so explicitly prints that the process was aborted.

Context:
https://users.rust-lang.org/t/status-stack-buffer-overrun-on-windows-without-any-usage-of-unsafe/128417

``@rustbot`` label -T-compiler
2025-04-21 15:55:57 +00:00
Chris Denton
10e17dc3a4
Rollup merge of #139982 - coolreader18:time-doc-tweak, r=jhpratt
SystemTime doc tweaks

* Change the `UNIX_EPOCH` link in the `SystemTime` docs to point to the associated constant, not the module level constant. The former seems to be the recommended way to access it, since aiui the only reason the module constant exists in the first place is that associated constants weren't stable yet at the time.
* Reword the comment in the `SystemTime` example - "an error occurred!" is a tad misleading; I feel like it implies a system error out of our control while `SystemTimeError` is more of a logic error.

I was originally just gonna do the first thing but I noticed the second and figured I may as well.

I'm also somewhat surprised that there aren't more in-depth module level docs for `std::time`; they don't even mention `SystemTime` at all. I might make another PR for that but mainly just wanted to flag it.
2025-04-21 15:55:57 +00:00
Chris Denton
6925d2ff22
Rollup merge of #139946 - mumbleskates:any-fix-missing-word, r=jhpratt
fix missing word in comment

a very simple fix, rectifying a situation in which a word was accidentally .
2025-04-21 15:55:56 +00:00
Tamir Duberstein
aedbd2d1ec
Replace colon with parentheses, add missing period 2025-04-21 10:48:46 -04:00
Jonathan Gruner
2039b36f90 cleanup redundant pattern instances 2025-04-21 14:15:32 +02:00
bors
b8005bff32 Auto merge of #140079 - ChrisDenton:rollup-2h5cg94, r=ChrisDenton
Rollup of 5 pull requests

Successful merges:

 - #137953 (simd intrinsics with mask: accept unsigned integer masks, and fix some of the errors)
 - #139990 (transmutability: remove NFA intermediate representation)
 - #140044 (rustc-dev-guide subtree update)
 - #140051 (Switch exploit mitigations to mdbook footnotes)
 - #140054 (docs: fix typo change from inconstants to invariants)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-04-20 22:41:28 +00:00
Chris Denton
0034cf3e7c
Rollup merge of #138870 - beetrees:tier-2-nans, r=RalfJung
Add target-specific NaN payloads for the missing tier 2 targets

This PR adds target-specific NaN payloads for the remaining tier 2 targets:

- `arm64ec`: This target is a mix of `x86_64` and `aarch64`, meaning as they both have no extra payloads `arm64ec` also has no extra payloads.
- `loongarch64`: Per [LoongArch Reference Manual - Volume 1: Basic Architecture](https://github.com/loongson/LoongArch-Documentation/releases/download/2023.04.20/LoongArch-Vol1-v1.10-EN.pdf) section 3.1.1.3, LoongArch does quieting NaN propagation with the Rust preferred NaN as its default NaN, meaning it has no extra payloads.
- `nvptx64`: Per [PTX ISA documentation](https://docs.nvidia.com/cuda/parallel-thread-execution/index.html#floating-point-instructions) section 9.7.3 (and section 9.7.4 for `f16`), all payloads are possible. The documentation explicitly states that `f16` and `f32` operations result in an unspecified NaN payload, while for `f64` it states "NaN payloads are supported" without specifying how or what payload will be generated if there are no input NaNs.
- `powerpc` and `powerpc64`: Per [Power Instruction Set Architecture](https://files.openpower.foundation/s/9izgC5Rogi5Ywmm/download/OPF_PowerISA_v3.1C.pdf) Book I section 4.3.2, PowerPC does quieting NaN propagation with the Rust preferred NaN being generated if no there are no input NaNs, meaning it has no extra payloads.
- `s390x`: Per [IBM z/Architecture Principles of Operation](https://www.vm.ibm.com/library/other/22783213.pdf#page=965) page 9-3, s390x does quieting NaN propagation with the Rust's preferred NaN as its default NaN, meaning it has no extra payloads.

Tracking issue: #128288

cc ``@RalfJung``
``@rustbot`` label +T-lang

Also cc relevant target maintainers of tier 2 targets:
- `arm64ec`: ``@dpaoliello``
- `loongarch64`: ``@heiher`` ``@xiangzhai`` ``@zhaixiaojuan`` ``@xen0n``
- `nvptx64`: ``@RDambrosio016`` ``@kjetilkjeka``
- `powerpc`: the only documented maintainer is ``@BKPepe`` for the tier 3 `powerpc-unknown-linux-muslspe`.
- `powerpc64`: ``@daltenty`` ``@gilamn5tr`` ``@Gelbpunkt`` ``@famfo`` ``@neuschaefer``
- `s390x`: ``@uweigand`` ``@cuviper``
2025-04-20 14:05:33 +00:00
王宇逸
6ea0fe5fc4 Update libc to 0.2.172 for std 2025-04-20 21:19:52 +08:00
Chris Denton
d3fab38b0a
Rollup merge of #140054 - c-git:patch-1, r=joboet
docs: fix typo change from inconstants to invariants
2025-04-20 13:02:51 +00:00
Chris Denton
d15c603173
Rollup merge of #137953 - RalfJung:simd-intrinsic-masks, r=WaffleLapkin
simd intrinsics with mask: accept unsigned integer masks, and fix some of the errors

It's not clear at all why the mask would have to be signed, it is anyway interpreted bitwise. The backend should just make sure that works no matter the surface-level type; our LLVM backend already does this correctly. The note of "the mask may be widened, which only has the correct behavior for signed integers" explains... nothing? Why can't the code do the widening correctly? If necessary, just cast to the signed type first...

Also while we are at it, fix the errors. For simd_masked_load/store, the errors talked about the "third argument" but they meant the first argument (the mask is the first argument there). They also used the wrong type for `expected_element`.

I have extremely low confidence in the GCC part of this PR.

See [discussion on Zulip](https://rust-lang.zulipchat.com/#narrow/channel/257879-project-portable-simd/topic/On.20the.20sign.20of.20masks)
2025-04-20 13:02:48 +00:00
Ralf Jung
566dfd1a0d simd intrinsics with mask: accept unsigned integer masks 2025-04-20 12:25:27 +02:00
Folkert de Vries
df8a3d5f1d
stabilize naked_functions 2025-04-20 11:18:38 +02:00
bors
49e5e4e3a5 Auto merge of #140043 - ChrisDenton:rollup-vwf0s9j, r=ChrisDenton
Rollup of 8 pull requests

Successful merges:

 - #138934 (support config extensions)
 - #139091 (Rewrite on_unimplemented format string parser.)
 - #139753 (Make `#[naked]` an unsafe attribute)
 - #139762 (Don't assemble non-env/bound candidates if projection is rigid)
 - #139834 (Don't canonicalize crate paths)
 - #139868 (Move `pal::env` to `std::sys::env_consts`)
 - #139978 (Add citool command for generating a test dashboard)
 - #139995 (Clean UI tests 4 of n)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-04-20 02:08:02 +00:00
Onè
648653824b
docs: fix typo change from inconstants to invariants 2025-04-19 17:57:06 -04:00
Chris Denton
92adbd323a
Rollup merge of #139533 - jogru0:130711, r=Mark-Simulacrum
add next_index to Enumerate

Proposal: https://github.com/rust-lang/libs-team/issues/435
Tracking Issue: #130711

This basically just reopens #130682 but squashed and with the new function and the feature gate renamed to `next_index.`

There are two questions I have already:
- Shouldn't we add test coverage for that? I'm happy to provide some, but I might need a pointer to where these test would be.
  - Maybe I could actually also add a doctest?
- For now, I just renamed the feature name in the unstable attribute to `next_index`, as well, so it matches the new name of the function. Is that okay? And can I just do that and use any string, or is there a sealed list of features defined somewhere where I also need to change the name?
2025-04-19 19:30:47 +00:00
Chris Denton
709f4fee50
Rollup merge of #139868 - thaliaarchi:move-env-consts-pal, r=joboet
Move `pal::env` to `std::sys::env_consts`

Combine the `std::env::consts` platform implementations as a single file. Use the Unix file as the base, since it has 28 entries, and fold the 8 singleton platforms into it. The Unix file was roughly grouped into Linux, Apple, BSD, and everything else, roughly in alphabetical order. Alphabetically order them to make it easier to maintain and discard the Unix-specific groups to generalize it to all platforms.

I'd prefer to have no fallback implementation, as I consider it a bug; however TEEOS, Trusty, and Xous have no definitions here. Since they otherwise have `pal` abstractions, that indicates that there are several platforms without `pal` abstractions which are also missing here. To support unsupported, create a little macro to handle the fallback case and not introduce ordering between the `cfg`s like `cfg_if!`.

I've named the module `std::sys::env_consts`, because they are used in `std::env::consts` and I intend to use the name `std::sys::env` for the combination of `Args` and `Vars`.

cc `@joboet` `@ChrisDenton`

Tracked in #117276.
2025-04-19 15:09:35 +00:00
Chris Denton
995114908d
Rollup merge of #140016 - pfmooney:illumos-fstatat, r=jhpratt
std: Use fstatat() on illumos
2025-04-19 14:01:40 +00:00
Chris Denton
3c5aef3625
Rollup merge of #139922 - jnqnfe:cstr_doc_fix, r=jhpratt
fix incorrect type in cstr `to_string_lossy()` docs

Restoring what it said prior to commit 67065fe in which it was changed incorrectly with no supporting explanation.

Closes #139835.
2025-04-19 14:01:39 +00:00
Chris Denton
dff14f0634
Rollup merge of #139535 - ChrisDenton:default-ptr, r=tgross35
Implement `Default` for raw pointers

ACP: https://github.com/rust-lang/libs-team/issues/571

This is instantly stable so we will need an FCP here.

Closes https://github.com/rust-lang/rfcs/issues/2464
2025-04-19 14:01:37 +00:00
Jonathan Gruner
f121c7c360 added test for Enumerate::next_index on empty iterator 2025-04-19 12:29:47 +02:00
Jonathan Gruner
5a71fabe29 added doctest for Enumerate::next_index 2025-04-19 12:29:47 +02:00
Jonathan Gruner
1f491dccba add next_index to Enumerate 2025-04-19 12:29:47 +02:00
bors
a7c39b6861 Auto merge of #139114 - m-ou-se:super-let-pin, r=davidtwco
Implement `pin!()` using `super let`

Tracking issue for super let: https://github.com/rust-lang/rust/issues/139076

This uses `super let` to implement `pin!()`.

This means we can remove [the hack](https://github.com/rust-lang/rust/pull/138717) we had to put in to fix https://github.com/rust-lang/rust/issues/138596.

It also means we can remove the original hack to make `pin!()` work, which used a questionable public-but-unstable field rather than a proper private field.

While `super let` is still unstable and subject to change, it seems safe to assume that future Rust will always have a way to express `pin!()` in a compatible way, considering `pin!()` is already stable.

It'd help [the experiment](https://github.com/rust-lang/rust/issues/139076) to have `pin!()` use `super let`, so we can get some more experience with it.
2025-04-19 08:01:53 +00:00
Thalia Archibald
670ff84d1c Handle unsupported fallback 2025-04-18 19:49:23 -07:00
Thalia Archibald
37712cc016 Combine env consts into std::sys::env_consts 2025-04-18 19:17:08 -07:00
Thalia Archibald
e0d9244472 Sort Unix env constants alphabetically by target_os
They were roughly grouped into Linux, Apple, BSD, and everything else,
roughly in alphabetical order. Alphabetically order them to make it
easier to maintain and discard the Unix-specific groups to generalize it
to all platforms.
2025-04-18 16:35:26 -07:00
Patrick Mooney
fb3cae08ab std: Use fstatat() on illumos 2025-04-18 14:44:19 -05:00
Tamir Duberstein
87072c1d2e
Remove errant doc comment lines 2025-04-18 11:25:36 -04:00
Tamir Duberstein
9058bab9a9
Move <CStr as Debug> test to coretests 2025-04-18 10:31:55 -04:00
Tamir Duberstein
f727b3622b
Invert <CString as Deref>::deref and CString::as_c_str
This is consistent with the style of `ByteString`.
2025-04-18 10:31:12 -04:00
bors
191df20fca Auto merge of #139996 - matthiaskrgr:rollup-0nka2hw, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #138528 (deref patterns: implement implicit deref patterns)
 - #139393 (rustdoc-json: Output target feature information)
 - #139553 (sync::mpsc: prevent double free on `Drop`)
 - #139615 (Remove `name_or_empty`)
 - #139853 (Disable combining LLD with external llvm-config)
 - #139913 (rustdoc/clean: Fix lowering of fn params (fixes correctness & HIR vs. middle parity regressions))
 - #139942 (Ignore aix for tests/ui/erros/pic-linker.rs)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-04-18 13:49:17 +00:00
Lieselotte
17b7d63fd7
rtprintpanic: clarify that the error is aborting the process 2025-04-18 15:02:22 +02:00
Lieselotte
0d56e3eed1
LocalKey<T>: document that the dtor should not panic 2025-04-18 14:11:32 +02:00
Matthias Krüger
af61fdf7d5
Rollup merge of #139934 - tgross35:update-builtins, r=tgross35
Update `compiler-builtins` to 0.1.155

Includes the following changes:

* Replace `#[naked]` with `#[unsafe(naked)]` [1] [2]
* Replace `bl!` with `asm_sym` [3]

[1]: https://github.com/rust-lang/compiler-builtins/pull/817
[2]: https://github.com/rust-lang/compiler-builtins/pull/821
[3]: https://github.com/rust-lang/compiler-builtins/pull/820

try-job: armhf-gnu
try-job: aarch64-apple
try-job: dist-apple-various
2025-04-18 05:17:53 +02:00
Matthias Krüger
5e8bc7f4d3
Rollup merge of #139553 - petrosagg:channel-double-free, r=RalfJung,tgross35
sync::mpsc: prevent double free on `Drop`

This PR is fixing a regression introduced by #121646 that can lead to a double free when dropping the channel.

The details of the bug can be found in the corresponding crossbeam PR https://github.com/crossbeam-rs/crossbeam/pull/1187
2025-04-18 05:16:29 +02:00
Matthias Krüger
dc2d273acd
Rollup merge of #139977 - Amanieu:select_unpredictable_drop, r=RalfJung
Fix drop handling in `hint::select_unpredictable`

This intrinsic doesn't drop the value that is not selected so this is manually done in the public function that wraps the intrinsic.
2025-04-17 21:53:27 +02:00
Matthias Krüger
b6e48d3850
Rollup merge of #139483 - RalfJung:nan, r=tgross35
f*::NAN: guarantee that this is a quiet NaN

I think we should guarantee that this is a quiet NaN. This then implies that programs not using `f*::from_bits` (or unsafe type conversions) are guaranteed to only work with quiet NaNs. It would be awkward if people start to write `0.0 / 0.0` instead of using the constant just because they want to get a guaranteed-quiet NaN.

This is a `@rust-lang/libs-api` change. The definition of this constant currently is `0.0 / 0.0`, which is already guaranteed to be a quiet NaN. So all this does is forward that guarantee to our users.
2025-04-17 21:53:24 +02:00
Trevor Gross
7d6f41b08e Update compiler-builtins to 0.1.155
Includes the following changes:

* Replace `#[naked]` with `#[unsafe(naked)]` [1] [2]
* Replace `bl!` with `asm_sym` [3]

[1]: https://github.com/rust-lang/compiler-builtins/pull/817
[2]: https://github.com/rust-lang/compiler-builtins/pull/821
[3]: https://github.com/rust-lang/compiler-builtins/pull/820
2025-04-17 19:08:27 +00:00
Noa
34573d683f
Be more specific about the error in the SystemTime example 2025-04-17 11:57:28 -05:00
Noa
88bd1913f2
Point UNIX_EPOCH to associated constant in SystemTime docs 2025-04-17 11:37:54 -05:00
Amanieu d'Antras
e5e5fb9d80 Fix drop handling in hint::select_unpredictable
This intrinsic doesn't drop the value that is not selected so this is
manually done in the public function that wraps the intrinsic.
2025-04-17 17:30:53 +02:00
Kent Ross
abf401df1c fix missing word in comment 2025-04-16 18:53:40 -07:00