Commit graph

312332 commits

Author SHA1 Message Date
Matthias Krüger
02434fe718
Rollup merge of #148678 - xonx4l:EO412_replacement_with_EO425, r=Kivooeo
Merge E0412 into E0425

This PR merge E0412 into E0425  as both mean the same thing to users.

This fixes https://github.com/rust-lang/rust/issues/148558.
2025-12-02 22:02:30 +01:00
Matthias Krüger
9955b04971
Rollup merge of #148250 - hkBst:array-chunks-docs, r=joboet
array_chunks: slightly improve docs
2025-12-02 22:02:29 +01:00
Matthias Krüger
38d5d2877e
Rollup merge of #146436 - hkBst:slice-iter-1, r=joboet
Slice iter cleanup
2025-12-02 22:02:28 +01:00
xonx4l
4b000cfacd Merge E0412 into E0425 2025-12-02 18:25:13 +00:00
bors
646a3f8c15 Auto merge of #149125 - zachs18:btreemap-eq-perf, r=workingjubilee
In `BTreeMap::eq`, do not compare the elements if the sizes are different.

Reverts rust-lang/rust#147101 in library/alloc/src/btree/

rust-lang/rust#147101 replaced some instances of code like `a.len() == b.len() && a.iter().eq(&b)` with just `a.iter().eq(&b)`, but the optimization that PR introduced only applies for `TrustedLen` iterators, and `BTreeMap`'s itertors are not `TrustedLen`, so this theoretically regressed perf for comparing large `BTreeMap`/`BTreeSet`s with unequal lengths but equal prefixes, (and also made it so that comparing two different-length `BTreeMap`/`BTreeSet`s with elements whose `PartialEq` impls that can panic now can panic, though this is not a "promised" behaviour either way (cc rust-lang/rust#149122))

Given that `TrustedLen` is an unsafe trait, I opted to not implement it for `BTreeMap`'s iterators, and instead just revert the change. If someone else wants to audit `BTreeMap`'s iterators to make sure they always return the right number of items (even in the face of incorrect user `Ord` impls) and then implement `TrustedLen` for them so that the optimization works for them, then this can be closed in favor of that (or if the perf regression is deemed too theoretical, this can be closed outright).

Example of theoretical perf regression: https://play.rust-lang.org/?version=beta&mode=release&edition=2024&gist=a37e3d61e6bf02669b251315c9a44fe2 (very rough estimates, using `Instant::elapsed`).
In release mode on stable the comparison takes ~23.68µs.
In release mode on beta/nightly the comparison takes ~48.351057ms.
2025-12-02 17:04:58 +00:00
bors
eca9d93f90 Auto merge of #149529 - Muscraft:update-annotate-snippets, r=jieyouxu
chore: Update annotate-snippets to 0.12.10

This PR updates `annotate-snippets` to `0.12.10`, which [includes a fix](756366223c/CHANGELOG.md (fixed)) that modifies some test output.
2025-12-02 13:55:16 +00:00
bors
a80d39a086 Auto merge of #149504 - mati865:i686-pc-windows-gnullvm, r=jieyouxu
Bring back i686-pc-windows-gnullvm target

rust-lang/rust#148751 inadvertently removed i686-pc-windows-gnullvm std build when migrating to native CI runners. Since this change was not agreed upon, we should bring back prebuilt std builds for that target.

There are a few runners that could do it: dist-aarch64-llvm-mingw, dist-x86_64-llvm-mingw, dist-various-1 and dist-various-2.
dist-x86_64-llvm-mingw already takes slightly over 2 hours, so the faster dist-aarch64-llvm-mingw is a better choice.
We can also use dist-various-x job, they don't have llvm-mingw toolchain, but it's trivial to install one.
2025-12-02 10:42:35 +00:00
bors
47cd7120d9 Auto merge of #147634 - fmease:mv-var-to-dyn-buf-lints-next, r=jdonszelmann
Move even more early buffered lints to dyn lint diagnostics

Follow-up to https://github.com/rust-lang/rust/pull/145881 and https://github.com/rust-lang/rust/pull/145747.

I originally wanted to migrate most if not the entire rest of the early buffered lints. However, when trying to migrate the buffered lints used by check-cfg I encountered a roadblock. Namely, it depends on `TyCtxt` (well, `Option<TyCtxt>`) which makes it quite hard to migrate (see also https://github.com/rust-lang/rust/pull/147634#issuecomment-3398174584, https://github.com/rust-lang/rust/pull/147634#issuecomment-3398207128 & rust-lang/rust#149215).

So for now, I won't migrate it (maybe rust-lang/rust#149215 will find a solution), nor will I migrate the rest since it's quite tedious to migrate these. I'll leave them for future me.
2025-12-02 07:33:36 +00:00
bors
63b1db0580 Auto merge of #149531 - Zalathar:rollup-15y580s, r=Zalathar
Rollup of 8 pull requests

Successful merges:

 - rust-lang/rust#145628 ([std][BTree] Fix behavior of `::append` to match documentation, `::insert`, and `::extend`)
 - rust-lang/rust#149241 (Fix armv4t- and armv5te- bare metal targets)
 - rust-lang/rust#149470 (compiletest: Prepare ignore/only conditions once in advance, without a macro)
 - rust-lang/rust#149507 (Mark windows-gnu* as lacking build with assertions)
 - rust-lang/rust#149508 (Prefer helper functions to identify MinGW targets)
 - rust-lang/rust#149516 (Stop adding MSYS2 to PATH)
 - rust-lang/rust#149525 (debuginfo/macro-stepping test: extend comments)
 - rust-lang/rust#149526 (Add myself (mati865) to the review rotation)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-12-02 04:23:39 +00:00
Stuart Cook
e168509186
Rollup merge of #149526 - mati865:mati865-review-rotation, r=Kivooeo
Add myself (mati865) to the review rotation

I've been procrastinating long enough.
2025-12-02 13:56:33 +11:00
Stuart Cook
cd6c17ea89
Rollup merge of #149525 - RalfJung:debuginfo-test-comments, r=jieyouxu
debuginfo/macro-stepping test: extend comments

Those `#locN` markers look like they are debuginfo compiletest magic (since `#break` is debuginfo compiletest magic). However, they are actually just magic strings used by the `check` commands in the test itself. This threw me off when I looked at the test (prompted by a CI failure), so let's leave a comment for the next poor soul that ends up lost in this test.

Also, for some reason the lldb instructions do not check for `#loc6`, unlike the gdb instructions. I do not know of an lldb version that actually makes the test pass (do we even run it with lldb at all on CI?), so I won't try to add a check for loc6, but let's at least add a comment to increase the chance that someone more knowledgeable about lldb and our test suite notices this in the future.
2025-12-02 13:56:32 +11:00
Stuart Cook
5afd8ff8df
Rollup merge of #149516 - mati865:no-msys2, r=jieyouxu
Stop adding MSYS2 to PATH

Rust no longer requires MSYS2 provided tools like make.
2025-12-02 13:56:32 +11:00
Stuart Cook
7cb02f9752
Rollup merge of #149508 - mati865:mingw-helpers, r=jieyouxu
Prefer helper functions to identify MinGW targets
2025-12-02 13:56:31 +11:00
Stuart Cook
7437db72a8
Rollup merge of #149507 - mati865:windows-gnu-like-no-asserts, r=clubby789
Mark windows-gnu* as lacking build with assertions

Knowing that `x86_64-pc-windows-gnu` has no builds with assertions, I have just copied it as `x86_64-pc-windows-gnullvm` and called a day. Obviously it should have been `false`, sorry for that.
While at it, also fix `x86_64-pc-windows-gnu`.
2025-12-02 13:56:31 +11:00
Stuart Cook
bbde1c0825
Rollup merge of #149470 - Zalathar:prepared-conditions, r=jieyouxu
compiletest: Prepare ignore/only conditions once in advance, without a macro

Compiletest has historically handled `ignore-*` and `only-*` directives in an extremely confusing way that makes the code hard to understand and hard to modify.

This PR therefore takes an important step away from that older design by instead evaluating a set of named boolean "conditions" in advance, and then using those conditions to help determine whether a particular directive should cause its test to be ignored or not.

As usual, there's more cleanup that I want to do here, but I've left most of it for future work to help keep this PR manageable.

r? jieyouxu
2025-12-02 13:56:30 +11:00
Stuart Cook
c539f3ffe1
Rollup merge of #149241 - thejpster:fix-armv4t-armv5te-bare-metal, r=davidtwco
Fix armv4t- and armv5te- bare metal targets

These two targets currently force on the LLVM feature `+atomics-32`. LLVM doesn't appear to actually be able to emit 32-bit load/store atomics for these targets despite this feature, and emits calls to a shim function called `__sync_lock_test_and_set_4`, which nothing in the Rust standard library supplies.

See [#t-compiler/arm > __sync_lock_test_and_set_4 on Armv5TE](https://rust-lang.zulipchat.com/#narrow/channel/242906-t-compiler.2Farm/topic/__sync_lock_test_and_set_4.20on.20Armv5TE/with/553724827) for more details.

Experimenting with clang and gcc (as logged in that zulip thread) shows that C code cannot do atomic load/stores on that architecture either (at least, not without a library call inserted).

So, the safest thing to do is probably turn off `+atomics-32` for these two Tier 3 targets.

I asked `@Lokathor` and he said he didn't even use atomics on the `armv4t-none-eabi`/`thumbv4t-none-eabi` target he maintains.

I was unable to reach `@QuinnPainter` for comment for `armv5te-none-eabi`/`thumbv5te-none-eabi`.

The second commit renames the base target spec `spec::base::thumb` to `spec::base::arm_none` and changes `armv4t-none-eabi`/`thumbv4t-none-eabi` and `armv5te-none-eabi`/`thumbv5te-none-eabi` to use it. This harmonises the frame-pointer and linker options across the bare-metal Arm EABI and EABIHF targets.

You could make an argument for harmonising `armv7a-none-*`, `armv7r-none*` and `armv8r-none-*` as well, but that can be another PR.
2025-12-02 13:56:30 +11:00
Stuart Cook
dbb92adfc1
Rollup merge of #145628 - tinnamchoi:fix-btree-append, r=Amanieu
[std][BTree] Fix behavior of `::append` to match documentation, `::insert`, and `::extend`

Resolves rust-lang/rust#145614
2025-12-02 13:56:29 +11:00
Scott Schafer
b2b059c20b
chore: Update annotate-snippets to 0.12.10 2025-12-01 18:12:35 -07:00
bors
4ad239f415 Auto merge of #142821 - cjgillot:jump-threading-single, r=saethlin
Compute jump threading opportunities in a single pass

The current implementation of jump threading walks MIR CFG backwards from each `SwitchInt` terminator. This PR replaces this by a single postorder traversal of MIR. In theory, we could do a full fixpoint dataflow analysis, but this has low returns as we forbid threading through a loop header.

The second commit in this PR modifies the carried state to a lighter data structure. The current implementation uses some kind of `IndexVec<ValueIndex, &[Condition]>`. This is needlessly heavy, as the state rarely ever carries more than a few `Condition`s. The first commit replaces this state with a simpler `&[Condition]`, and puts the corresponding `ValueIndex` inside `Condition`.

The three later commits are perf tweaks.

The sixth commit is the main change. Instead of carrying the goto target inside the condition, we maintain a set of conditions associated with each block, and their consequences in following blocks. Think: if this condition is fulfilled in this block, then that condition is fulfilled in that block. This makes the threading algorithm much easier to implement, without the extra bookkeeping of `ThreadingOpportunity` we had.

Later commits modify that algorithm to shrink the set of duplicated blocks. By propagating fulfilled conditions down the CFG, and trimming costly threads.
2025-12-01 23:44:49 +00:00
Mateusz Mikuła
5c282908be
Add myself (mati865) to the review rotation
I've been procrastinating long enough.
2025-12-01 22:46:13 +01:00
Ralf Jung
18af84b138 debuginfo/macro-stepping test: extend comments 2025-12-01 22:32:36 +01:00
bors
1d60f9e070 Auto merge of #149515 - matthiaskrgr:rollup-djmciuc, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - rust-lang/rust#149393 (expand valid edition range for use-path-segment-kw.rs)
 - rust-lang/rust#149427 (Make the capitalization explicit on keyword misspell error)
 - rust-lang/rust#149433 (Use a delayed bug for this layout ICE)
 - rust-lang/rust#149473 (Tidying up UI tests [7/N])
 - rust-lang/rust#149505 (Update the comment in the add_typo_suggestion function)
 - rust-lang/rust#149513 (`rust-analyzer` subtree update)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-12-01 20:29:33 +00:00
Mateusz Mikuła
dc61415746 Prefer helper functions to identify MinGW targets 2025-12-01 19:12:00 +01:00
Mateusz Mikuła
662192a878 Stop adding MSYS2 to PATH
Rust no longer requires MSYS2 tools like make.
2025-12-01 18:37:33 +01:00
Matthias Krüger
c99912df44
Rollup merge of #149513 - lnicola:sync-from-ra, r=lnicola
`rust-analyzer` subtree update

Subtree update of `rust-analyzer` to f25db5500b.

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

r? `@ghost`

Last one for now...
2025-12-01 18:35:13 +01:00
Matthias Krüger
453fca50ef
Rollup merge of #149505 - reddevilmidzy:fix, r=WaffleLapkin
Update the comment in the add_typo_suggestion function

This comment was added to 089810a1cb. However, the test for the comment was moved elsewhere in https://github.com/rust-lang/rust/pull/145897.
2025-12-01 18:35:12 +01:00
Matthias Krüger
c91942bcb6
Rollup merge of #149473 - reddevilmidzy:t7, r=Kivooeo
Tidying up UI 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

removed directory  `tests/ui/explicit`,  `tests/ui/interior-mutability`, `tests/ui/invalid-module-declaration`, tests/ui/invalid-self-argument`

r? Kivooeo
2025-12-01 18:35:12 +01:00
Matthias Krüger
ab2cdfc884
Rollup merge of #149433 - scottmcm:delay-layout-ICEs, r=jdonszelmann
Use a delayed bug for this layout ICE

Fixes rust-lang/rust#144501
cc `@matthiaskrgr`
2025-12-01 18:35:11 +01:00
Matthias Krüger
14da32fcf1
Rollup merge of #149427 - scrabsha:push-rxkwyumxrrtu, r=jdonszelmann
Make the capitalization explicit on keyword misspell error

Will help for https://github.com/rust-lang/rust/pull/149405.
2025-12-01 18:35:10 +01:00
Matthias Krüger
9d829acb42
Rollup merge of #149393 - tshepang:patch-3, r=davidtwco
expand valid edition range for use-path-segment-kw.rs
2025-12-01 18:35:10 +01:00
bors
a463b0e2ee Auto merge of #149510 - matthiaskrgr:rollup-5rt6o7z, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - rust-lang/rust#148690 (Implement `clamp_magnitude` method for primitive floats & signed integers)
 - rust-lang/rust#149102 (stabilize maybe_uninit_slice)
 - rust-lang/rust#149269 (cmse: do not calculate the layout of a type with infer types)
 - rust-lang/rust#149299 (Fudge infer vars in the cause code of `Obligation` intentionally)
 - rust-lang/rust#149344 (Don't suggest unwrap for Result in const)
 - rust-lang/rust#149358 (fix(parse): Limit frontmatter fences to 255 dashes )
 - rust-lang/rust#149445 (make assoc fn inherit const stability from inherent `const impl` blocks)
 - rust-lang/rust#149479 (Fix indent in E0591.md)
 - rust-lang/rust#149496 (Fix rust-lang/rust#148889: Add label rib when visiting delegation body)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-12-01 17:16:50 +00:00
Matthias Krüger
e0091c5590
Rollup merge of #149496 - aerooneqq:ice-issue-148889, r=petrochenkov
Fix #148889: Add label rib when visiting delegation body

This PR relates to the delegation feature rust-lang/rust#118212, it fixes rust-lang/rust#148889 ICE.
r? `@petrochenkov`
2025-12-01 17:55:12 +01:00
Matthias Krüger
6900946597
Rollup merge of #149479 - reddevilmidzy:E0591, r=chenyukang
Fix indent in E0591.md

It currently looks like this.

<img width="1389" height="595" alt="image" src="https://github.com/user-attachments/assets/5336eebd-42a6-43c6-9127-9278cd82a9c2" />

https://doc.rust-lang.org/nightly/error_codes/E0591.html

So I can't run it, and the copied code has `#` in front.
2025-12-01 17:55:12 +01:00
Matthias Krüger
b0b3c92918
Rollup merge of #149445 - fee1-dead-contrib:push-msxupnksrusl, r=petrochenkov
make assoc fn inherit const stability from inherent `const impl` blocks

Pulled out of rust-lang/rust#147893, "Currently, one cannot add any const stability annotations on the individual assoc fns at all, as the specific pass that checks for const stability on const fn seems to run as a HIR visitor [and looks at HIR assoc fn constness, which should be changed to also look at its parent]. I suspect there are things to be cleaned up there."

I was slightly lazy so didn't add the "staged_api using staged_api in implicit const stable context, in const unstable context, in explicit const stable context" tests. nudge me if you want to see those!
2025-12-01 17:55:11 +01:00
Matthias Krüger
af631a5396
Rollup merge of #149358 - epage:fence-length, r=davidtwco
fix(parse): Limit frontmatter fences to 255 dashes

Like raw string literals.  As discussed on rust-lang/rust#148051.

Part of  rust-lang/rust#136889
2025-12-01 17:55:10 +01:00
Matthias Krüger
c5046a6109
Rollup merge of #149344 - lapla-cogito:const_unwrap_sugg, r=Kivooeo
Don't suggest unwrap for Result in const

close rust-lang/rust#149316

Regarding `const fn` that returns `Result`, we should avoid suggesting unwrapping. The original issue reported cases where types didn't match, but in practice, such suggestions may also appear when methods are not found, so this PR includes a fix for that case as well.
2025-12-01 17:55:08 +01:00
Matthias Krüger
b8336a5485
Rollup merge of #149299 - adwinwhite:next-245-ice, r=lcnr
Fudge infer vars in the cause code of `Obligation` intentionally

Fixes the ICE variant in https://github.com/rust-lang/trait-system-refactor-initiative/issues/245.
Fixes rust-lang/rust#142866.

The detailed cause is in the test comments.

r? `@lcnr`
2025-12-01 17:55:07 +01:00
Matthias Krüger
6e5661eefc
Rollup merge of #149269 - folkertdev:cmse-infer, r=davidtwco
cmse: do not calculate the layout of a type with infer types

tracking issue: https://github.com/rust-lang/rust/issues/81391
tracking issue: https://github.com/rust-lang/rust/issues/75835
fixes https://github.com/rust-lang/rust/issues/130104

Don't calculate the layout of a type with an infer type (`_`). This now emits `LayoutError::Unknown`, causing an error similar to when any other calling convention is used in this location.

The tests use separate functions because only the first such error in a function body is reported.

r? `@davidtwco` (might need some T-types assistance)
2025-12-01 17:55:07 +01:00
Matthias Krüger
5f3dc5d89a
Rollup merge of #149102 - bend-n:maybe_uninit_slice, r=joboet
stabilize maybe_uninit_slice

Tracking issue: rust-lang/rust#63569
Closes: rust-lang/rust#63569
FCP completed: https://github.com/rust-lang/rust/issues/63569#issuecomment-3477510504

Removes:
```rs
pub const fn slice_as_ptr(this: &[MaybeUninit<T>]) -> *const T;
pub const fn slice_as_mut_ptr(this: &mut [MaybeUninit<T>]) -> *mut T;
```
2025-12-01 17:55:06 +01:00
Matthias Krüger
9a967de929
Rollup merge of #148690 - IntegralPilot:clamp-mag, r=joboet
Implement `clamp_magnitude` method for primitive floats & signed integers

Tracking issue rust-lang/rust#148519
ACP https://github.com/rust-lang/libs-team/issues/686
2025-12-01 17:55:05 +01:00
Mateusz Mikuła
9498f21277 Bring back i686-pc-windows-gnullvm target 2025-12-01 16:46:14 +01:00
Lukas Wirth
d9beb0aa58
Merge pull request #21190 from Veykril/push-puqrkvrtqxnz
fix: Fix proc-macro-srv passing invalid extra none group to proc-macros
2025-12-01 15:38:00 +00:00
León Orell Valerian Liehr
109e5e5999
Move early buffered lint ambigous-glob-imports to a dyn lint diagnostic 2025-12-01 16:31:53 +01:00
Lukas Wirth
c435a5f17f fix: Fix proc-macro-srv passing invalid extra none group to proc-macros 2025-12-01 16:28:18 +01:00
Mateusz Mikuła
57a1000f13 Mark windows-gnu* as lacking build with assertions 2025-12-01 16:02:08 +01:00
bors
2fb805367d Auto merge of #149499 - lnicola:sync-from-ra, r=lnicola
`rust-analyzer` subtree update

Subtree update of `rust-analyzer` to d690155841.

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

r? `@ghost`
2025-12-01 14:06:10 +00:00
Zalathar
b03a65543f Prepare ignore/only conditions once in advance, without a macro 2025-12-02 00:15:07 +11:00
reddevilmidzy
31106eb752 Update the comment in the add_typo_suggestion function 2025-12-01 21:49:40 +09:00
aerooneqq
62fe6a0143 Rename added test 2025-12-01 15:30:53 +03:00
Laurențiu Nicola
ad61e76c58
Merge pull request #21186 from lnicola/exactly-one
minor: Use `Itertools::exactly_one` in a couple more places
2025-12-01 11:03:31 +00:00