Commit graph

314911 commits

Author SHA1 Message Date
Jamie Hill-Daniel
adbdf8dbf0 Allow invoking all help options at once 2026-01-07 14:02:09 +00: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
bors
da476f1942 Auto merge of #150640 - AprilNEA:mgca-merge-associated-const-equality, r=BoxyUwU
Merge `associated_const_equality` feature gate into MGCA

Tracking Issues: rust-lang/rust#132980 rust-lang/rust#92827

Merge `associated_const_equality`(ACE) feature gate into `min_generic_const_args`(MGCA).

- Replaces `features().associated_const_equality()` checks with `features().min_generic_const_args()`
- Updates the parser to gate associated const equality under `min_generic_const_args`
- Moves `associated_const_equality` to the removed features list
- Removes the `associated_const_equality` method from the `Features` trait
- Updates all affected tests and tools (rust-analyzer, clippy)

Closes rust-lang/rust#150617

r? `@BoxyUwU`
2026-01-06 01:36:53 +00:00
bors
7c04f5d216 Auto merge of #150702 - lnicola:sync-from-ra, r=lnicola
`rust-analyzer` subtree update

Subtree update of `rust-analyzer` to 6a1246b69c.

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

r? `@ghost`
2026-01-05 22:21:47 +00:00
bors
4fa80a5e73 Auto merge of #150700 - Kobzol:rollup-02y1lh9, r=Kobzol
Rollup of 3 pull requests

Successful merges:

 - rust-lang/rust#149790 (Remove `Span` from segments of `AttrPath`)
 - rust-lang/rust#150384 (Tidying up tests/ui/issues 16 tests [7/N])
 - rust-lang/rust#150697 (relate.rs: tiny cleanup: eliminate temp vars 2)

r? `@ghost`
`@rustbot` modify labels: rollup
2026-01-05 18:13:45 +00: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
Jakub Beránek
469a26439c
Rollup merge of #150697 - hkBst:relate-3, r=Kivooeo
relate.rs: tiny cleanup: eliminate temp vars 2

Continuation of rust-lang/rust#150678

r? `@Kivooeo`
2026-01-05 15:54:14 +01:00
Jakub Beránek
5bcdc7c131
Rollup merge of #150384 - reddevilmidzy:t14, r=Kivooeo
Tidying up tests/ui/issues 16 tests [7/N]

> [!NOTE]
> Intermediate commits are intended to help review, but will be squashed add comment commit prior to merge.

part of rust-lang/rust#133895

r? Kivooeo
2026-01-05 15:54:13 +01:00
Jakub Beránek
b198dffd98
Rollup merge of #149790 - JonathanBrouwer:attr-path-perf, r=jdonszelmann
Remove `Span` from segments of `AttrPath`

r? jdonszelmann
2026-01-05 15:54:12 +01:00
Marijn Schouten
3d6a2c5ae1 relate.rs: tiny cleanup: eliminate temp vars 2 2026-01-05 12:31:21 +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
bors
9e8a0c5164 Auto merge of #150692 - jhpratt:rollup-kfi61p5, r=jhpratt
Rollup of 3 pull requests

Successful merges:

 - rust-lang/rust#146863 (Update cell.rs, correct module level doc)
 - rust-lang/rust#150547 (std: sys: fs: uefi: Implement rename)
 - rust-lang/rust#150684 (Motor OS: fix compile error)

r? `@ghost`
`@rustbot` modify labels: rollup
2026-01-05 08:19:33 +00:00
reddevilmidzy
93f8ad9950 cleaned up some tests
cleaned up cast-enum-const.rs

cleaned up ufcs-trait-object-format.rs

add comment to cast-to-box-arr.rs

add comment to shadow-primitives.rs

add comment to associated-type-const-nomalization.rs

add comment to fn-trait-explicit-call.rs

add comment to call-unit-struct-impl-fn-once.rs

add comment to cast-to-char-compare.rs

add comment to self-in-method-body-resolves.rs

add comment to derive-debug-newtype-unsized-slice.rs

add comment to tuple-ref-order-distinct-impls.rs

add comment to derive-debug-generic-with-lifetime.rs

add comment to recursive-trait-bound-on-type-param.rs

cleaned up const-static-ref-to-closure.rs

add comment to const-iter-no-conflict-for-loop.rs
2026-01-05 15:35:01 +09:00
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
bors
0d162b25ed Auto merge of #150535 - Kobzol:rename-ci-gcc, r=jieyouxu
Rename the gcc component to gcc-dev

In preparation for https://rust-lang.zulipchat.com/#narrow/channel/242791-t-infra/topic/Safe.20rustup.20distribution.20of.20rustc_codegen_gcc/with/565801325.

try-job: dist-x86_64-linux
2026-01-05 05:02:20 +00:00
AprilNEA
4421270516
Merge associated_const_equality feature gate into MGCA
This removes `associated_const_equality` as a separate feature gate and makes it part of `min_generic_const_args` (mgca).

Key changes:
  - Remove `associated_const_equality` from unstable features, add to removed
  - Update all test files to use `min_generic_const_args` instead
  - Preserve the original "associated const equality is incomplete" error message by specially handling `sym::associated_const_equality` spans in `feature_gate.rs`
  - Rename FIXME(associated_const_equality) to FIXME(mgca)
2026-01-05 12:31:42 +08:00
bors
6885bdf1af Auto merge of #150603 - Kivooeo:tuple-struct, r=BoxyUwU
MGCA: Support for tuple constructors

r? BoxyUwU

part of https://github.com/rust-lang/rust/issues/132980

fixes rust-lang/rust#136379
fixes rust-lang/rust#138132

i tried to keep implementation very minimal and it's very similar to how structs was implemented with small adjustments

this does not make const constructor like None works, just something like Some(n)

todo:
* ~~tests~~
* write a better description (not sure if needed)
* add more comments and FIXMEs from structs code
2026-01-05 01:45:18 +00:00
reddevilmidzy
5c5c1ff6db moved some test
delete tests/ui/issues/issue-22426.rs duplicated of tests/ui/match/guards.rs
2026-01-05 10:04:46 +09:00
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
bors
451b7b6c77 Auto merge of #150682 - matthiaskrgr:rollup-jrkhivl, r=matthiaskrgr
Rollup of 3 pull requests

Successful merges:

 - rust-lang/rust#149681 (resolve: Split `Scope::Module` into two scopes for non-glob and glob bindings )
 - rust-lang/rust#150426 (Update offload test and verify that tgt_(un)register_lib have the right type)
 - rust-lang/rust#150678 (relate.rs: tiny cleanup: eliminate temp vars)

r? `@ghost`
`@rustbot` modify labels: rollup
2026-01-04 21:47:15 +00:00
Matthias Krüger
8b1f4495e5
Rollup merge of #150678 - hkBst:relate-1, r=Kivooeo
relate.rs: tiny cleanup: eliminate temp vars
2026-01-04 21:14:06 +01:00
Matthias Krüger
1494755275
Rollup merge of #150426 - ZuseZ4:offload-register-lib, r=davidtwco
Update offload test and verify that tgt_(un)register_lib have the right type

Apparently, we weren't running offload tests when Enzyme wasn't built. Time to fix that.
Also adds a test mode which generates the host IR, but does not expect device IR/artifacts. This way, we don't have to handle artifacts and paths in our tests.
Also removes some outdated documentation.

cc `@Kevinsala,` `@Sa4dUs`

closes: https://github.com/rust-lang/rust/issues/150415

~~blocked on `needs-offload` infrastructure landing in https://github.com/rust-lang/rust/pull/150427~~
2026-01-04 21:14:05 +01:00
Matthias Krüger
df246c107a
Rollup merge of #149681 - petrochenkov:openapi1, r=davidtwco
resolve: Split `Scope::Module` into two scopes for non-glob and glob bindings

This is a re-implementation of https://github.com/rust-lang/rust/pull/144131 with all the issues mentioned there fixed.

As it turned out, the non-trivial part of the split was already done in https://github.com/rust-lang/rust/pull/149454/commits/c91b6ca58d4d870d3099db1defbd8c1f26a7d851, so the remaining part implemented in this PR is *mostly* mechanical.

After addressing the issue of already found bindings being lost due to indeterminacies in outer scopes (7e890bfa87) and adding one missing `Stage::Late` in `Finalize` the scope splitting refactoring just worked.
(One more ICE was revealed by the refactoring, but not caused by it, fixed up in the last commit.)

This is a part of implementation for the [Open API](https://rust-lang.github.io/rust-project-goals/2025h1/open-namespaces.html) proposal.
2026-01-04 21:14:04 +01:00
Chayim Refael Friedman
8ddb153cd1
Merge pull request #21403 from ShoyuVanilla/missing-assoc-specialize
fix: Suppress false positive missing assoc item diag on specialization
2026-01-04 18:36:03 +00:00
Shoyu Vanilla
7dbe12ec72 fix: Suppress false positive missing assoc item diag on specialization 2026-01-05 02:16:12 +09:00
Marijn Schouten
359f060175 relate.rs: tiny cleanup: eliminate temp vars 2026-01-04 17:06:39 +00:00
bors
e29fcf45e4 Auto merge of #150674 - matthiaskrgr:rollup-tnkgbcx, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - rust-lang/rust#150554 (test: add regression cases for valtree hashing ICE)
 - rust-lang/rust#150597 (make specialization of `Vec::extend` and `VecDeque::extend_front` work for vec::IntoIter with any `Allocator`, not just `Global`)
 - rust-lang/rust#150619 (alloc: Move Cow impl to existing ones)
 - rust-lang/rust#150660 (THIR pattern building: Pass HIR nodes instead of loose types/spans)
 - rust-lang/rust#150671 (miri subtree update)

r? `@ghost`
`@rustbot` modify labels: rollup
2026-01-04 16:58:33 +00:00
Shoyu Vanilla (Flint)
b1ed7e6184
Merge pull request #21369 from A4-Tacks/migrate-move-guard
Migrate `move_arm_cond_to_match_guard` assist to use `SyntaxEditor`
2026-01-04 15:41:17 +00:00
Matthias Krüger
eeb4431881
Rollup merge of #150671 - RalfJung:miri, r=RalfJung
miri subtree update

Subtree update of `miri` to 5d149f2282.

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

r? `@ghost`
2026-01-04 16:16:11 +01:00
Matthias Krüger
cdddb85585
Rollup merge of #150660 - Zalathar:pass-nodes, r=davidtwco
THIR pattern building: Pass HIR nodes instead of loose types/spans

This should make it easier to keep track of where the types/spans came from.

There should be no change to compiler output.

---

In the future I would also like to make more of these lowering methods return `Box<thir::Pat>` instead of `thir::PatKind`, so that it becomes feasible to add more fields to `thir::Pat` (e.g. for https://github.com/rust-lang/rust/pull/150498#discussion_r2652138926). That will be easier if those methods have easy access to the corresponding HIR pattern node, from which they can obtain a type and span.
2026-01-04 16:16:11 +01:00
Matthias Krüger
18910b7353
Rollup merge of #150619 - cvengler:move-cow-impl, r=Mark-Simulacrum
alloc: Move Cow impl to existing ones

Right now, the `borrow.rs` module starts with a `Cow` impl, although most of them can be found below.

This hurts code readability because there is `ToOwned` alongside its impl directly below it.

Moving it to the others down below makes sense here, given that the entire enum depends on `ToOwned` anyways.
2026-01-04 16:16:10 +01:00
Matthias Krüger
9dd3b2358e
Rollup merge of #150597 - antonilol:extend-from-vec-any-allocator, r=jhpratt
make specialization of `Vec::extend` and `VecDeque::extend_front` work for vec::IntoIter with any `Allocator`, not just `Global`

These functions consume all the elements from the respective collection, but do not care about the `Allocator` they use. Without specifying one (like in `vec::IntoIter<T>`) the specialization is only chosen when `A=Global`.

(extra context: `VecDeque::extend_front` is unstable and tracked by rust-lang/rust#146975)
2026-01-04 16:16:10 +01:00
Matthias Krüger
2270553cbe
Rollup merge of #150554 - Dushyanthyadav:ice-issue-150409-regression-test, r=davidtwco
test: add regression cases for valtree hashing ICE

This PR extends the existing regression test `printing_valtrees_supports_non_values.rs` to cover cases that previously caused an ICE in `const_kind.rs` due to hashing inference variables.

It specifically adds:

A case where an associated constant is used without the required trait bound.

The `0: _` case as suggested in [Here](https://github.com/rust-lang/rust/issues/150409#issuecomment-3700022690)

Fixes rust-lang/rust#150409
2026-01-04 16:16:09 +01:00
Kivooeo
05afcb6d26 init impl 2026-01-04 15:12:39 +00:00
Manuel Drehwald
fa584faca5 Update test and verify that tgt_(un)register_lib have the right type 2026-01-04 06:58:31 -08:00
bors
5afdf5d8c0 Auto merge of #150669 - Zalathar:rollup-7ar4hqp, r=Zalathar
Rollup of 7 pull requests

Successful merges:

 - rust-lang/rust#150201 (compiletest: Support revisions in debuginfo (read: debugger) tests)
 - rust-lang/rust#150642 (mutex.rs: remove needless-maybe-unsized bounds)
 - rust-lang/rust#150643 (vec in-place-drop: avoid creating an intermediate slice)
 - rust-lang/rust#150650 (Forbid generic parameters in types of #[type_const] items)
 - rust-lang/rust#150658 (Clarify panic conditions in `Iterator::last`)
 - rust-lang/rust#150659 (Add missing translator resources for interface parse_cfg and parse_check_cfg)
 - rust-lang/rust#150666 (Fix ambig-unambig-ty-and-consts link)

r? `@ghost`
`@rustbot` modify labels: rollup
2026-01-04 13:34:53 +00:00
Ralf Jung
ff2acf0eca update lockfile 2026-01-04 12:44:38 +01:00
Lukas Wirth
6acaa27fa6
Merge pull request #21401 from Veykril/push-optyvyworqny
Add a README.md to proc-macro-srv-cli
2026-01-04 11:18:25 +00:00
Lukas Wirth
50b78f1bb4 Add a README.md to proc-macro-srv-cli 2026-01-04 12:09:44 +01:00
Ralf Jung
dbf2ef7c45
Merge pull request #4803 from RalfJung/check_only
add check_only feature for faster check builds
2026-01-04 11:04:27 +00:00
Lukas Wirth
4bfdbb8bba
Merge pull request #21400 from Veykril/push-kslvlxlpmwwu
internal: Clean up proc-macro-srv callback trait
2026-01-04 10:55:28 +00:00
Lukas Wirth
d4b9ea2e86 internal: Clean up proc-macro-srv callback trait 2026-01-04 11:46:34 +01:00
Ralf Jung
0557c759a9 add check_only feature for faster check builds 2026-01-04 11:37:29 +01:00
Stuart Cook
85dc7c2361
Rollup merge of #150666 - reddevilmidzy:fix-link, r=BoxyUwU
Fix ambig-unambig-ty-and-consts link

cc: https://github.com/rust-lang/rustc-dev-guide/pull/2677
2026-01-04 21:37:06 +11:00