Repository navigation
Merge subtree update for toolchain nightly-2026-11-23 - #797
Open
github-actions[bot] wants to merge 10000 commits into
Open
github-actions[bot] wants to merge 10000 commits into
github-actions[bot] wants to merge 10000 commits into
Conversation
…name suggests our assert_instr checks now match the actual clang output, update stdarch-verify to match
…nGnome std: Clean up and improve errors for `is_*_feature_detected` macros This includes a handful of small changes around the internals of our feature detection macros: * Add UI tests, since this macro is pretty UI-forward but not yet covered anywhere * Remove misleading feature gates that aren't even being checked, e.g. what showed up in rust-lang#111192 (comment). * Clean up some errors and improve the comments around all of this This is done in a handful of separate commits, the messages have some more details.
…gate, r=JonathanBrouwer Add `Forget` trait feature gate r? jonathanbrouwer Add an unstable feature gate for the `Forget` trait. Creating the feature gate allows experimentation with its implementation. Note that this does not commit to anything w.r.t. stabilization of the forget trait. A feature gate can be removed at any time. Part of rust-lang#165370
…in, r=nia-e [Outreachy] alloc: Add test coverage for try_clone_from_ref_in (Box, Arc, Rc) Description: LLM Disclosure: I used an AI assistant for local guidance while exploring the test structure and troubleshooting compiler errors (such as handling System allocator equality checks). I wrote this PR description, ran all tests, and verified the changes myself. **Summary** I added a UI test to verify `try_clone_from_ref_in ` across **Box, Arc, and Rc** using the System allocator as part of the Allocators 1.0 test coverage work. What’s included: - Added tests/ui/allocator/try-clone-from-ref-in.rs - Tested fallible cloning from references for **&str** and **&[i32]** slices with Box, **Arc,** and **Rc** - Verified feature gate handling (#![feature(clone_from_ref)]) - Ran `./x.py test tests/ui/allocator/try-clone-from-ref-in.rs` locally and the test passed.
…ocator-docs, r=nia-e Document allocator swap in BinaryHeap::append Added comments to be more specific about swap which occurs when `self` has fewer elements than `other`. Swap also swaps allocators leading to drop of `self` dropping the allocator that originally belonged to `other` and vice versa. The docs had no mention regarding this. Felt anyone using custom allocators should have this clarified. Issue origin: [rust-lang#32526](rust-lang#32526) Implemented in: [rust-lang#32987](rust-lang#32987)
Impl read_le/read_be for f16 and f128 Implements read_le/read_be (tracked by rust-lang#156984) for f16 and f128 (tracked by rust-lang#116909)
…clarfonthey Add `Discriminant::ord` ACP: rust-lang/libs-team#925 Tracking Issue: rust-lang#165438 Alternative To: rust-lang#164231 This is an implementation for Option 2 from rust-lang#165438. This provides a new method `Discriminant::ord` which returns a new type, `DiscriminantOrd`, suitable for key comparison. This follows a philosophy similar to that of `Path::display` for providing functional through standard traits gated behind a wrapper. I've elected for the return type of `Discriminant::ord` to be named as was requested during the T-Libs meeting proposing this option, and I've chosen to implement all traits currently implemented by `Discriminant`, this could be reduced. In comparison to rust-lang#164231, this has the advantage of allowing the storage of the discriminant in a structure and the deriving a `Partial/Ord` implementation. # Notes * No AI tooling of any kind was used during the creation of this PR. * Chose the name `ord` as that appeared to be the generally preferred option, but alternatives may include `unstable_ord`, etc.
Corresponding libc PR: rust-lang/libc#5555 pollfd has some extra internal fields on NuttX, so we use mem::zeroed() to initialze.
windows OpenOptionsExt examples: replace winapi by windows crate The winapi crate is unmaintained.
std: Fix build for the L4Re targets Since L4Re currently has no openat support, the dir module used in the metadata function is not available to use.
…maxdexh Add BTreeMap::allocator and BTreeSet::allocator Added an api extension `BTreeMap::allocator` the same way `Vec`, `VecDeque` and `BinaryHeap` have it. Tracking issue [rust-lang#163177](rust-lang#163177) Using a custom allocator with `BTreeMap<K, V, A>` currently needs both `btreemap_alloc` and `allocator_ext`. Should `btreemap_alloc` be folded into `allocator_ext`? r? @nia-e
…s, r=workingjubilee Don't "exit" using `panic` on teeos Fixes rust-lang#162847 On teeos, calling `exit` is not expected. There is also no `main` to implicitly exit, as the target exclusively uses dylibs. Currently, calling `std::process::exit` on `teeos` calls `cleanup`, which calls `unimplemented`. It doesn't make sense to "fail" to exit this way, as it just calls the user-controlled panic hook, which may keep the program alive for longer. This PR makes it abort instead.
Rollup of 15 pull requests Successful merges: - rust-lang#163477 (Fancy paramenv accessors that communicate the access pattern better.) - rust-lang#160593 (turn ABI-controlling target features into a target modifier) - rust-lang#164896 (offload: pass the linked device image to the host pass) - rust-lang#165468 (Remove return type from `BuilderMethods::store`) - rust-lang#164564 (Re-enable outline-atomics by default on more AArch64 platforms) - rust-lang#164623 (add next-solver regression tests for two fixed ices) - rust-lang#164653 (Deprecate internal function `vec::from_elem`) - rust-lang#164678 (add next-solver regression test for recursive opaque ICE under validate-mir) - rust-lang#165387 (windows OpenOptionsExt examples: replace winapi by windows crate) - rust-lang#165429 (Add tests for `-Zcrate-attr` edition and position) - rust-lang#165430 ([tiny] Show context for found assoc item in E0107) - rust-lang#165456 (std: Fix build for the L4Re targets) - rust-lang#165463 (Add BTreeMap::allocator and BTreeSet::allocator) - rust-lang#165466 (Don't "exit" using `panic` on teeos) - rust-lang#165491 (Remove unused compiler types and associated helpers)
… faster than Vec::retain_mut
Mostly configures out unused code but also reenabled DirEntry::file_type which now builds for the L4Re targets.
Signed-off-by: Xubai Wang <xubaiwwj@gmail.com>
… `cfg!(debug_assertions)` * use `cfg!(overflow_checks)` in `overflow_checks` intrinsic instead of `cfg!(debug_assertions)` * add missing `cfg_overflow_checks` feature
The current implementation just includes the encoded flags. Add a custom
implementation that prints all the specifiers. Sample for
`"{my_item:x<+0123.456X?}"`:
FormattingOptions {
align: Some(Left),
alternate: false,
debug_as_hex: Some(Upper),
fill: 'x',
precision: Some(456),
sign: Some(Plus),
sign_aware_zero_pad: true,
width: Some(123),
specifier: "x<+0123.456X",
}
* add t/u/lint/duplicated-parameter-names.rs * warn on duplicate parameter names in trait and extern functions * add check_generics_args to EarlyLintPass `walk_generic_args` exists in `ast_visit`, so i'm assuming it was forgotten in `EarlyLintPass` * warn on duplicate parameter names in parenthesized generic args * warn on duplicate parameter names in function pointers * update tests for duplicated_parameter_names * test that duplicated-parameter-names does not warn on patterns patterns are already disallowed on both functions without body, fn pts, and parenthesized generic arguments, so there should be no warning on them * use normalize_to_macro_rules rather than name for idents * rename type in test * add missing compile_fail to duplicate_parameter_names * apply requested changes from review * fix ci and use param.is_self() * add test case for duplicated underscore not linting
std: also mark doctests with skip_unsupported_miri_tests This lets us run most std doctests in Miri. I was hoping we could avoid having to touch individual doctests, but doing this on the module level does not seem possible (rust-lang#166279). Turns out most of the affected tests in `process` already are skipped in some configurations, Miri is just joining the party. try-job: test-x86_64-gnu-aux r? @maxdexh
…omcc
use `cfg!(overflow_checks)` in `overflow_checks` intrinsic instead of `cfg!(debug_assertions)`
The fallback implementation of the `overflow_checks()` intrinsic is currently defined as:
```rs
#[rustc_intrinsic]
pub const fn overflow_checks() -> bool {
cfg!(debug_assertions)
}
```
This seems to be an oversight from copypasting. Its docs state:
> This eventually evaluates `cfg!(overflow_checks)`
I changed its fallback body to `cfg!(overflow_checks)`.
If this is somehow intended behavior, I'd put a comment stating that this `cfg!` is intentionally `debug_assertions` instead of `overflow_checks`.
Note: The `overflow_checks` cfg *is* currently unstable, tracked at rust-lang#111466.
Also see <https://discord.com/channels/273534239310479360/957720175619215380/1573547547379765341>.
Stabilize unchecked `nonzero_ops` The original [`nonzero_ops` feature](rust-lang#84186) was [partly stabilized](rust-lang#97547) as `nonzero_checked_ops`, leaving the `NonZero::unchecked_{add,mul}` operations feature-gated until their primitive counterparts (`{i,u}*::unchecked_{add,mul}`) were stabilized. The latter operations were (const) stabilized in 1.79, but the unchecked `NonZero` operations have stayed in limbo until now. Since there were no other objections apart from primitive stabilization in the tracking issue, I think it's fair to stabilize the unchecked nonzero methods now. Closes rust-lang#84186. ## API being stabilized ```rust impl NonZero<U> { // `U` is any unsigned integer type. pub const unsafe fn unchecked_add(self, other: U) -> Self; } impl NonZero<I> { // `I` is any integer type, signed or unsigned. pub const unsafe fn unchecked_mul(self, other: Self) -> Self; } ``` @rustbot modify labels: +T-libs
…r=Mark-Simulacrum Implement RangeIntersect on core::range types Implements `RangeIntersect` (`#![feature(range_intersect)]`) in `core::range` and removes `IntoBounds::intersect` in favor of the `(Bound<T>, Bound<T>)` impl, per ACP rust-lang/libs-team#832. Tracking issue: rust-lang#165428 r? @libs
…nce, r=Mark-Simulacrum
Deallocate with the right provenance on Windows
When run with Miri on Windows and using Tree Borrows, this program reports UB:
```rust
use std::alloc::System;
#[global_allocator]
static ALLOCATOR: System = System;
#[repr(align(32))]
struct Over(u8);
fn main() {
let b = Box::new(Over(0));
drop(b);
}
```
(this program might look a bit exotic, but it's a minimization of the libtest runtime setup code, so the execution ought to be pretty common)
```
error: Undefined Behavior: deallocation through <299> (root of the allocation) at alloc227[0x8] is forbidden
--> /home/ben/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/alloc/windows.rs:199:14
|
199 | unsafe { HeapFree(heap, 0, block.cast::<c_void>()) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Undefined Behavior occurred here
|
= help: this indicates a potential bug in the program: it performed an invalid operation, but the Tree Borrows rules it violated are still experimental
= help: see https://github.com/rust-lang/unsafe-code-guidelines/blob/master/wip/tree-borrows.md for further information
= help: the accessed tag <299> (root of the allocation) is foreign to the protected tag <380> (i.e., it is not a child)
= help: this deallocation (acting as a foreign write access) would cause the protected tag <380> (currently Reserved) to become Disabled
= help: protected tags must never be Disabled
help: the accessed tag <299> was created here
--> src/main.rs:4:19
|
3 | #[global_allocator]
| ------------------- in this attribute macro expansion
4 | static ALLOCATOR: System = System;
| ^^^^^^
help: the protected tag <380> was created here, in the initial state Reserved
--> src/main.rs:11:5
|
11 | drop(b);
| ^^^^^^^
```
The bug is that the Windows System allocator code is deallocating with a pointer which is an ancestor of the one that was passed into dealloc. So my fix here is to do a little `with_addr` dance to use the right provenance with the right address.
…Simulacrum Fix docs of alloc fn: Allocator API stabilized The documentation of the [std::alloc::alloc()](https://doc.rust-lang.org/stable/std/alloc/fn.alloc.html) function still references the "future stabilization" of the Allocator trait and the Global type, which was just stabilized in 1.000.0: > This function is expected to be deprecated in favor of the allocate method of the [Global](https://doc.rust-lang.org/stable/std/alloc/struct.Global.html) type when it and the [Allocator](https://doc.rust-lang.org/stable/std/alloc/trait.Allocator.html) trait become stable. This PR removes the part referencing stabilization or deprecation, instead simply suggesting the preferred alternative.
OpenOptions::append: clarify docs The docs are very subtly wrong when considering a situation like ```rust let mut options = OpenOptions::new(); options.write(true).append(true); options.append(false).open(...) ``` If the second line is replaced by just `options.append(true)`, that actually does make a difference. The settings are tracked independently, "append implies write" is only applied all the way at the end when `open` is called. I also adjusted the next paragraph to make it more clear in my eyes: let's say positively what it is, not negatively what it not is.
… r=Mark-Simulacrum Stop using #![no_core] in profiler_builtins This way the Sized trait can be assumed to be always present. This helps with rust-lang#164693.
…nna-kruppe
fmt: Improve `Debug` for `FormattingOptions`
The current implementation just includes the encoded flags. Add a custom implementation that prints all the specifiers. Sample for `"{my_item:x<+0123.456X?}"`:
```rust
FormattingOptions {
align: Some(Left),
alternate: false,
debug_as_hex: Some(Upper),
fill: 'x',
precision: Some(456),
sign: Some(Plus),
sign_aware_zero_pad: true,
width: Some(123),
specifier: "x<+0123.456X",
}
```
…ocs, r=Mark-Simulacrum Show slice split results for empty and singleton slices ## Motivation When using `split_first` I had an ambiguity regarding how a collection of length 1 would interact with the optional return type. This PR addresses this by updating the examples to: - use slightly nicer syntax - provide an example for a collection with many, single, and no elements.
miri subtree update Subtree update of `miri` to rust-lang/miri@7e67996. Created using https://github.com/rust-lang/josh-sync. r? @ghost
…dianne
match: Use an aggregate equality comparison for constant array/slice patterns
When every element in an array or slice pattern is a constant and there is no `..` subpattern, the match builder will now emit a single call to `PartialEq::eq` instead of comparing each element from the value one by one against the respective constant in the pattern.
This drastically reduces the number of MIR basic blocks for large constant-array matches – e.g. a 64-element `[u8; 64]` match previously generated 64 separate comparison blocks and now generates just one `PartialEq::eq` call that LLVM can lower to a `memcmp()`. The optimisation is gated on having at least two constant elements, meaning single-element arrays will still use a plain scalar comparison.
Example:
```rust
const FOO: [u8; 64] = *b"0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef";
pub fn foo(x: &[u8; 64]) -> bool {
// Before: 64 basic blocks, one per byte.
// After: a single `PartialEq::eq()` call.
matches!(x, &FOO)
}
```
Closes rust-lang#103073.
Closes rust-lang#110870.
…ames, r=JonathanBrouwer
Add lint against duplicate parameter names in fns without body
Adds a lint to warn against duplicate parameter names in functions without bodies (in traits and extern blocks); function pointers; and parenthesised generic arguments.
This behaviour is allowed due to the compiler not checking the names of parameters in these cases, but it's confusing that this is allowed. Turning a signature with duplicated parameter names into a function with a body would error, so we should be warning against it.
```rust
trait Test {
fn trait_fn(x: usize, x: usize);
//~^ WARN identifier `x` is bound more than once in this parameter list
}
unsafe extern "C" {
fn extern_fn(x: usize, x: usize);
//~^ WARN identifier `x` is bound more than once in this parameter list
}
type FnPointer = fn(x: usize, x: u64);
//~^ WARN identifier `x` is bound more than once in this parameter list
fn impl_trait(f: impl FnOnce(x: usize, x: usize)) {}
//~^ WARN identifier `x` is bound more than once in this parameter list
```
Note: a few functions in the compiler fell into this, like `_vluti4q_lane_s16_x2`, so I've also changed these.
r? JonathanBrouwer
…ges, r=RalfJung libcore: Revert some comment changes As asked [here](https://github.com/rust-lang/rust/pull/166146/changes#r4645078187). r? @RalfJung
…e, r=Mark-Simulacrum Add `#[must_use]` to `Ip*Addr::as_octets` methods This PR adds `#[must_use]` to the `IpAddr::as_octets`, `Ipv4Addr::as_octets`, and `Ipv6Addr::as_octets` methods.
…mulacrum rustc_diagnostic_item macros added on some iter functions Added `rustc_diagnostic_item` macros on some functions/methods, for future usage in code analysis in clippy's lints
…nathanBrouwer Rollup of 13 pull requests Successful merges: - rust-lang#166266 (miri subtree update) - rust-lang#155216 (match: Use an aggregate equality comparison for constant array/slice patterns) - rust-lang#166142 (Lower to `hir::Param`s for extern functions) - rust-lang#163315 (s390x: replace -Ctarget-feature=+backchain with -Cforce-frame-pointers) - rust-lang#165238 (make conflicting_repr_hints a hard error) - rust-lang#165366 (Add lint against duplicate parameter names in fns without body) - rust-lang#166269 (libcore: Revert some comment changes) - rust-lang#166287 (Use `core::ptr` in `implicit_provenance_casts` help for `no_std` crates) - rust-lang#166306 (bootstrap: Stop passing `-Ztrim-paths` to cargo now that it's stable in beta) - rust-lang#166309 (Add `#[must_use]` to `Ip*Addr::as_octets` methods) - rust-lang#166315 (rustc_diagnostic_item macros added on some iter functions) - rust-lang#166331 (Include Build IDs in VEX V5 executables) - rust-lang#166349 (compiletest: Remove some old special-case code paths)
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is an automated PR to merge library subtree updates from 2026-11-21 (rust-lang/rust@c7d5ba5) to 2026-11-23 (rust-lang/rust@137d1d4), inclusive. This is a clean merge, no conflicts were detected. Do not remove or edit the following annotations:
git-subtree-dir: library
git-subtree-split: 61c1948