37483 Commits

Author SHA1 Message Date
Chayim Refael Friedman
d7465cb5b7 Upgrade rustc crates
Changes:
 - `const_of_item()` was added to `Interner`, analogous to `type_of()`. No strongly-typed ID (yet).
 - New solver trait lang item: `TrivialClone`.
 - `TypeRelation` changed a bit, the code was copied from rustc.
2025-12-16 17:00:44 +02:00
Chayim Refael Friedman
92630ee98a
Merge pull request #21278 from A4-Tacks/mut-ref-type-match
Fix complete reference for `&mut ty` -> `&ty`
2025-12-16 08:52:33 +00:00
Chayim Refael Friedman
76cd4d6bf6
Merge pull request #21280 from ChayimFriedman2/fix-assert
minor: Fix an assert that didn't check what it should
2025-12-16 06:00:31 +00:00
Chayim Refael Friedman
14890be186 Fix an assert that didn't check what it should 2025-12-16 07:50:42 +02:00
Chayim Refael Friedman
9bd3aa9a30
Merge pull request #21279 from J3m3/no-downmap
internal: add special `ErasedFileAstId` used for bypassing downmapping
2025-12-16 05:43:45 +00:00
Jesung Yang
55451d38ee internal: add special ErasedFileAstId used for bypassing downmapping
Introduce `NO_DOWNMAP_ERASED_FILE_AST_ID_MARKER`, which prevents `Span`s
from being mapped down into macro expansions.

This is a preparatory step for adding a new field to the
`rust-project.json` format that can inject crate-level attributes.
`Span`s for those attributes will be marked with
`NO_DOWNMAP_ERASED_FILE_AST_ID_MARKER`, indicating that they should not
be mapped down into macro expansions.
2025-12-16 05:23:53 +00:00
Chayim Refael Friedman
0023f193e6
Merge pull request #21277 from A4-Tacks/strip-deref
Fix expected type no strip deref
2025-12-16 03:30:06 +00:00
A4-Tacks
d13d63c0a7
Fix add reference for &mut ty -> &ty
Example
---
```rust
fn foo(r: &mut i32) -> &i32 { $0 }
```

**Before this PR**

`lc &r [type+local]`

This is a compilation error

```rust
fn foo(r: &mut i32) -> &i32 { &r }
```

**After this PR**

`lc r &mut i32 [type+local]`

```rust
fn foo(r: &mut i32) -> &i32 { r }
```
2025-12-16 11:00:10 +08:00
A4-Tacks
d359992184
Fix expected type no strip deref
Example
---
```rust
fn main() {
    let r = &2;
    let _: fn() -> i32 = || *$0;
}
```

**Before this PR**

`ty: &'_ u32, name: x`

```rust
fn main() {
    let r = &2;
    let _: fn() -> i32 = || **r;
}
```

**After this PR**

`ty: &'_ &'_ u32, name: x`

```rust
fn main() {
    let r = &2;
    let _: fn() -> i32 = || *r;
}
```
2025-12-16 10:20:40 +08:00
Chayim Refael Friedman
87cfc881f1
Merge pull request #21032 from A4-Tacks/no-semicolon-in-arg-list
Fix complete unit return semicolon in arg-list
2025-12-16 01:10:02 +00:00
Chayim Refael Friedman
b272c3568b
Merge pull request #21240 from benodiwal/feat/inlay-hint-missing-argument
feat: show parameter hint for missing arguments
2025-12-15 23:28:07 +00:00
Shoyu Vanilla (Flint)
ae15c7cc01
Merge pull request #21273 from ChayimFriedman2/dup-sysroot-method-resolution
fix: Fix method resolution for incoherent impls when there are two sysroots in the crate graph
2025-12-15 19:14:03 +00:00
Chayim Refael Friedman
de46a13f15
Merge pull request #21258 from A4-Tacks/fix-add-ret-function-in-closure
Fix not applicable fn in closure for add_return_type
2025-12-15 19:02:35 +00:00
Chayim Refael Friedman
0408c5a748
Merge pull request #21266 from A4-Tacks/prec-paren-replace-let-with-iflet
Fix invalid logic op for replace_let_with_if_let
2025-12-15 19:01:23 +00:00
Chayim Refael Friedman
ccb1138f27
Merge pull request #21272 from ShoyuVanilla/sysroot-target
fix: Prefix json target file with workspace root for sysroot metadata
2025-12-15 18:42:59 +00:00
Chayim Refael Friedman
764552c5f4
Merge pull request #21276 from dfireBird/fix-21214
fix: use `cmark_with_options` to write shortcuts links to the output
2025-12-15 17:14:16 +00:00
dfireBird
e53d348f35
fix: use cmark_with_options to write shortcuts links to the output 2025-12-15 22:33:06 +05:30
Chayim Refael Friedman
ec12ffdb6a Fix method resolution for incoherent impls when there are two sysroots in the crate graph
Which can happen when two workspaces are opened, by only considering impls from dependencies of this crate.

I have no idea how to construct a test for this, but I tested it manually and it works.
2025-12-15 17:51:53 +02:00
Chayim Refael Friedman
90632683b3
Merge pull request #21270 from CatherineGasnier/fix-file-emitted-multiple-times
Fix "Invariant violation: file emitted multiple times" when doing `scip .`
2025-12-15 15:01:19 +00:00
Chayim Refael Friedman
3f37e42aeb
Merge pull request #21262 from dfireBird/hir-locals-used
feat: Implementation of locals_used in HIR level
2025-12-15 14:26:41 +00:00
Shoyu Vanilla
564034e3ec fix: Prefix json target file with workspace root for sysroot metadata 2025-12-15 23:22:19 +09:00
Catherine Gasnier
8b4e438fd5 Fix "Invariant violation: file emitted multiple times" when doing scip .
Summary:

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:
2025-12-15 06:21:39 -08:00
dfireBird
21713002ff
fix: consider path used in pattern destructing assignments
fix: assign mutable for variables in pattern destructing assignments
2025-12-15 17:28:05 +05:30
Laurențiu Nicola
3d78b3f9e0
Merge pull request #21268 from rust-lang/rustc-pull
minor: Rustc pull update
2025-12-15 09:49:44 +00:00
The rustc-josh-sync Cronjob Bot
f6c67ed0a4 Format code 2025-12-15 04:30:49 +00:00
The rustc-josh-sync Cronjob Bot
2d06e40dd0 Merge ref '0208ee09be46' from rust-lang/rust
Pull recent changes from https://github.com/rust-lang/rust via Josh.

Upstream ref: 0208ee09be465f69005a7a12c28d5eccac7d5f34
Filtered ref: 69b2702db74151cd410a028fb347c6e4e3f779dc
Upstream diff: dfe1b8c97b...0208ee09be

This merge was created using https://github.com/rust-lang/josh-sync.
2025-12-15 04:30:45 +00:00
The rustc-josh-sync Cronjob Bot
f77781c19d Prepare for merging from rust-lang/rust
This updates the rust-version file to 0208ee09be465f69005a7a12c28d5eccac7d5f34.
2025-12-15 04:25:42 +00:00
Chayim Refael Friedman
87cf6631c6
Merge pull request #21265 from J3m3/lint-attr-order
fix: respect rustc's lint attribute application order
2025-12-15
2025-12-14 22:33:33 +00:00
A4-Tacks
6f8c393514
Fix invalid logic op for replace_let_with_if_let
Example
---
```rust
fn main() {
    $0let x = true && false;
}
```

**Before this PR**

```rust
fn main() {
    if let x = true {
    }
}
```

**After this PR**

```rust
fn main() {
    if let x = (true && false) {
    }
}
```
2025-12-14 18:52:17 +08:00
Lukas Wirth
c410127c69
Merge pull request #21225 from Veykril/push-wpzrmoxzttuz
internal: Give `FileSymbol` it's `'db` lifetime
2025-12-14 10:04:46 +00:00
Lukas Wirth
0da7839f48 internal: Give FileSymbol it's 'db lifetime 2025-12-14 10:54:13 +01:00
bors
69b2702db7 Auto merge of #149273 - bjorn3:crate_locator_improvements, r=petrochenkov
Don't leak sysroot crates through dependencies

Previously if a dependency of the current crate depended on a sysroot crate, then `extern crate` would in the current crate would pick the first loaded version of said sysroot crate even in case of an ambiguity. This is surprising and brittle. For `-Ldependency=` we already blocked this since rust-lang/rust#110229, but the fix didn't account for sysroot crates.

Should fix https://github.com/rust-lang/rust/issues/147966
2025-12-14 09:16:11 +00:00
Lukas Wirth
7c063a52fc
Merge pull request #21264 from A4-Tacks/bind-unused-not-applicable-on-closure
Fix bind_unused_param applicable on closure
2025-12-14 09:13:41 +00:00
Lukas Wirth
67db7568e5
Merge pull request #21257 from Veykril/push-qnolwwkvuwxk
minor: Emit `WorkspaceDiagnosticRefresh` when flycheck finished
2025-12-14 09:05:23 +00:00
Lukas Wirth
4576663053
Merge pull request #21253 from tris203/lsp_didSave
fix(lsp): handle dynamic registration for didSave
2025-12-14 08:56:11 +00:00
Lukas Wirth
3276659861 minor: Emit WorkspaceDiagnosticRefresh when flycheck finished 2025-12-14 09:54:59 +01:00
Jesung Yang
2619bd2cec fix: respect rustc's lint attribute application order
Reverse the order of returned lint attributes for a `SyntaxNode` to
match rustc's behavior.

When multiple lint attributes are present, rustc overrides earlier ones
with the last defined attribute. The previous iteration order was
incorrect, causing earlier attributes to override the later ones.
2025-12-14 06:30:09 +00:00
dfireBird
8434be8099
feat: semantics implementation of locals used for extract function
fix: consider let-else expr for return control type
2025-12-14 10:15:51 +05:30
bors
1fc159d939 Auto merge of #146348 - jdonszelmann:eiiv3, r=lcnr,oli-obk
Externally implementable items

Supersedes https://github.com/rust-lang/rust/pull/140010
Tracking issue: https://github.com/rust-lang/rust/issues/125418

Getting started:

```rust
#![feature(eii)]

#[eii(eii1)]
pub fn decl1(x: u64)
// body optional (it's the default)
{
    println!("default {x}");
}

// in another crate, maybe
#[eii1]
pub fn decl2(x: u64) {
    println!("explicit {x}");
}

fn main() {
    decl1(4);
}
```

- tiny perf regression, underlying issue makes multiple things in the compiler slow, not just EII, planning to solve those separately.
- No codegen_gcc support, they don't have bindings for weak symbols yet but could
- No windows support yet for weak definitions

This PR merges the implementation of EII for just llvm + not windows, doesn't yet contain like a new panic handler implementation or alloc handler. With this implementation, it would support implementing the panic handler in terms of EII already since it requires no default implementation so no weak symbols

The PR has been open in various forms for about a year now, but I feel that having some implementation merged to build upon
2025-12-14 04:20:26 +00:00
A4-Tacks
1b3ae5fba1
Fix bind_unused_param applicable on closure
Example
---
```rust
fn foo() {
    let _ = |$0x| 2;
}
```

**Before this PR**

```rust
fn foo() {
    let _ = x;
    let _ = |x| 2;
}
```

**After this PR**

Assist not applicable
2025-12-14 07:43:54 +08:00
bors
1ddfb0e254 Auto merge of #149192 - gmorenz:normalize_lifetimes, r=madsmtm
NFC normalize lifetime identifiers

Fixes rust-lang/rust#126759
2025-12-13 21:47:35 +00:00
Chayim Refael Friedman
ec884b3251
Merge pull request #21263 from ChayimFriedman2/format-args-args
internal: Use a generated name in old format_args lowering, instead of `args`
2025-12-13 18:21:51 +00:00
bors
e32cdc16df Auto merge of #149934 - weihanglo:update-cargo, r=weihanglo
Update cargo submodule

29 commits in 2c283a9a5c5968eeb9a8f12313f04feb1ff8dfac..e91b2baa632c0c7e84216c91ecfe107c37d887c1
2025-12-04 16:47:28 +0000 to 2025-12-13 16:29:21 +0000
- refactor(lints): move from cargo::util::lints to cargo::lints (rust-lang/cargo#16392)
- test(lint): redact more due to line got omitted (rust-lang/cargo#16391)
- feat(report): cargo report timings HTML replay (rust-lang/cargo#16377)
- feat: stabilize `-Zconfig-include` (rust-lang/cargo#16284)
- fix(package): Don't verify registry for --list  (rust-lang/cargo#16341)
- Fixed incorrect locking logic when artifact-dir == build-dir (rust-lang/cargo#16385)
- feat(log): make timing messages ready for HTML replay (rust-lang/cargo#16382)
- chore(deps): update msrv (1 version) to v1.92 (rust-lang/cargo#16381)
- Downgrade curl-sys to 0.4.83 (rust-lang/cargo#16379)
- fix(timing): more self-contained timing/log data (rust-lang/cargo#16378)
- test: update to `proc_macro::tracked::path` (rust-lang/cargo#16380)
- refactor(lint): move lints to separate modules (rust-lang/cargo#16364)
- fix(index): Apply feedback from Cargo team (rust-lang/cargo#16369)
- fix(lints): handle lints separately at ws pkg level  (rust-lang/cargo#16367)
- feat(lint): new `implicit_minimum_version_req` lint (rust-lang/cargo#16321)
- fix(info): default to local without explicit reg (rust-lang/cargo#16358)
- Remove `[no-mentions]` handler in our triagebot config (rust-lang/cargo#16361)
- Don't read the config file twice when $CARGO_HOME is a symlink (rust-lang/cargo#16325)
- fix(timings): forgot to negate filter (rust-lang/cargo#16352)
- fix(doctest): Include all search paths with new build layout  (rust-lang/cargo#16348)
- fix(layout): Remove hashes from bins in new layout  (rust-lang/cargo#16351)
- docs(faq): Include an entry on disk space (rust-lang/cargo#16349)
- feat(timings): derive concurrency data from unit data (rust-lang/cargo#16350)
- perf(layout): Use unit_id, not pkg hash, for bin/lib pkg_dirs for new layout (rust-lang/cargo#16345)
- Validate target source paths before compilation with clearer errors (rust-lang/cargo#16338)
- test(doc): Remove unused build script (rust-lang/cargo#16344)
- refactor(timings): store UnitData in RenderContext instead  (rust-lang/cargo#16346)
- perf(clean): Optimize (legacy) clean with multiple -p specifiers (rust-lang/cargo#16264)
- test: Adjust output for out-of-tree build-dir (rust-lang/cargo#16343)
2025-12-13 18:20:52 +00:00
Chayim Refael Friedman
84a306aa1e Use a generated name in old format_args lowering, instead of args
To prevent it from clashing with other names.
2025-12-13 20:12:08 +02:00
bors
5c3d6dc8d2 Auto merge of #149709 - Urgau:overhaul-filenames, r=davidtwco
Overhaul filename handling for cross-compiler consistency

This PR overhauls the way we handle filenames in the compiler and `rmeta` in order to achieve achieve cross-compiler consistency (ie. having the same path no matter if the filename was created in the current compiler session or is coming from `rmeta`).

This is required as some parts of the compiler rely on consistent paths for the soundness of generated code (see rust-lang/rust#148328).

In order to achieved consistency multiple steps are being taken by this PR:
 - by making `RealFileName` immutable
 - by only having `SourceMap::to_real_filename` create `RealFileName`
   - currently `RealFileName` can be created from any `Path` and are remapped afterwards, which creates consistency issue
 - by also making `RealFileName` holds it's working directory, embeddable name and the remapped scopes
   - this removes the need for a `Session`, to know the current(!) scopes and cwd, which is invalid as they may not be equal to the scopes used when creating the filename

In order for `SourceMap::to_real_filename` to know which scopes to apply `FilePathMapping` now takes the current remapping scopes to apply, which makes `FileNameDisplayPreference` and company useless and are removed.

This PR is split-up in multiple commits (unfortunately not atomic), but should help review the changes.

Unblocks https://github.com/rust-lang/rust/pull/147611
Fixes https://github.com/rust-lang/rust/issues/148328
2025-12-13 14:32:09 +00:00
bors
aea6cfdecb Auto merge of #147372 - jieyouxu:rust-analyzer-main-tests, r=Kobzol
Run main rust-analyzer tests in rust-lang/rust CI

Part of rust-lang/rust#147370.
MCP: https://github.com/rust-lang/compiler-team/issues/923

This PR prepares `rust-analyzer` crates with `in-rust-tree` cargo featues where needed, and and updates bootstrap to run the main `rust-analyzer` tests in rust-lang/rust CI, not just the `proc-macro-srv` crate tests.

This supersedes the earlier attempt at https://github.com/rust-lang/rust/pull/136779. I was honestly expecting more failures in this PR, but looking back at the previous attempt, that makes sense because we no longer run `i686-mingw` (32-bit windows-gnu) which had a _bunch_ of these failures. In the earlier attempt I also disabled the `i686-mingw`-related failures for `i686-msvc` since I didn't feel like digging into 32-bit msvc at the time. Try results from this PR shows that it's most likely limited to 32-bit windows-gnu specifically.

### `rust-analyzer` test remarks

- I actually had to _remove_ the `CARGO_WORKSPACE_DIR` `expect-test`-hack in order for `expect-test` to be able to find the test expectation HTML files (for `syntax_highlighting` tests in `ide`). When I added the hack, ironically, it made `expect-test` unable to find the expectation files. I think this was because previously the path was of the `proc-macro-srv` crate specifically, now we point to the root r-a workspace?
- The `cfg`-related differences on `aarch64-apple-darwin` might've been fixed? I can't tell, but we don't seem to be observing the differences now.
- I'm not sure why `config::{generate_config_documentation, generate_package_json_config}` no longer fails. Perhaps they were fixed to no longer try to write to source directory?

### Review remarks

- Commit 1 updates r-a crates that are involved in tests needing artifacts from `rustc_private` compiler crates to use the `in-rust-tree` cargo feature. I briefly tried to use a plain `--cfg=in_rust_tree`, but quickly realized it was very hacky, and needed invasive bootstrap changes. The cargo feature approach seems most "natural"/well-supported to both bootstrap and cargo.
- Commit 2 updates bootstrap to not only run the `proc-macro-srv` tests, but the whole r-a tests.
- Commit 3 restricts r-a main tests to non-32-bit targets we test in CI, since (1) r-a repo does not run tests against 32-bit platforms, and (2) there are some target pointer width sensitive hash differences causing tests to fail. Notably, this means that we also no longer run r-a `proc-macro-srv` tests against 32-bit targets, but we don't expect that crate to be have target pointer width differences. Discussed this in [#t-compiler/rust-analyzer > 32-bit tests?](https://rust-lang.zulipchat.com/#narrow/channel/185405-t-compiler.2Frust-analyzer/topic/32-bit.20tests.3F/with/563145736).

---

// try-job: aarch64-gnu
// try-job: aarch64-apple
// try-job: x86_64-mingw-1
// try-job: i686-msvc-1
// try-job: x86_64-msvc-1
// try-job: aarch64-msvc-1
2025-12-13 10:11:41 +00:00
Lukas Wirth
eda27bbce0
Merge pull request #21242 from ChayimFriedman2/fmt-fix
fix: Support the new lowering of `format_args!()`
2025-12-12 17:45:43 +00:00
Lukas Wirth
55026408c5
Merge pull request #21251 from ChayimFriedman2/fix-typebound-kind
fix: Fix a panic in `ast::TypeBound::kind()`
2025-12-12 17:43:59 +00:00
Chayim Refael Friedman
16603f8797
Merge pull request #21256 from A4-Tacks/big-range-add-ret-type
Reorder add_return_type assist
2025-12-12 13:09:16 +00:00
A4-Tacks
c3148995d4
Fix not applicable fn in closure for add_return_type
Example
---
```rust
const _: fn() = || {
    fn foo() $0{
        45
    }
}
```

**Before this PR**

Assist not applicable

**After this PR**

```rust
const _: fn() = || {
    fn foo() -> i32 {
        45
    }
}
```
2025-12-12 21:08:25 +08:00