Commit graph

309663 commits

Author SHA1 Message Date
MolecularPilot
ae7fa32e5b Implement clamp_magnitude for floats & signed integers
Added feature gate, documentation and tests also.
2025-12-01 17:04:25 +11:00
bors
ceb7df7e6f Auto merge of #147029 - neuschaefer:memchr-2.7.6, r=marcoieni
Update memchr to 2.7.6

memchr 2.7.6 contains a bugfix for aarch64_be.

Note: I'm not sure about how dependency updates are managed in rust.git. If something should go through another branch or will happen automatically, please let me know.
2025-11-07 21:58:38 +00:00
bors
843f8ce2eb Auto merge of #147798 - Zalathar:uutils, r=jieyouxu
ci: Switch back to default coreutils (uutils) after libffi-sys bump

Now that Miri has updated to the latest `libffi-sys`, we should be able to remove the GNU coreutils workaround, and switch back to the default coreutils (uutils) in the runners using Ubuntu 25.10 images.

If we encounter any other uutils compatibility problems in the future, they should hopefully be easier to trace back to specific changes.

- https://github.com/rust-lang/rust/pull/147581
- https://github.com/rust-lang/miri/pull/4634
- https://github.com/rust-lang/rust/pull/147744

Closes rust-lang/rust#147556.
2025-11-07 13:49:36 +00:00
bors
96064126a0 Auto merge of #147641 - cjgillot:liveness-cache-strings, r=estebank
Liveness: Cache the set of string constants for suggestions.

Even on a slow diagnostic path, listing all the constants in MIR can be expensive, so cache it.
2025-11-07 09:50:49 +00:00
bors
0bbef557bb Auto merge of #148624 - jhpratt:rollup-is5je9r, r=jhpratt
Rollup of 12 pull requests

Successful merges:

 - rust-lang/rust#145768 (Offload device)
 - rust-lang/rust#145992 (Stabilize `vec_deque_pop_if`)
 - rust-lang/rust#147416 (Early return if span is from expansion so we dont get empty span and ice later on)
 - rust-lang/rust#147808 (btree: cleanup difference, intersection, is_subset)
 - rust-lang/rust#148520 (style: Use binary literals instead of hex literals in doctests for `highest_one` and `lowest_one`)
 - rust-lang/rust#148559 (Add typo suggestion for a misspelt Cargo environment variable)
 - rust-lang/rust#148567 (Fix incorrect precedence caused by range expression)
 - rust-lang/rust#148570 (Fix mismatched brackets in generated .dir-locals.el)
 - rust-lang/rust#148575 (fix dev guide link in rustc_query_system/dep_graph/README.md)
 - rust-lang/rust#148578 (core docs: add notes about availability of `Atomic*::from_mut_slice`)
 - rust-lang/rust#148603 (Backport 1.91.1 relnotes to main)
 - rust-lang/rust#148609 (Sync str::rsplit_once example with str::split_once)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-11-07 06:42:51 +00:00
Jacob Pratt
c932d7c45f
Rollup merge of #148609 - AMDmi3:rsplit_once_example, r=chenyukang
Sync str::rsplit_once example with str::split_once

This adds `"cfg=".rsplit_once('=')` case to `rsplit_once` example, bringing it in sync with example for `split_once`. For consistency and to make life easier for ones who want to ensure bahaviour of this specific edge case.
2025-11-07 00:21:24 -05:00
Jacob Pratt
0dafd5057f
Rollup merge of #148603 - pietroalbini:ea-1.91.1-relnotes, r=pietroalbini
Backport 1.91.1 relnotes to main

Backport of the release notes from https://github.com/rust-lang/rust/pull/148593 to the main branch. This should land before Monday so that the automation creates the GitHub release.
2025-11-07 00:21:23 -05:00
Jacob Pratt
9d001902ae
Rollup merge of #148578 - WaffleLapkin:equal-alignment-atomic-from-mut-slice, r=m-ou-se
core docs: add notes about availability of `Atomic*::from_mut_slice`

See https://github.com/rust-lang/rust/issues/76314#issuecomment-3496758620

r? libs-api
2025-11-07 00:21:23 -05:00
Jacob Pratt
dff3697089
Rollup merge of #148575 - vyacheslavhere:fix-query-system-readme-link, r=chenyukang
fix dev guide link in rustc_query_system/dep_graph/README.md
2025-11-07 00:21:22 -05:00
Jacob Pratt
694ddb34d0
Rollup merge of #148570 - TomFryersMidsummer:dir-locals, r=chenyukang
Fix mismatched brackets in generated .dir-locals.el

This caused Emacs to throw errors when opening files.

Introduced in 3fe3edbcde.
2025-11-07 00:21:21 -05:00
Jacob Pratt
3f1bce5219
Rollup merge of #148567 - chenyukang:yukang-fix-148344-incorrect-precedence, r=hkBst,Kivooeo
Fix incorrect precedence caused by range expression

Fixes rust-lang/rust#148344
The testcase `tests/ui/feature-gates/feature-gate-new_range` is also fixed.
2025-11-07 00:21:21 -05:00
Jacob Pratt
3186f21a8b
Rollup merge of #148559 - chenyukang:yukang-fix-148439-env, r=Kivooeo
Add typo suggestion for a misspelt Cargo environment variable

Fixes rust-lang/rust#148439
2025-11-07 00:21:20 -05:00
Jacob Pratt
3d765e3788
Rollup merge of #148520 - sorairolake:update-lowest-highest-one-doctests, r=tgross35
style: Use binary literals instead of hex literals in doctests for `highest_one` and `lowest_one`

For example, I think it's easier to understand that the index of the highest bit set to one in `16` is `4` as `0b10000` than as `0x10`.

```rust
assert_eq!(0x10_u64.highest_one(), Some(4));
```

Instead of:

```rust
assert_eq!(0b10000_u64.highest_one(), Some(4));
```

rust-lang/rust#145203
2025-11-07 00:21:19 -05:00
Jacob Pratt
4ad5a39183
Rollup merge of #147808 - hkBst:btree-3, r=joboet
btree: cleanup difference, intersection, is_subset
2025-11-07 00:21:19 -05:00
Jacob Pratt
7af1ee3556
Rollup merge of #147416 - Kivooeo:ice-fix23456, r=fmease
Early return if span is from expansion so we dont get empty span and ice later on

Fixes https://github.com/rust-lang/rust/issues/147255

The problem original was from that stmt.span was from expansion and it span was bigger than right part which is block.span, so it causes empty span and panic later on, I decided to add checks for both of them to be on the safe side

r? `@fmease` (you were in discussion on this issue so I decided to assign you, feel free to reroll)
2025-11-07 00:21:18 -05:00
Jacob Pratt
47eeb00a63
Rollup merge of #145992 - GrigorenkoPV:stabilize/vec_deque_pop_if, r=Amanieu
Stabilize `vec_deque_pop_if`

Tracking issue: rust-lang/rust#135889
Closes rust-lang/rust#135889
Also fixes a typo mentioned in https://github.com/rust-lang/rust/issues/135889#issuecomment-2991213248

FCP: https://github.com/rust-lang/rust/issues/135889#issuecomment-3238777731

`@rustbot` label -T-libs +T-libs-api +needs-fcp +S-waiting-on-fcp

r? t-libs-api
2025-11-07 00:21:17 -05:00
Jacob Pratt
c63793952e
Rollup merge of #145768 - ZuseZ4:offload-device, r=oli-obk
Offload device

LLVM's offload functionality usually expects an extra dyn_ptr argument. We could avoid it,b ut likely gonna need it very soon in one of the follow-up PRs (e.g. to request shared memory). So we might as well already add it.

This PR adds a %dyn_ptr ptr to GPUKernel ABI functions, if the offload feature is enabled.

WIP

r? ```@ghost```
2025-11-07 00:21:17 -05:00
Kivooeo
62ccf14c14 add check if macro from expansion 2025-11-06 22:42:10 +00:00
Dmitry Marakasov
b975c570fa Sync str::rsplit_once example with str::split_once 2025-11-07 01:01:54 +03:00
Emily Albini
eec36b390e update release notes 2025-11-06 20:24:37 +01:00
yukang
3edd25f049 Add typo suggestion for a misspelt Cargo environment variable 2025-11-06 23:10:39 +08:00
bors
c90bcb9571 Auto merge of #148573 - matthiaskrgr:rollup-cn5viia, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - rust-lang/rust#146861 (add extend_front to VecDeque with specialization like extend)
 - rust-lang/rust#148213 (Fix invalid tag closing when leaving expansion "original code")
 - rust-lang/rust#148292 (Un-shadow object bound candidate in `NormalizesTo` goal if self_ty is trait object)
 - rust-lang/rust#148528 (run-make tests: use edition 2024)
 - rust-lang/rust#148554 (Add regression test for issue 148542)
 - rust-lang/rust#148561 (Fix ICE from async closure variance)
 - rust-lang/rust#148563 (rustdoc-search: remove broken index special case)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-11-06 14:52:37 +00:00
Waffle Lapkin
893f0d2cff
core docs: add notes about availability of Atomic*::from_mut_slice 2025-11-06 15:23:11 +01:00
Vyacheslav
e77e5d1bc1
fix dev guide link in rustc_query_system/dep_graph/README.MD 2025-11-06 17:17:03 +05:00
bors
c5e283b0d2 Auto merge of #148188 - Muscraft:annotate-snippets-default-on-nightly, r=estebank
feat: Use annotate-snippets by default on nightly

This PR switches the default renderer to use `annotate-snippets` on nightly, but does not affect stable. This is part of the ongoing effort to use `annotate-snippets` to render all diagnostics.

[MCP](https://github.com/rust-lang/compiler-team/issues/937)

Note: This contains the test change from rust-lang/rust#148004, without the change to the default emitter.

rust-lang/rust#59346
rust-lang/rust-project-goals#123

r? `@davidtwco`
2025-11-06 11:45:06 +00:00
Tom Fryers
72cec248e8
Fix mismatched brackets in generated .dir-locals.el
This caused Emacs to throw errors when opening files.

Introduced in 3fe3edbcde.
2025-11-06 11:39:46 +00:00
Matthias Krüger
1a6770c5c4
Rollup merge of #148563 - notriddle:index-typedata-bug, r=GuillaumeGomez
rustdoc-search: remove broken index special case

Fixes https://github.com/rust-lang/rust/issues/148431
2025-11-06 12:30:01 +01:00
Matthias Krüger
76dae76146
Rollup merge of #148561 - chenyukang:yukang-fix-148488, r=lqd
Fix ICE from async closure variance

Fixes rust-lang/rust#148488

The fix is also a change from rust-lang/rust#148556
2025-11-06 12:30:00 +01:00
Matthias Krüger
a3409fde47
Rollup merge of #148554 - chenyukang:test-issue-148542, r=jieyouxu
Add regression test for issue 148542

Closes rust-lang/rust#148542
2025-11-06 12:30:00 +01:00
Matthias Krüger
320af6b789
Rollup merge of #148528 - hkBst:run-make-tests-1, r=jieyouxu
run-make tests: use edition 2024

Bump run-make tests to edition 2024 to prevent test failures when using 2024 idioms in included code, such as I ran into here: https://github.com/rust-lang/rust/pull/147808.
2025-11-06 12:29:59 +01:00
Matthias Krüger
fc318986f3
Rollup merge of #148292 - adwinwhite:assemble_object_candidate, r=lcnr
Un-shadow object bound candidate in `NormalizesTo` goal if self_ty is trait object

Fixes https://github.com/rust-lang/trait-system-refactor-initiative/issues/244

r? lcnr
2025-11-06 12:29:58 +01:00
Matthias Krüger
7b766e026a
Rollup merge of #148213 - GuillaumeGomez:fix-exit-of-expansion, r=yotamofek
Fix invalid tag closing when leaving expansion "original code"

Fixes rust-lang/rust#148184.

Problem was that in case an element inside the expansion's "original" element was not closed, this element would get its `pending_exit` field set to `true`, removing it when the next non-mergeable item gets pushed instead of being put inside it, and then next `exit_elem` would try to exit an empty class queue.

r? ```@notriddle```
2025-11-06 12:29:58 +01:00
Matthias Krüger
f7f128fd48
Rollup merge of #146861 - antonilol:vec_deque_extend_front, r=joboet
add extend_front to VecDeque with specialization like extend

ACP: https://github.com/rust-lang/libs-team/issues/658
Tracking issue: rust-lang/rust#146975

_Text below was written before opening the ACP_

Feature was requested in rust-lang/rust#69939, I recently also needed it so decided to implement it as my first contribution to the Rust standard library. I plan on doing more but wanted to start with a small change.

Some questions I had (both on implementation and design) with answers:
- Q: `extend` allows iterators that yield `&T` where `T` is `Clone`, should extend_front do too?
  A: No, users can use [`copied`](https://doc.rust-lang.org/std/iter/trait.Iterator.html#method.copied) and/or [`cloned`](https://doc.rust-lang.org/std/iter/trait.Iterator.html#method.cloned).
- Q: Does this need a whole new trait like Extend or only a method on `VecDeque`?
  A: No, see ACP.
- Q: How do I deal with all the code duplication? Most code is similar to that of `extend`, maybe there is a nice way to factor out the code around `push_unchecked`/`push_front_unchecked`.
  Will come back to this later.
- Q: Why are certain things behind feature gates, `cfg(not(test))` like `vec::IntoIter` here and `cfg(not(no_global_oom_handling))` like `Vec::extend_from_within`? (I am also looking at implementing `VecDeque::extend_from_within`)
  A: See https://github.com/rust-lang/rust/pull/146861#pullrequestreview-3250163369
- Q: Should `extend_front` act like repeated pushes to the front of the queue? This reverses the order of the elements. Doing it different might incur an extra move if the iterator length is not known up front (where do you start placing elements in the buffer?).
  A: `extend_front` acts like repeated pushes, `prepend` preserves the element order, see ACP or tracking issue.
2025-11-06 12:29:57 +01:00
Shun Sakai
d956fa10ce style: Update doctests for highest_one and lowest_one
Use binary literals instead of hex literals.
2025-11-06 20:07:47 +09:00
yukang
ff5440e3fa Fix incorrect precedence caused by range expression 2025-11-06 17:34:48 +08:00
bors
642c19bfc3 Auto merge of #148560 - Zalathar:rollup-c62przo, r=Zalathar
Rollup of 7 pull requests

Successful merges:

 - rust-lang/rust#143037 (Make named asm_labels lint not trigger on hexagon register spans)
 - rust-lang/rust#147043 (Add default sanitizers to TargetOptions)
 - rust-lang/rust#147586 (std-detect: improve detect macro docs)
 - rust-lang/rust#147912 ([rustdoc] Gracefully handle error in case we cannot run the compiler in doctests)
 - rust-lang/rust#148540 (Minor fixes to StdNonZeroNumberProvider for gdb)
 - rust-lang/rust#148541 (Add num_children method to some gdb pretty-printers)
 - rust-lang/rust#148549 (Fix broken qemu-cskyv2 link)

Failed merges:

 - rust-lang/rust#147935 (Add LLVM realtime sanitizer)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-11-06 08:39:07 +00:00
Manuel Drehwald
360b38cceb Fix device code generation, to account for an implicit dyn_ptr argument. 2025-11-06 03:34:38 -05:00
Michael Howell
c8b2a9af2b rustdoc-search: remove broken index special case 2025-11-05 23:41:43 -07:00
yukang
a9795db068 Fix ICE from async closure variance 2025-11-06 11:18:38 +08:00
Stuart Cook
7c58e15300
Rollup merge of #148549 - ehuss:fix-csky-link, r=Kivooeo
Fix broken qemu-cskyv2 link

The link had a stray character that generated an invalid link.
2025-11-06 14:07:19 +11:00
Stuart Cook
8e7417ceb2
Rollup merge of #148541 - tromey:add-num-children, r=bjorn3
Add num_children method to some gdb pretty-printers

gdb doesn't have a way to know when an object hasn't yet been initialized, and in this case, if a pretty-printer returns an absurd number of children, this can result in apparent hangs in some modes. This came up specifically with DAP, see this bug report:

    https://sourceware.org/bugzilla/show_bug.cgi?id=33594

This patch (mostly) addresses this potential issue in the Rust pretty-printers, by adding 'num_children' methods.  In particular a method like this is added when the number of children is variable and also relatively easy to compute.  (I.e., I didn't attempt the btree printers.)

Supplying num_children is good for DAP regardless of the initialization problem, because DAP requires a count of child objects and this is more efficient than enumerating the children, which is gdb's fallback approach.
2025-11-06 14:07:18 +11:00
Stuart Cook
2d77f23f0b
Rollup merge of #148540 - tromey:non-zero-gdb-cleanup, r=bjorn3
Minor fixes to StdNonZeroNumberProvider for gdb

While looking at the pretty-printers, I found a few minor oddities in StdNonZeroNumberProvider.

First, gdb.Type.fields() already returns a sequence, so there's no need to call list().

Second, it's more idiomatic for the (somewhat misnamed) to_string method to simply return the underlying gdb.Value.  This also lets gdb apply whatever formats were passed to `print`, as the new test shows.

Third, there's no need to use the field's name when looking up a field in a value, the gdb.Field itself can be used.
2025-11-06 14:07:18 +11:00
Stuart Cook
dd803610f0
Rollup merge of #147912 - GuillaumeGomez:graceful-doctest-error-handling, r=lolbinarycat
[rustdoc] Gracefully handle error in case we cannot run the compiler in doctests

Fixes bug reported in [this comment](https://github.com/rust-lang/rust/issues/102981#issuecomment-3407855923).

r? ``@lolbinarycat``
2025-11-06 14:07:17 +11:00
Stuart Cook
c9ca719218
Rollup merge of #147586 - folkertdev:std-detect-expands-to-true, r=Amanieu
std-detect: improve detect macro docs

Specifically, document that the detect macros expand to `true` when the feature is statically enabled.

Now that we have a bunch of these macros, perhaps we should streamline further how they are documented?

r? ``@Amanieu``
2025-11-06 14:07:16 +11:00
Stuart Cook
efdc8aca3e
Rollup merge of #147043 - ilovepi:default-sanitizers, r=petrochenkov
Add default sanitizers to TargetOptions

Some sanitizers are part of a system's ABI, like the shadow call stack on Aarch64 and RISC-V Fuchsia. Typically ABI options have other spellings, but LLVM has, for historical reasons, marked this as a sanitizer instead of an alternate ABI option. As a result, Fuchsia targets may not be compiled against the correct ABI unless this option is set. This hasn't caused correctness problems, since the backend reserves the SCS register, and thus preserves its value. But this is an issue for unwinding, as the SCS will not be an array of PCs describing the call complete call chain, and will have gaps from callers that don't use the correct ABI.

In the long term, I'd like to see all the sanitizer configs that all frontends copy from clang moved into llvm's libFrontend, and exposed so that frontend consumers can use a small set of simple APIs to use sanitizers in a consistent way across the LLVM ecosystem, but that work is not yet ready today.
2025-11-06 14:07:16 +11:00
Stuart Cook
12deb2f513
Rollup merge of #143037 - androm3da:bcain/hexagon_regspan_label, r=Amanieu
Make named asm_labels lint not trigger on hexagon register spans

Fixes https://github.com/rust-lang/rust/issues/143021
2025-11-06 14:07:15 +11:00
Brian Cain
54df8dae29 CI fixes after recent rebase changes 2025-11-05 19:43:29 -06:00
yukang
55b0125d16 Add regression test for ice 2025-11-06 09:41:16 +08:00
Eric Huss
0717a3929f Fix broken qemu-cskyv2 link
The link had a stray character that generated an invalid link.
2025-11-05 14:37:38 -08:00
Brian Cain
71e599b91a Make named asm_labels lint not trigger on hexagon register spans 2025-11-05 16:24:30 -06:00