Commit Graph

38627 Commits

Author SHA1 Message Date
The rustc-josh-sync Cronjob Bot
8a6869d15a Merge ref 'eda4fc7733ee' from rust-lang/rust
Pull recent changes from https://github.com/rust-lang/rust via Josh.

Upstream ref: rust-lang/rust@eda4fc7733
Filtered ref: rust-lang/rust-analyzer@18005ba4c5
Upstream diff: f8704be04f...eda4fc7733

This merge was created using https://github.com/rust-lang/josh-sync.
2026-03-09 04:49:02 +00:00
The rustc-josh-sync Cronjob Bot
89b037835d Prepare for merging from rust-lang/rust
This updates the rust-version file to eda4fc7733ee89e484d7120cafbd80dcb2fce66e.
2026-03-09 04:43:44 +00:00
bors
18005ba4c5 Auto merge of #153383 - nnethercote:overhaul-ensure_ok, r=Zalathar
Overhaul `ensure_ok`

The interaction of `ensure_ok` and the `return_result_from_ensure_ok` query modifier is weird and hacky. This PR cleans it up. Details in the individual commits.

r? @Zalathar
2026-03-08 07:03:35 +00:00
A4-Tacks
51966da92d Merge pull request #21782 from jaroslawroszyk/feat-parse-json
feat: add --json flag to rust-analyzer parse
2026-03-09
2026-03-08 02:56:38 +00:00
Jaroslaw Roszyk
6ff82f9030 feat: add --json flag to rust-analyzer parse 2026-03-08 03:46:24 +01:00
Chayim Refael Friedman
9603dab46b Merge pull request #21781 from CodeLoopdroid/feature/clone-subtree
Migrate two assists to clone_subtree to ease SyntaxEditor transition
2026-03-08 01:22:39 +00:00
bors
155de144d1 Auto merge of #153521 - Zalathar:predicates-of, r=nnethercote
Don't use incremental disk-cache for query `predicates_of`

The `predicates_of` query is a relatively modest wrapper around a few underlying queries that are themselves cached to disk. Removing the additional layer of disk caching appears to be a significant perf win.

This query also appears to be the only query that uses a crate-local `cache_on_disk_if` condition, without also using the `separate_provide_extern` modifier.

- Discovered via https://github.com/rust-lang/rust/pull/153487#discussion_r2895304051
2026-03-07 23:31:34 +00:00
Divyesh
5c47b6b28a ide-assists: remove unnecessary clones in two assists 2026-03-08 04:16:42 +05:30
bors
d9ad922b76 Auto merge of #153544 - JonathanBrouwer:rollup-LT1ogBG, r=JonathanBrouwer
Rollup of 2 pull requests

Successful merges:

 - rust-lang/rust#153462 (Bootstrap update)
 - rust-lang/rust#152210 (Gate #![reexport_test_harness_main] properly)
2026-03-07 20:04:00 +00:00
Jonathan Brouwer
ee96c97d0b Rollup merge of #152210 - Ozzy1423:attrs7, r=JonathanBrouwer
Gate #![reexport_test_harness_main] properly

Address the FIXME

Removed from `issue-43106-gating-of-builtin-attrs.rs` since that is for stable attributes only.

This would be a breaking change, search of github shows it is mostly but not always used with `#![test_runner]` which is already gated correctly.

Details:
https://github.com/rust-lang/rust/issues/50297

Feel free to close this issue if you think it is not worth addressing the FIXME...
2026-03-07 20:02:30 +01:00
bors
2b2d5483f3 Auto merge of #153387 - Zalathar:call-query, r=nnethercote
Get rid of `QueryVTable::call_query_method_fn`



Calling the query method to promote a value is equivalent to doing a cache lookup and then calling `execute_query_fn`, so we can just do that manually instead.

There are two “functional” differences here: If a cache hit occurs, we don't record the hit for self-profiling, and we don't register a read of the dep node. In the context of promotion, which touches *all* eligible cache entries just before writing the memory-cached values to disk, those two steps should be unnecessary overhead anyway.

r? nnethercote (or compiler)
2026-03-07 13:06:24 +00:00
A4-Tacks
a1b86d600f Merge pull request #21774 from akashchakrabortymsc-cmd/migrate-unqualify-method-call
Migrate unqualify_method_call assist to SyntaxEditor
2026-03-07 09:58:33 +00:00
protonblu
467d73bd00 Migrate unqualify_method_call assist to SyntaxEditor 2026-03-07 12:44:36 +05:30
A4-Tacks
6522eb865a Merge pull request #21734 from Shourya742/2026-03-02-migrate-already-migrated-assist-to-syntaxFactory
Replace make to syntax factory from already migrated syntax factory assist
2026-03-07 01:45:39 +00:00
bors
112f2f57f4 Auto merge of #153507 - JonathanBrouwer:rollup-ki59UTE, r=JonathanBrouwer
Rollup of 14 pull requests

Successful merges:

 - rust-lang/rust#153466 (`rust-analyzer` subtree update)
 - rust-lang/rust#151280 (Fix incorrect trailing comma suggested in no_accessible_fields)
 - rust-lang/rust#152593 (Box in `ValTreeKind::Branch(Box<[I::Const]>)` changed to `List`)
 - rust-lang/rust#153174 (std: add wasm64 to sync::Once and thread_parking atomics cfg guards)
 - rust-lang/rust#153485 (libcore float tests: replace macro shadowing by const-compatible macro)
 - rust-lang/rust#153495 (Fix ICE in `offset_of!` error recovery)
 - rust-lang/rust#152040 (Do not emit ConstEvaluatable goals if type-const)
 - rust-lang/rust#152741 (Suppress invalid suggestions in destructuring assignment)
 - rust-lang/rust#153189 (refactor: move `check_align` to `parse_alignment`)
 - rust-lang/rust#153230 (Roll rustfmt reviewers for in-tree rustfmt)
 - rust-lang/rust#153445 (Consider try blocks as block-like for overflowed expr)
 - rust-lang/rust#153452 (Cleanup unused diagnostic emission methods)
 - rust-lang/rust#153476 (bootstrap.py: fix typo "parallle")
 - rust-lang/rust#153483 (Preserve parentheses around `Fn` trait bounds in pretty printer)
2026-03-06 19:09:12 +00:00
Laurențiu Nicola
fad5c3d2d6 Merge pull request #21772 from stinb/syntax-fuzz-build-error
Fix syntax/fuzz build error
2026-03-06 18:46:42 +00:00
Jason Haslam
7bc5632014 Fix syntax/fuzz build error 2026-03-06 11:35:35 -07:00
Jonathan Brouwer
a6fc78bd55 Rollup merge of #153483 - aytey:dyn_paren_impl_fn_return, r=fmease
Preserve parentheses around `Fn` trait bounds in pretty printer

The AST pretty printer was dropping parentheses around `Fn` trait bounds in `dyn`/`impl` types when additional `+` bounds were present. For example:

    dyn (FnMut(&mut T) -> &mut dyn ResourceLimiter) + Send + Sync

was pretty-printed as:

    dyn FnMut(&mut T) -> &mut dyn ResourceLimiter + Send + Sync

Without parens, `+ Send + Sync` binds to the inner `dyn ResourceLimiter` instead of the outer type, producing invalid Rust.

The parser already tracks parentheses via `PolyTraitRef.parens`, but `print_poly_trait_ref` never checked this field. This adds `popen()` and `pclose()` calls when `parens == Parens::Yes`.
2026-03-06 18:49:52 +01:00
Jonathan Brouwer
8e77180c56 Rollup merge of #153476 - DanielEScherzer:patch-2, r=bjorn3
bootstrap.py: fix typo "parallle"
2026-03-06 18:49:51 +01:00
Jonathan Brouwer
7f5c7bb9ac Rollup merge of #153452 - GuillaumeGomez:migrate-diag, r=JonathanBrouwer
Cleanup unused diagnostic emission methods

Part of https://github.com/rust-lang/rust/issues/153099.

To remove `lint_level`, we need to remove all functions calling it. One of them is `TyCtxt::node_span_lint`, so removing it.

r? @JonathanBrouwer
2026-03-06 18:49:51 +01:00
Jonathan Brouwer
b387244a9c Rollup merge of #153445 - ia0:overflow_try, r=ytmimi
Consider try blocks as block-like for overflowed expr

The tracking issue for `try_blocks` is https://github.com/rust-lang/rust/issues/31436.
The tracking issue for `try_blocks_heterogeneous` is https://github.com/rust-lang/rust/issues/149488.

Fixes https://github.com/rust-lang/rustfmt/issues/6799.
2026-03-06 18:49:50 +01:00
Jonathan Brouwer
93bff1c864 Rollup merge of #153230 - jieyouxu:rustfmt-reviewers-for-rustfmt, r=ytmimi
Roll rustfmt reviewers for in-tree rustfmt

Noticed in https://github.com/rust-lang/rust/pull/153229#issuecomment-3977482140, where because `src/tools/rustfmt` has no corresponding `[assign.owners]` entry, it rolls one of the `fallback` reviewers (Mark and me) which is needless indirection, since if it rolls to Mark, Mark will have to reroll again.

This _can_ also be

```toml
"/src/tools/rustfmt" = ["rustfmt", "rustfmt-contributors"]
```

which corresponds to https://github.com/orgs/rust-lang/teams/rustfmt and https://github.com/orgs/rust-lang/teams/rustfmt-contributors respectively. I will double-check with triagebot team if we can use review rotation toggles for `rust-lang/rust` in-tree `rustfmt` specifically.

Discussion: [#t-rustfmt > review queue tracking for rust-lang/rust in-tree rustfmt](https://rust-lang.zulipchat.com/#narrow/channel/357797-t-rustfmt/topic/review.20queue.20tracking.20for.20rust-lang.2Frust.20in-tree.20rustfmt/with/576498516)

### Unresolved question

- ~~Do we want to start everyone off as off-rotation? Or on-rotation? I plan to start conservatively by preserving existing effective status, which is everyone off-rotation.~~ We will match existing defaults, with everyone starting off as off-team-rotation.

r? @ytmimi
2026-03-06 18:49:50 +01:00
Jonathan Brouwer
a5789ffbf4 Rollup merge of #153189 - JayanAXHF:refactor/check_attrs_reftor_1, r=JonathanBrouwer
refactor: move `check_align` to `parse_alignment`

Part of rust-lang/rust#153101

r? @JonathanBrouwer

PS: jonathan i'm not sure about what to do with `check_align` now
2026-03-06 18:49:49 +01:00
Jonathan Brouwer
7490e76a9f Rollup merge of #152741 - arferreira:fix-invalid-suggestions-destructuring-drop, r=estebank,Kivooeo
Suppress invalid suggestions in destructuring assignment

Fixes rust-lang/rust#152694

When destructuring assignment hits a type with `Drop`, the compiler was emitting two broken suggestions: `ref *&mut String::new()` (invalid syntax) and `.clone()` on a temporary (useless).

Root cause: the suggestion logic didn't know these bindings were synthetic from assign desugaring. The fix reuses the existing `AssignDesugar` detection in `BindingFinder` to collect those spans and skip both suggestions.
2026-03-06 18:49:49 +01:00
Jonathan Brouwer
de49a6e055 Rollup merge of #152040 - JohnTitor:issue-151631, r=BoxyUwU
Do not emit ConstEvaluatable goals if type-const

Fixes rust-lang/rust#151631, fixes rust-lang/rust#151477
r? @fmease

I'd recommend reviewing commit-by-commit, the diff is less-readable to address a cyclic issue.
2026-03-06 18:49:48 +01:00
Jonathan Brouwer
bc184561a4 Rollup merge of #153495 - TaKO8Ki:fix-153236-offset-of-recovery, r=petrochenkov
Fix ICE in `offset_of!` error recovery

Fixes rust-lang/rust#153236.

`offset_of!` was changed in rust-lang/rust#148151 to lower through THIR as a sum of calls to the `offset_of` intrinsic. In the error-recovery case, when no valid field indices are recorded, that lowering synthesized `0` as a `u32` even though the overall `offset_of!` expression has type `usize`.

On 64-bit targets, const-eval then tried to write a 4-byte immediate into an 8-byte destination, which caused the ICE.
2026-03-06 18:49:48 +01:00
Jonathan Brouwer
582e9063b5 Rollup merge of #153485 - RalfJung:float-macros-const, r=tgross35
libcore float tests: replace macro shadowing by const-compatible macro

This lets us avoid https://github.com/rust-lang/rust/issues/153478.
However this means we generate 3 function items per assertion -- or rather, 3*8, since every assertion gets duplicated 8 times (4 float types, each in a const and a non-const variant). That's a lot; is it enough to be concerned about?
coretest already takes forever to build. In a quick test, build time increased from 29.8s to 30.8s, but that may also entirely be noise.

r? @tgross35
2026-03-06 18:49:48 +01:00
Jonathan Brouwer
9fe95ca30b Rollup merge of #153174 - Trivo25:fix-wasm64-sync-cfg, r=joboet
std: add wasm64 to sync::Once and thread_parking atomics cfg guards

When targeting `wasm64-unknown-unknown` with atomics enabled, `std::sync::Once` and `thread_parking` fall through to the `no_threads`/`unsupported` implementations because the cfg guards only check for `wasm32`. This causes worker threads to panic with `unreachable` at runtime. The underlying futex implementations already handle both wasm32 and wasm64 correctly, only the cfg guards were missing wasm64.

I tested this manually with a multithreaded wasm64 application ([o1js](https://github.com/o1-labs/o1js/)) compiled with `-Z build-std=panic_abort,std` and `-C target-feature=+atomics,+bulk-memory,+mutable-globals`

Related: rust-lang/rust#83879 rust-lang/rust#77839

Happy to adjust anything based on feedback
2026-03-06 18:49:47 +01:00
Jonathan Brouwer
c2dc0c09f1 Rollup merge of #152593 - spirali:valtreekind-list, r=lcnr
Box in `ValTreeKind::Branch(Box<[I::Const]>)` changed to `List`

This is related to trait system refactoring. It fixes the FIXME in `ValTreeKind`

```
   // FIXME(mgca): Use a `List` here instead of a boxed slice
    Branch(Box<[I::Const]>),
```

It introduces `Interner::Consts`, changes `Branch(Box<[I::Const]>)` to `Branch(I::Consts)`, and updates all relevant places.

r? lcnr
2026-03-06 18:49:47 +01:00
Jonathan Brouwer
3537a0627f Rollup merge of #151280 - chenyukang:yukang-fix-149787, r=estebank
Fix incorrect trailing comma suggested in no_accessible_fields

Fixes rust-lang/rust#149787

r? @estebank

I think add new field for AST for it is too heavy change for this issue, here is a trivial fix with source_map, seems enough for it.
2026-03-06 18:49:46 +01:00
Jonathan Brouwer
4d767f06d0 Rollup merge of #153466 - lnicola:sync-from-ra, r=lnicola
`rust-analyzer` subtree update

Subtree update of `rust-analyzer` to 0dc6097727.

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

r? @ghost
2026-03-06 18:49:45 +01:00
Lukas Wirth
2f73b8de99 Merge pull request #21770 from Wilfred/vfs_remove_events
fix: Update VFS when a watched file is deleted
2026-03-06 16:39:34 +00:00
Wilfred Hughes
0241582099 fix: Update VFS when a watched file is deleted
When rust-analyzer handles file watching, it previously wouldn't
update the VFS on file deletion. We would discard events where
fs::metadata() isn't available, and we never have metadata for deleted
files.

See also the discussion in rust-lang/rust-analyzer#19907.
2026-03-06 15:57:26 +00:00
Lukas Wirth
a8e2add5c7 Merge pull request #21764 from Veykril/push-wxmovumvpzqm
smol_str: Improve API surface
2026-03-06 11:29:17 +00:00
Chayim Refael Friedman
23cc64a615 Merge pull request #21705 from A4-Tacks/cfg-select-fallback
fix: cfg_select supports non token-tree tokens
2026-03-06 11:08:05 +00:00
bors
b477a05426 Auto merge of #153316 - nnethercote:rm-with_related_context, r=oli-obk
Remove `tls::with_related_context`.

This function gets the current `ImplicitCtxt` and checks that its `tcx` matches the passed-in `tcx`. It's an extra bit of sanity checking: when you already have a `tcx`, and you need access to the non-`tcx` parts of `ImplicitCtxt`, check that your `tcx` matches the one in `ImplicitCtxt`.

However, it's only used in two places: `start_query` and `current_query_job`. The non-checked alternatives (`with_context`, `with_context_opt`) are used in more places, including some where a `tcx` is available. And things would have to go catastrophically wrong for the check to fail -- e.g. if we somehow end up with multiple `TyCtxt`s. In my opinion it's just an extra case to understand in `tls.rs` that adds little value.

This commit removes it. This avoids the need for `tcx` parameters in a couple of places. The commit also adjusts how `start_query` sets up its `ImplicitCtxt` to more closely match how similar functions do it, i.e. with `..icx.clone()` for the unchanged fields.

r? @oli-obk
2026-03-06 10:21:32 +00:00
bit-aloo
0e510d9eb1 add GetOrCreateWhereClause subtrait in edit to provide get_or_create_where_clause 2026-03-06 15:32:33 +05:30
bit-aloo
3faa0e1a5a remove make from replace_named_generics_with_impl 2026-03-06 15:32:33 +05:30
bit-aloo
65c3f983a5 migrate move bounds to SyntaxEditor API 2026-03-06 15:32:33 +05:30
bit-aloo
776dfd7abe remove make from move_bound 2026-03-06 15:32:33 +05:30
bit-aloo
52511b7cb6 remove make from generate_fn_type_alias_from_new 2026-03-06 15:32:33 +05:30
bit-aloo
01b8ebc91b remove make from generate_default_from_new 2026-03-06 15:32:33 +05:30
bit-aloo
a5b96fc81d remove make from convert_bool_to_enum 2026-03-06 15:32:33 +05:30
bit-aloo
6feab700fc remove make from add_turbo_fish 2026-03-06 15:32:33 +05:30
bit-aloo
2aeb269257 remove make from extract_type_alias 2026-03-06 15:32:33 +05:30
A4-Tacks
c47f4e036a fix: cfg_select supports non token-tree tokens
- Fix single non-curly groups is ignored `true => ((),)`, old: `(),`, new: `((),)`

Example
---
```rust
const _: i32 = cfg_select! { true => 2 + 3, _ => 3 + 4 };
```

**Before this PR**

```rust
const _: i32 = cfg_select! { true => 2 /* expected a token tree after `=>` */+ 3, _ => 3 + 4 };
```

**After this PR**

```rust
const _: i32 = 2 + 3;
```
2026-03-06 18:00:55 +08:00
Lukas Wirth
8ff72bbfec Add some missing smol_str API pieces 2026-03-06 09:55:44 +01:00
Lukas Wirth
ceeac4a298 perf: smol_str — avoid redundant work in eq
feat: add missing APIs to smol_str
docs: Improve safety documentation
fix: borsh deserialization off-by-one for inline threshold
2026-03-06 09:29:47 +01:00
Laurențiu Nicola
0dc6097727 Merge pull request #21763 from lnicola/lockfile-beta
Tweak pre-release check for beta
2026-03-06 05:28:27 +00:00
Laurențiu Nicola
7e440b1d07 Tweak pre-release check for beta 2026-03-06 07:18:44 +02:00