Commit graph

26888 commits

Author SHA1 Message Date
Flakebi
91d4e40e02
Add amdgpu_dispatch_ptr intrinsic
Add a rustc intrinsic `amdgpu_dispatch_ptr` to access the kernel
dispatch packet on amdgpu.
The HSA kernel dispatch packet contains important information like the
launch size and workgroup size.

The Rust intrinsic lowers to the `llvm.amdgcn.dispatch.ptr` LLVM
intrinsic, which returns a `ptr addrspace(4)`, plus an addrspacecast to
`addrspace(0)`, so it can be returned as a Rust reference.

The returned pointer/reference is valid for the whole program lifetime,
and is therefore `'static`.

The return type of the intrinsic (`*const ()`) does not mention the
struct so that rustc does not need to know the exact struct type.
An alternative would be to define the struct as lang item or add a
generic argument to the function.

Short version:
```rust
#[cfg(target_arch = "amdgpu")]
pub fn amdgpu_dispatch_ptr() -> *const ();
```
2026-01-09 10:41:37 +01:00
rust-bors[bot]
85d0cdfe34
Auto merge of #150265 - scottmcm:vec-less-ubchecks, r=jhpratt
Stop emitting UbChecks on every Vec→Slice

Spotted this in rust-lang/rust#148766's test changes.  It doesn't seem like this ubcheck would catch anything useful; let's see if skipping it helps perf.  (After all, this is inside *every* `[]` on a vec, among other things.)
2026-01-09 09:04:56 +00:00
Ayush Singh
97fc739602
std: sys: fs: uefi: Implement File::tell
- Just a call to get_position
- Tested with OVMF on QEMU

Signed-off-by: Ayush Singh <ayush@beagleboard.org>
2026-01-09 10:44:59 +05:30
tison
45e0fbf7c5
Implement partial_sort_unstable for slice
Signed-off-by: tison <wander4096@gmail.com>
Co-Authored-By: Orson Peters <orsonpeters@gmail.com>
Signed-off-by: tison <wander4096@gmail.com>
2026-01-09 09:58:08 +08:00
Scott McMurray
c48df5dcf1 Move the rustc_no_mir_inline down a level 2026-01-08 17:14:02 -08:00
Scott McMurray
5932078c79 Stop emitting UbChecks on every Vec→Slice
Spotted this in PR148766's test changes.  It doesn't seem like this ubcheck would catch anything useful; let's see if skipping it helps perf.
2026-01-08 17:14:02 -08:00
Alan Egerton
3c136cc9e1
Fix broken documentation links to SipHash
The documentation of `SipHasher` previously linked to a page about
SipHash on https://131002.net, a domain registered to Jean-Philippe
Aumasson, one of the co-authors of the original SipHash paper (alongside
Daniel J Bernstein).

That domain now redirects to another of Mr Aumasson's domains,
https://www.aumasson.jp, but which does not host a similar page
dedicated to SipHash.  Instead, his site links to a GitHub repository
containing a C implementation together with links to the original
research paper.  Mr Bernstein's own site, https://cr.yp.to, only hosts a
copy of the research paper.

Therefore the GitHub repository appears to be the most official and
complete reference to which we can link.
2026-01-09 00:44:50 +00:00
rust-bors[bot]
3fda0e426c
Auto merge of #150839 - matthiaskrgr:rollup-3a0ebXJ, r=matthiaskrgr
Rollup of 11 pull requests

Successful merges:

 - rust-lang/rust#149961 (tidy: add if-installed prefix condition to extra checks system)
 - rust-lang/rust#150475 (std: sys: fs: uefi: Implement initial File)
 - rust-lang/rust#150533 (std: sys: fs: uefi: Implement remove_dir_all)
 - rust-lang/rust#150549 (fix missing_panics_doc in `std::os::fd::owned`)
 - rust-lang/rust#150699 (MGCA: Support literals as direct const arguments)
 - rust-lang/rust#150721 (Deprecated doc intra link)
 - rust-lang/rust#150802 (Minor cleanups to fn_abi_new_uncached)
 - rust-lang/rust#150803 (compiler-builtins subtree update)
 - rust-lang/rust#150809 (Update `literal-escaper` version to `0.0.7`)
 - rust-lang/rust#150811 (Store defids instead of symbol names in the aliases list)
 - rust-lang/rust#150825 (Query associated_item_def_ids when needed)

r? @ghost
2026-01-08 23:40:03 +00:00
Matthias Krüger
74ab9a4784
Rollup merge of #150809 - update-literal-escaper, r=Urgau
Update `literal-escaper` version to `0.0.7`

It removes the `std` dependency for this crate (which doesn't change anything for rustc 😄 ).

cc @bjorn3
r? @Urgau
2026-01-08 22:21:21 +01:00
Matthias Krüger
d1aaf26d83
Rollup merge of #150803 - update-builtins, r=tgross35
compiler-builtins subtree update

Subtree update of `compiler-builtins` to 65624df7f5.

Created using https://github.com/rust-lang/josh-sync.

r? @ghost
2026-01-08 22:21:20 +01:00
Matthias Krüger
e7560df897
Rollup merge of #150549 - patch-1, r=ChrisDenton
fix missing_panics_doc in `std::os::fd::owned`

https://rust-lang.github.io/rust-clippy/master/index.html#missing_panics_doc
2026-01-08 22:21:16 +01:00
Matthias Krüger
836ff9c06d
Rollup merge of #150533 - uefi-fs-rmdirall, r=ChrisDenton
std: sys: fs: uefi: Implement remove_dir_all

- Using the implementation from sys::fs::common since UEFI does not have a built-in for this functionality.

@rustbot label +O-UEFI
2026-01-08 22:21:15 +01:00
Matthias Krüger
d21770710b
Rollup merge of #150475 - uefi-fs-file, r=ChrisDenton
std: sys: fs: uefi: Implement initial File

- Implement basic opening and creating files.
- Also implement debug.

@rustbot label +O-UEFI
2026-01-08 22:21:15 +01:00
rust-bors[bot]
31cd367b9c
Auto merge of #148545 - cramertj:alloc-map, r=Amanieu
Add allocator parameter to HashMap

Hashbrown support originally added in https://github.com/rust-lang/hashbrown/pull/133
Part of https://github.com/rust-lang/wg-allocators/issues/7

~See also: hashset support in https://github.com/rust-lang/rust/pull/148550~ (Edit: merged into this PR for crater)
2026-01-08 20:22:35 +00:00
Martin Nordholts
8e3d60447c Finish transition from semitransparent to semiopaque for rustc_macro_transparency 2026-01-08 19:14:45 +01:00
Matthias Krüger
5a5740fb68
Rollup merge of #150789 - 2025-fix-vtable-for-comment, r=joboet
Fix copy-n-paste error in `vtable_for` docs

This is a safe function, which doesn't take a `ptr` parameter.
2026-01-08 16:25:33 +01:00
Matthias Krüger
eaff06187f
Rollup merge of #150736 - atomic-ptr-null, r=joboet
Add AtomicPtr::null

Implementation for https://github.com/rust-lang/rust/issues/150733.

I marked this function as `#[must_use]` even though the other `AtomicPtr` constructors aren't. It's unclear to me why they aren't already marked as such, I opened a zulip thread asking about it: [#t-libs > Is there a reason AtomicPtr constructors aren't #&#91;must_use&#93;?](https://rust-lang.zulipchat.com/#narrow/channel/219381-t-libs/topic/Is.20there.20a.20reason.20AtomicPtr.20constructors.20aren't.20.23.5Bmust_use.5D.3F/with/566624261).
2026-01-08 16:25:31 +01:00
Matthias Krüger
b3f95da910
Rollup merge of #150074 - provider-doc-update, r=Mark-Simulacrum
Update provider API docs

Adds guidance on a specific provider API implementation anti pattern that implementers of the error trait should avoid.

resolves https://github.com/rust-lang/rust/issues/99301#issuecomment-3661904330
2026-01-08 16:25:27 +01:00
Matthias Krüger
10ef3586d5
Rollup merge of #149976 - waker-fn, r=jhpratt
Add waker_fn and local_waker_fn to std::task

This refers to rust-lang/rust#149580.
2026-01-08 16:25:27 +01:00
bjorn3
c873d16323 Remove unnecessary module 2026-01-08 15:02:42 +00:00
bjorn3
3fed6e67ef Remove a couple of outdated fields in std_detect Cargo.toml
It is no longer a part of the stdarch repo and the rest is not necessary
anymore due to no longer publishing to crates.io.
2026-01-08 14:50:12 +00:00
bjorn3
665770ec84 Remove std_detect_file_io and std_detect_dlsym_getauxval features
They were introduced back when std_detect was a standalone crate
published to crates.io. The motivation for std_detect_dlsym_getauxval
was to allow using getauxval without dlopen when statically linking
musl, which we now unconditionally do for musl. And for
std_detect_file_io to allow no_std usage, which std_detect now supports
even with that feature enabled as it directly uses libc. This also
prevents accidentally disabling runtime feature detection when using
cargo build -Zbuild-std -Zbuild-std-features=
2026-01-08 14:50:12 +00:00
Guillaume Gomez
27b1083a96 Update literal-escaper version to 0.0.7 2026-01-08 14:10:33 +01:00
cyrgani
d41191958a rename the derive_{eq, clone_copy} features to *_internals 2026-01-08 12:35:30 +00:00
Oli Scherer
82028b0f9a Add size information 2026-01-08 12:02:59 +00:00
Oli Scherer
a3359bdd4f Compile-Time Reflection MVP: tuples 2026-01-08 11:41:00 +00:00
Mateusz Mikuła
69bedd10d2 compiler-builtins: Enable AArch64 __chkstk for MinGW
Similarly to i686 and X86_64 MinGW targets, Rust needs to provide the
right chkstk symbol for AArch64 to avoid relying on the linker to
provide it.

CC https://github.com/rust-lang/rust/issues/150725
2026-01-08 05:01:35 -05:00
Peter Todd
a3b72d3de5
Fix copy-n-paste error in vtable_for docs
This is a safe function, which doesn't take a `ptr` parameter.
2026-01-08 02:11:03 +00:00
Yotam Ofek
f82dd820a5 Use rand crate more idiomatically 2026-01-07 22:31:33 +02:00
wr7
5548a84c87 Stabilize slice::element_offset 2026-01-07 10:57:20 -07:00
Alan Somers
ebd0151c81 Fix the connect_error test on FreeBSD 15+
On FreeBSD 15, the error code returned in this situation changed.  It's
now ENETUNREACH.  I think that error code is reasonable, and it's
documented for connect(2), so we should expect that it might be
returned.
2026-01-07 10:42:00 -07:00
tison
6346d14202
Apply suggestion from @tisonkun 2026-01-07 09:31:59 +08:00
neo
139d59f7ec Reword the collect() docs to stress that the return type determines the resulting collection 2026-01-07 09:53:06 +09:00
Orson Peters
fff9c623bf Add feature to doc example 2026-01-06 23:38:31 +01:00
Orson Peters
af69f15712 Add AtomicPtr::null 2026-01-06 22:09:11 +01:00
The 8472
1cd87525e6 Unix implementation for stdio set/take/replace 2026-01-06 16:57:11 +01:00
Jonathan Brouwer
3b0d35f94b
Rollup merge of #150412 - the8472:pidfd-spawn, r=tgross35
use PIDFD_GET_INFO ioctl when available

This way using pidfd_spawnp won't have to rely on procfs, avoiding an unpleasant edge-case where the child is spawned but we can't get the pid. And pidfd.{try_}wait will be able to return the exit status even after a process has been reaped. At least on newer kernels.

Tracking issue: https://github.com/rust-lang/rust/issues/82971
2026-01-06 16:19:41 +01:00
bors
74fd7516da Auto merge of #147893 - fee1-dead-contrib:constheapheapheap, r=oli-obk
`Vec::push` in consts MVP

Example:

```rust
const X: &'static [u32] = {
    let mut v = Vec::with_capacity(6);
    let mut x = 1;
    while x < 42 {
        v.push(x);
        x *= 2;
    }
    assert!(v.len() == 6);
    v.const_make_global()
};

assert_eq!([1, 2, 4, 8, 16, 32], X);
```

Oh this is fun...

* We split out the implementation of `Global` such that it calls `intrinsics::const_allocate` and `intrinsics::const_deallocate` during compile time. This is achieved using `const_eval_select`
* This allows us to `impl const Allocator for Global`
* We then constify everything necessary for `Vec::with_capacity` and `Vec::push`.
* Added `Vec::const_make_global` to leak and intern the final value via `intrinsics::const_make_global`. If we see any pointer in the final value of a `const` that did not call `const_make_global`, we error as implemented in rust-lang/rust#143595.

r? `@rust-lang/wg-const-eval`

To-do for me:
* [x] Assess the rustdoc impact of additional bounds in the method
* [x] ~~Increase test coverage~~ I think this is enough for an unstable feature.
2026-01-06 11:39:17 +00:00
The 8472
fa4a62b066 use PIDFD_GET_INFO ioctl when available
This way using pidfd_spawnp won't have to rely on procfs, avoiding an unpleasant edge-case
where the child is spawned but we can't get the pid.
And `pidfd.{try_}wait` will be able to return the exit status even after a process has been reaped.
At least on newer kernels.
2026-01-06 01:13:09 +01:00
bors
bd33b83cfd Auto merge of #149784 - fereidani:retain_mut, r=joboet
Improve alloc `Vec::retain_mut` performance

Hi,

While reading the rustc source code, I noticed it uses `smallvec` and `thin-vec` in many places. I started reviewing those crates, optimized their `retain_mut` implementation, and then realized they were using the exact same algorithm as `alloc::vec::Vec` with less unsafe  So now I’m back here with a PR for the standard library 😂.

In my benchmarks, this version is noticeably faster when `retain_mut` actually removes elements (thanks to fewer pointer operations, it just advances `write_index`), while performing identically to the current implementation when nothing is removed.

Let’s see if bors likes this change or not.
2026-01-05 14:55:14 +00:00
bors
b7bcaa5c71 Auto merge of #143741 - connortsui20:oneshot, r=joboet
`oneshot` Channel

Tracking Issue: https://github.com/rust-lang/rust/issues/143674

This PR adds an experimental `oneshot` module.

Before talking about the API itself, I would prefer to get some of these questions below out of the way first. And as discussed in the [ACP](https://github.com/rust-lang/libs-team/issues/610) it would be

# Unresolved Questions

- [x] ~~Why exactly is it okay for `Sender` to be `Sync`? Or basically, how do we boil down the discussion in https://github.com/rust-lang/rust/pull/111087 into a comment for the `unsafe impl<T: Send> Sync for Sender<T> {}`?~~
- [x] ~~Why is `mpsc::Receiver` `!Sync` but `mpmc::Receiver` is `Sync`? Should `oneshot::Receiver` be `Sync` or not?~~
- [ ] Should this PR try to add an `is_ready` method as proposed in the tracking issue? If so, then the surface of this PR would likely need to increase to add a `pub(crate) fn is_disconnected` method to `mpmc` (might even be a good idea to add that to all 3 channel flavors).
- [ ] In a similar vein to the previous question, should the first internal implementation simply be a wrapper around `mpmc`, or should it be a wrapper around the internal crossbeam implementation?
- [ ] Should the `Sender` and `Receiver` operations be methods or associated methods? So `sender.send(msg)` or `Sender::send(sender, msg)`? The method syntax is more consistent with the rest of the ecosystem (namely `tokio`)
2026-01-05 11:35:43 +00:00
Khashayar Fereidani
bd79ea1b74 Improve and optimize retain_mut implementation 2026-01-05 13:18:41 +03:30
Khashayar Fereidani
0330cc2446 Add feature flag likely/unlikely for alloc 2026-01-05 13:14:11 +03:30
Jacob Pratt
d788ec5e9a
Rollup merge of #150684 - moturus:main, r=jhpratt
Motor OS: fix compile error

PR https://github.com/rust-lang/rust/pull/146341 introduced a compilation error. This fixes it.
2026-01-05 00:16:35 -05:00
Jacob Pratt
a1221deafd
Rollup merge of #150547 - Ayush1325:uefi-rename, r=jhpratt
std: sys: fs: uefi: Implement rename

- Using the file_name field in `EFI_FILE_INFO` works for renaming, even when changing directories.
- Does not work for cross-device rename, but that is already expected behaviour according to the docs:

  "This will not work if the new name is on a different mount point."

- Also add some helper code for dealing with UefiBox<file::Info>.
- Tested using OVMF in qemu.
- edk2 implementation of the same: 66346d5ede/ShellPkg/Library/UefiShellLevel2CommandsLib/Mv.c (L455)

``@rustbot`` label +O-UEFI
2026-01-05 00:16:34 -05:00
Jacob Pratt
fe5a1d7332
Rollup merge of #146863 - matwatson:core-cell-improve-doc, r=tgross35
Update cell.rs, correct module level doc

This change corrects the Cell<T> section by replacing `&mut` with `&` so the statement reads "an &T to the inner value can never be obtained". It also emphasizes that a single &mut T to the inner value can be obtained (e.g. via method core::cell::Cell::get_mut).
2026-01-05 00:16:33 -05:00
Ayush Singh
3f773fac3b
std: sys: fs: uefi: Implement remove_dir_all
- Using the implementation from sys::fs::common since UEFI does not have
  a built-in for this functionality.

Signed-off-by: Ayush Singh <ayush@beagleboard.org>
2026-01-05 10:31:57 +05:30
U. Lasiotus
3f1dd92cc7 Motor OS: fix compile error
PR https://github.com/rust-lang/rust/pull/146341 introduced
a compilation error. This fixes it.
2026-01-04 16:55:57 -08:00
Connor Tsui
b481ecd8b5
add oneshot tests
Tests inspired by tests in the `oneshot` third-party crate.
2026-01-05 09:47:20 +11:00
Connor Tsui
9ba5b5e7f7
add experimental oneshot channel
The `oneshot` channel is gated under the `oneshot_channel` feature.

Signed-off-by: Connor Tsui <connor.tsui20@gmail.com>
2026-01-05 09:47:15 +11:00