Commit Graph

312240 Commits

Author SHA1 Message Date
bendn 919e46f4d4 stabilize [T]::array_windows 2025-12-02 00:37:17 +07:00
bors 2fb805367d Auto merge of #149499 - lnicola:sync-from-ra, r=lnicola
`rust-analyzer` subtree update

Subtree update of `rust-analyzer` to https://github.com/rust-lang/rust-analyzer/commit/d6901558415c3ae558203d0d88f221dd59c5a36e.

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

r? `@ghost`
2025-12-01 14:06:10 +00: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
Laurențiu Nicola 1973e38505 Use Itertools::exactly_one in a couple more places 2025-12-01 12:53:39 +02:00
bors 9b82a4fffe Auto merge of #149481 - RalfJung:threadid-fallback, r=joboet
ThreadId generation fallback path: avoid spurious yields

Fixes https://github.com/rust-lang/miri/issues/4737
Alternative to https://github.com/rust-lang/rust/pull/149476
Cc `@orlp` `@joboet`
2025-12-01 10:47:13 +00:00
Laurențiu Nicola e3d314d40d Merge pull request #21185 from rust-lang/rustc-pull
Rustc pull update
2025-12-01 10:40:59 +00:00
Laurențiu Nicola 9c44cb8bfb Merge pull request #21171 from Veykril/push-puuqoostoysw
minor: Option-box `crate_lang_items` query result
2025-12-01 10:40:41 +00:00
The rustc-josh-sync Cronjob Bot 7c2523f84d Merge ref 'dfe1b8c97bcd' from rust-lang/rust
Pull recent changes from https://github.com/rust-lang/rust via Josh.

Upstream ref: dfe1b8c97b
Filtered ref: d3d1f3831e6b7fa73889d90bc8dd56d22cb80834
Upstream diff: https://github.com/rust-lang/rust/compare/1be6b13be73dc12e98e51b403add4c41a0b77759...dfe1b8c97bcde283102f706d5dcdc3649e5e12e3

This merge was created using https://github.com/rust-lang/josh-sync.
2025-12-01 04:34:35 +00:00
The rustc-josh-sync Cronjob Bot c6a4a53535 Prepare for merging from rust-lang/rust
This updates the rust-version file to dfe1b8c97b.
2025-12-01 04:29:36 +00:00
Ralf Jung 14830bfd0c ThreadId generation fallback path: avoid spurious yields 2025-11-30 22:52:28 +01:00
bors dfe1b8c97b Auto merge of #149463 - cyrgani:comma-fix, r=chenyukang
add a missing comma to default r-a settings file
2025-11-30 21:15:15 +00:00
bors b84478a1c4 Auto merge of #149486 - matthiaskrgr:rollup-0isey7o, r=matthiaskrgr
Rollup of 2 pull requests

Successful merges:

 - rust-lang/rust#148169 (Fix bad intra-doc-link preprocessing)
 - rust-lang/rust#149471 (coverage: Store signature/body spans and branch spans in the expansion tree)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-11-30 17:56:52 +00:00
Lukas Wirth b35a995a8e Merge pull request #21179 from Veykril/push-xnrqmltklpxs
internal: Ensure proc-macro-api version check works with postcard across protocol versions
2025-11-30 17:55:49 +00:00
Lukas Wirth 75d26b054b internal: Ensure proc-macro-api version check works with postcard across protocol versions 2025-11-30 18:46:29 +01:00
Matthias Krüger b49b18bcff Rollup merge of #149471 - Zalathar:tree, r=oli-obk
coverage: Store signature/body spans and branch spans in the expansion tree

In order to support coverage instrumentation of expansion regions, we need to reduce the amount of code that assumes we're only instrumenting a flat function body. Moving more data into expansion tree nodes is an incremental step in that direction.

There should be no change to compiler output.
2025-11-30 18:44:23 +01:00
Matthias Krüger 97b5b9b817 Rollup merge of #148169 - fmease:rustdoc-bad-intra-bad-preprocess, r=lolbinarycat
Fix bad intra-doc-link preprocessing

How did rust-lang/rust#147981 happen?

1. We don't parse intra-doc links as Rust paths or qpaths. Instead they follow a very lenient bespoke grammar. We completely ignore Markdown links if they contain characters that don't match `/[a-zA-Z0-9_:<>, !*&;]/` (we don't even emit lint *broken-intra-doc-links* for these).
2. PR [#132748](https://github.com/rust-lang/rust/pull/132748) made rustdoc intepret more Markdown links as potential intra-doc links. Namely, if the link is surrounded by backticks (and some other conditions apply) then it doesn't matter if the (partially processed) link contains bad characters as defined above (cc `ignore_urllike && should_ignore_link(path_str)`).
3. However, rustdoc's `preprocess_link` must be kept in sync with a simplified counterpart in rustc. More specifically, whenever rustdoc's preprocessor returns a successful result then rustc's must yield the same result. Otherwise, rustc doesn't resolve the necessary links for rustdoc.
4. This uncovered a "dormant bug" / "mistake" in rustc's `preprocess_link`. Namely, when presented with a link like `struct@Type@suffix`, it didn't cut off the disambiguator if present (here: `struct@`). Instead it `rsplit('``@')``` which is incorrect if the "path" contains ```@``` itself (yielding `suffix` instead of `Type@suffix` here). Prior to PR [#132748](https://github.com/rust-lang/rust/pull/132748), a link like ``[`struct@Type@suffix`]`` was not considered a potential intra-doc link / worth querying rustc for. Now it is due to the backticks.
5. Finally, since rustc didn't record a resolution for `Type@suffix` (it only recorded `suffix` (to be `Res::Err`)), we triggered an assertion we have in place to catch cases like this.

Fixes rust-lang/rust#147981.

I didn't and still don't have the time to investigate if rust-lang/rust#132748 led to more rustc/rustdoc mismatches (after all, the PR made rustdoc's `preprocess_link` return `Some(Ok(_))` in more cases). I've at least added another much needed "warning banner" & made the existing one more flashy.

While this fixes a stable-to-beta regression, I don't think it's worth beta backporting, esp. since it's only P-medium and since the final 1.91 release steps commence today / the next days, so it would only be stressful to get it in on time. However, feel free to nominate.

<sub>(I've written such a verbose PR description since I tend to reread my old PR descriptions in the far future to fully freshen my memories when I have to work again in this area)</sub>

r? ``@lolbinarycat``
2025-11-30 18:44:22 +01:00
bors f40a70d2bc Auto merge of #149478 - matthiaskrgr:rollup-0omf56q, r=matthiaskrgr
Rollup of 3 pull requests

Successful merges:

 - rust-lang/rust#149236 (Clarify edge cases for Barrier::new)
 - rust-lang/rust#149444 (collapse `constness` query `match` logic)
 - rust-lang/rust#149475 (float::min/max: reference NaN bit pattern rules)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-11-30 13:38:44 +00:00
León Orell Valerian Liehr 55d90c0653 Fix bad intra-doc-link preprocessing 2025-11-30 13:08:59 +01:00
Matthias Krüger 1a9f5279f4 Rollup merge of #149475 - RalfJung:min-max-nan, r=tgross35
float::min/max: reference NaN bit pattern rules

Also, the "in particular" transition to the signed zero handling was odd, so I rearranged things a bit: first a self-contained description of the semantics, then an explanation of which operations in other standards/libraries this most closely corresponds to.

r? `@tgross35`
2025-11-30 12:03:24 +01:00
Matthias Krüger 9507d5c149 Rollup merge of #149444 - fee1-dead-contrib:push-lurmmylquwsq, r=oli-obk
collapse `constness` query `match` logic

We already have the HIR node data, so no need for asking `def_kind` again.

r? oli-obk
2025-11-30 12:03:23 +01:00
Matthias Krüger bc83bf21dd Rollup merge of #149236 - tisonkun:patch-1, r=tgross35
Clarify edge cases for Barrier::new

... since n-1 is undefined when the usize n is 0.
2025-11-30 12:03:23 +01:00
bors 03ce87dfb2 Auto merge of #149474 - RalfJung:miri, r=RalfJung
miri subtree update

Subtree update of `miri` to https://github.com/rust-lang/miri/commit/074992992071e27ba2e2ea8b8e3b53e3c08360ab.

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

r? `@ghost`
2025-11-30 10:27:52 +00:00
Ralf Jung 3287178d1f float::min/max: reference NaN bit pattern rules 2025-11-30 11:03:24 +01:00
Chayim Refael Friedman b657006ccd Merge pull request #21177 from dfaure-kdab/fix-for-static
gdb pretty printer: fix printing when using Repr::Static
2025-11-30 09:45:25 +00:00
David Faure 34fe0cecf4 internal: fix gdb pretty printer when using Repr::Static
I missed a ["__0"] to access the str in the Static case.

Also, simplify the code to rely on the pretty printer for str
rather than accessing data_ptr/length directly. This makes it
more robust against changes in str.

Output before: "<SmolStr Static error: There is no member named data_ptr.>"
Output after: "preferred-width"
2025-11-30 10:35:07 +01:00
Chayim Refael Friedman a58c0999e6 Merge pull request #21172 from ChayimFriedman2/no-block
internal: Remove the block from `DbInterner`
2025-11-30 09:28:20 +00:00
Chayim Refael Friedman 3924ffec5f Remove the block from DbInterner
Turns out we're not using it anymore.
2025-11-30 11:18:45 +02:00
tison 5d8f2b8ebe Clarify edge cases for Barrier::new 2025-11-30 17:14:46 +08:00
Lukas Wirth c9843952a7 Merge pull request #21159 from ChayimFriedman2/fix-dyn-projections
fix: Rewrite dyn trait lowering to follow rustc
2025-11-30 08:52:40 +00:00
Zalathar ac437169ec coverage: Store branch spans in the expansion tree 2025-11-30 18:31:55 +11:00
Zalathar 61c923b765 coverage: Store fn_sig_span and body_span in the expansion tree 2025-11-30 18:31:55 +11:00
Zalathar a3bf870441 coverage: Test some edge cases involving macro expansion 2025-11-30 18:31:54 +11:00
bors 91ab3083bb Auto merge of #149327 - lolbinarycat:rustdoc-types-fixup, r=notriddle
yet another improvment to rustdoc js typechecking

biggest improvment is the docs for `FunctionType` and the signatures for functions that accept names of crates were both slightly wrong, this has now been fixed.
2025-11-30 07:16:47 +00:00
Chayim Refael Friedman 7f6f1d545c Merge pull request #21170 from ChayimFriedman2/multi-target-feature
fix: Support multiple `enable` in `#[target_feature]`
2025-11-30 02:22:32 +00:00
Deadbeef cf91330b6b collapse constness query match logic
We already have the HIR node data, so no need for asking `def_kind` again.
2025-11-29 20:00:40 -05:00
cyrgani 33f2e82477 add a missing comma to default r-a settings file 2025-11-29 21:31:43 +00:00
bors 3ff30e7eaf Auto merge of #149462 - matthiaskrgr:rollup-vfwin7f, r=matthiaskrgr
Rollup of 3 pull requests

Successful merges:

 - rust-lang/rust#148746 (const validation: remove check for mutable refs in final value of const)
 - rust-lang/rust#148765 (std: split up the `thread` module)
 - rust-lang/rust#149454 (resolve: Identifier resolution refactorings)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-11-29 20:11:02 +00:00
Lukas Wirth e8bb59b449 minor: Option-box crate_lang_items query result 2025-11-29 20:55:23 +01:00
Matthias Krüger b35b187110 Rollup merge of #149454 - petrochenkov:openapi0, r=eholk
resolve: Identifier resolution refactorings

Mostly splitting large functions into smaller functions, including some parts from https://github.com/rust-lang/rust/pull/144131, there should be no functional changes.
See individual commits.
2025-11-29 20:54:06 +01:00
Matthias Krüger c93801cb20 Rollup merge of #148765 - joboet:split-up-thread, r=ChrisDenton
std: split up the `thread` module

Almost all functionality in `std::thread` is currently implemented in `thread/mod.rs`, resulting in a *huge* file with more than 2000 lines and multiple, interoperating `unsafe` sections. This PR splits the file up into multiple different private modules, each implementing mostly independent parts of the functionality. The only remaining `unsafe` interplay is that of the `lifecycle` and `scope` modules, the `spawn_scoped` implementation relies on the live thread count being updated correctly by the `lifecycle` module.

This PR contains no functional changes and only moves code around for the most part, with a few notable exceptions:
* `with_current_name` is moved to the already existing `current` module and now uses the `name` method instead of calculating the name from private fields. The old code was just a reimplementation of that method anyway.
* The private `JoinInner` type used to implement both join handles now has some more methods (`is_finished`, `thread` and the `AsInner`/`IntoInner` implementations) to avoid having to expose private fields and their invariants.
* The private `spawn_unchecked_` (note the underscore) method of `Builder` is now a freestanding function in `lifecycle`.

The rest of the changes are just visibility annotations.

I realise this PR ended up quite large – let me know if there is anyway I can aid the review process.

Edit: I've simplified the diff by adding an intermediate commit that creates all the new files by duplicating `mod.rs`. The actual changes in the second commit thus appear to delete the non-relevant parts from the respective file.
2025-11-29 20:54:06 +01:00
Matthias Krüger 8e4c70f02b Rollup merge of #148746 - RalfJung:mutable-ref-in-const, r=davidtwco
const validation: remove check for mutable refs in final value of const

This check rejects code that is not necessarily UB, e.g. a mutable ref to a `static mut` that is very carefully used correctly. That led to us having to describe it in the Reference, which uncovered just how ad-hoc this check is (https://github.com/rust-lang/reference/issues/2074).

Even without this check, we still reject things like
```rust
const C: &mut i32 = &mut 0;
```
This is rejected by const checking -- the part of the frontend that looks at the source code and says whether it is allowed in const context. In the Reference, this restriction is explained [here](https://doc.rust-lang.org/nightly/reference/const_eval.html#r-const-eval.const-expr.borrows).

So, the check during validation is just a safety net. And it is already a safety net with gaping holes since we only check `&mut T`, not `&UnsafeCell<T>`, due to the fact that we promote some immutable values that have `!Freeze` type so `&!Freeze` actually can occur in the final value of a const.

So... it may be time for me to acknowledge that the "mutable ref in final value of const" check is a cure that's worth than the disease. Nobody asked for that check, I just added it because I was worried about soundness issues when we allow mutable references in constants. Originally it was much stricter, but I had to slowly relax it to its current form to prevent t from firing on code we intend to allow. In the end there are only 3 tests left that trigger this error, and they are all just constants containing references to mutable statics -- not the safest code in the world, but also not so bad that we have to spend a lot of time devising a core language limitation and associated Reference wording to prevent it from ever happening.

So... `@rust-lang/wg-const-eval` `@rust-lang/lang`  I propose that we allow code like this
```rust
static mut S: i32 = 3;
const C2: &'static mut i32 = unsafe { &mut * &raw mut S };
```
`@theemathas` would be great if you could try to poke a hole into this. ;)
2025-11-29 20:54:05 +01:00
Chayim Refael Friedman 2ecafe2c7d Support multiple enable in #[target_feature] 2025-11-29 21:23:04 +02:00
Lukas Wirth 9c9c245d61 Merge pull request #21169 from Veykril/push-psyltyvxtpoz
internal: New style salsa infer query
2025-11-29 19:11:24 +00:00
Chayim Refael Friedman b35d46cc5f Rewrite dyn trait lowering to follow rustc
Turns out, we need to elaborate supertrait projections, and the logic isn't trivial either!
2025-11-29 21:07:37 +02:00
Lukas Wirth e78e835951 Slim down tuple_field_access_types 2025-11-29 20:01:53 +01:00
Lukas Wirth 70b3c3559f internal: New style salsa infer query 2025-11-29 19:43:52 +01:00
binarycat fa8eb7e400 rustdoc: remove console.log and improve focus event typechecking 2025-11-29 12:43:41 -06:00
Chayim Refael Friedman 645e490640 Merge pull request #20892 from ChayimFriedman2/better-attrs
Re-introduce attribute rewrite
2025-11-29 17:02:17 +00:00
Chayim Refael Friedman bf75855cb3 Fix a panic where all_crates() is empty 2025-11-29 18:52:18 +02:00
Chayim Refael Friedman 4b29847544 Make Semantics::attach_first_edition() not return Option
And instead call `EditionedFileId::current_edition_guess_origin`, as most callers do it anyway.
2025-11-29 18:52:18 +02:00