308847 Commits

Author SHA1 Message Date
Johannes Altmanninger
71851588e9 Fix rustfmt for files that use 2024-edition syntax
"cargo fmt" works fine but "rustfmt" fails to format some files.

	$ rustfmt crates/ide-db/src/search.rs
	error: let chains are only allowed in Rust 2024 or later
	   --> /home/johannes/git/rust-analyzer/crates/ide-db/src/search.rs:298:12
	    |
	298 |         if let &Definition::Module(module) = self
	    |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

I guess I could work around this by setting my format command to
"cargo fmt -- $filename" instead of "rustfmt $filename".

But it'd be nice if this worked OOTB. Make it so by adding specifying
the edition in rustfmt.toml.  We already have several other places
specifying the edition.

changelog internal
2025-10-23 23:13:13 +02:00
A4-Tacks
0ab44184a4 Add applicable on assignment for add_braces
```rust
fn foo() {
    let x =$0 n + 100;
}
```
->
```rust
fn foo() {
    let x = {
        n + 100
    };
}
```
2025-10-24 03:59:09 +08:00
Guillaume Gomez
ab1dcee5f2 Merge ClassInfo::open and ClassInfo::link_closing_tag fields into closing_tags
Improve documentation
Improve code
2025-10-23 21:47:15 +02:00
Guillaume Gomez
90c047b3d9 Replace the FxHashMap with an FxIndexMap 2025-10-23 21:45:37 +02:00
Josh Stone
c01682ebf6 Revert "feat: implement hash_map! macro"
This reverts commit 066023e47c.
2025-10-23 12:37:53 -07:00
Josh Stone
a81ed52f58 Add a regression test for rust-lang/rust#147971 2025-10-23 12:37:53 -07:00
Rémy Rakic
a2b48332ba Revert "Auto merge of #146121 - Muscraft:filter-suggestion-parts, r=petrochenkov"
This reverts commit 99317ef14d, reversing
changes made to 9cd272dc85.
2025-10-23 18:18:35 +00:00
Jynn Nelson
5976015e72 compiletest: show output in debug logging
I had a test I was confused by; the root issue is that `error-pattern`
runs before normalization, even though `//~ ERROR` runs after
normalization. This logging caught the issue immediately.
2025-10-23 14:07:00 -04:00
Chayim Refael Friedman
c1ecea6d7e Implement Interner::impl_specializes()
Using specialization logic ported from rustc.
2025-10-23 20:48:51 +03:00
Chayim Refael Friedman
6e397d3cd5 Merge pull request #20889 from A4-Tacks/heuristic-field-expr
Heuristic sensing parenthesis completion of fields
2025-10-23 17:16:53 +00:00
A4-Tacks
03b8682865 Fix some typos 2025-10-24 01:06:27 +08:00
Ed Page
bca35effc2 test(frontmatter): Cover spaces between infostring parts
As these characters are specifically called out in the RFC, I felt it
would be important to have a test to cover them.
2025-10-23 11:47:53 -05:00
Jonathan Brouwer
9ceb997e04 Add myself to the review rotation 2025-10-23 17:52:54 +02:00
Chayim Refael Friedman
88e4ea560a Merge pull request #20891 from daladim/semantic_type_for_logical_not
Semantic type for logical not
2025-10-23 15:46:11 +00:00
Guillaume Gomez
713cd50ea0 Switch back to stream highlight processing 2025-10-23 17:03:01 +02:00
Guillaume Gomez
6ed9a9dd8f Flush elements when there are too many 2025-10-23 17:03:01 +02:00
Guillaume Gomez
b28eabc5e6 Improve performance 2025-10-23 17:03:01 +02:00
Guillaume Gomez
c6e26f9881 Make compatible stack elements "glue" together to prevent creating more HTML tags than necessary 2025-10-23 17:03:01 +02:00
Guillaume Gomez
a5346c609e Improve source code for highlight.rs 2025-10-23 17:03:00 +02:00
daladim
1ef688810f Updated unit tests 2025-10-23 16:58:12 +02:00
daladim
68cb0a9b3f Added the "negation" semantic token 2025-10-23 16:38:26 +02:00
bors
6501e64fcb Auto merge of #147486 - petrochenkov:optpriv, r=lcnr
privacy: Introduce some caching to type visiting in `DefIdVisitorSkeleton`

The caching fixes compilation speed issues in special cases like https://github.com/rust-lang/rust/issues/145741, without introducing too much overhead in general cases.

I tried to cache more, but it caused regressions from the caching overhead, like it can be seen from benchmark runs below.

Inspired by https://github.com/rust-lang/rust/pull/146128.
Closes https://github.com/rust-lang/rust/issues/145741.
2025-10-23 14:30:10 +00:00
Marijn Schouten
41b4b2f718 Add Marijn Schouten to .mailmap 2025-10-23 15:17:44 +02:00
ltdk
ebd5bea84f Revert inference failure from Deref/Borrow constification 2025-10-23 08:51:27 -04:00
bors
11d2046fe9 Auto merge of #148022 - Zalathar:rollup-3m6ty9u, r=Zalathar
Rollup of 2 pull requests

Successful merges:

 - rust-lang/rust#140463 (Document MaybeUninit bit validity)
 - rust-lang/rust#148017 (Add TidyFlags and merge DiagCtx)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-10-23 11:22:38 +00:00
Stuart Cook
5ff30d3daf Rollup merge of #148017 - simp4t7:add-tidy-flags, r=Kobzol
Add TidyFlags and merge DiagCtx

Adds a struct `TidyFlags` and merges it with `DiagCtx` into `TidyCtx`. Removes the need to pass `bless` into individual check functions in tidy.
2025-10-23 22:10:15 +11:00
Stuart Cook
c5e4a5f121 Rollup merge of #140463 - joshlf:patch-13, r=RalfJung
Document MaybeUninit bit validity

Partially addresses https://github.com/rust-lang/unsafe-code-guidelines/issues/555 by clarifying that it is sound to write any byte values (initialized or uninitialized) to any `MaybeUninit<T>` regardless of `T`.

r? `@RalfJung`
2025-10-23 22:10:14 +11:00
Guillaume Gomez
c18cd774b3 [rustdoc] Simplify module rendering and HTML tags handling 2025-10-23 12:59:29 +02:00
T
dbeb7faaed add TidyFlags and merge DiagCtx
reorder impl block

changed is_bless to is_bless_enabled
2025-10-23 08:19:38 +00:00
bors
469357eb48 Auto merge of #148014 - jhpratt:rollup-aglren3, r=jhpratt
Rollup of 3 pull requests

Successful merges:

 - rust-lang/rust#134316 (Add `String::replace_first` and `String::replace_last`)
 - rust-lang/rust#147713 (Retire ast::TyAliasWhereClauses.)
 - rust-lang/rust#148011 (Revert constification of `AsRef for Cow` due to inference failure )

r? `@ghost`
`@rustbot` modify labels: rollup
2025-10-23 08:17:05 +00:00
A4-Tacks
c00dfa3a11 Heuristic sensing parenthesis completion of fields
We have conducted heuristic sensing on method parentheses, but it cannot complete fields

Example
---
```rust
struct Foo { far: i32 }
impl Foo {
    fn foo(&self) {}
}
fn foo() -> (i32, i32) {
    let foo = Foo { far: 4 };
    foo.f$0
    (2, 3)
}
```

**Before this PR**:

```text
me foo()  fn(&self)
...
```

**After this PR**:

```text
fd far          i32
me foo()  fn(&self)
...
```
2025-10-23 14:49:55 +08:00
Chayim Refael Friedman
3f8c2129d7 Merge pull request #20888 from ShoyuVanilla/bump-rustc-deps
internal: Bump rustc deps
2025-10-23 06:06:46 +00:00
Jacob Pratt
5d55418a7d Rollup merge of #148011 - clarfonthey:const-convert-revert, r=oli-obk
Revert constification of `AsRef for Cow` due to inference failure

Reported issue: rust-lang/rust#147964
Original PR: rust-lang/rust#145279
`const AsRef` tracking issue: rust-lang/rust#143773

Should have additional crater run to verify this fixes the issue.
2025-10-23 01:22:06 -04:00
Jacob Pratt
0185feb7db Rollup merge of #147713 - cjgillot:where-cfg, r=fmease
Retire ast::TyAliasWhereClauses.

`ast::TyAliasWhereClauses` is a tentative to avoid forgetting predicates when manipulating the AST.
It is incompatible with `cfg` attributes on where clauses.

This PR uses a regular `WhereClause` for the "second" clause.

Fixes https://github.com/rust-lang/rust/issues/138010
cc https://github.com/rust-lang/rust/pull/138037
2025-10-23 01:22:06 -04:00
Jacob Pratt
4491efbc82 Rollup merge of #134316 - zachs18:string_replace_in_place_rebase, r=joshtriplett
Add `String::replace_first` and `String::replace_last`

Rebase of #97977 (cc `@WilliamVenner)`

> Convenience methods that use `match_indices` and `replace_range` to efficiently replace a substring in a string without reallocating, if capacity (and the implementation of `Vec::splice`) allows.

The intra-doc link to `str::replacen` is a direct url-based link to `str::replacen` in `std`'s docs to work around #98941. This means that when building only `alloc`'s docs (and not `std`'s), it will be a broken link. There is precedent for this e.g. in [`core::hint::spin_loop`](https://doc.rust-lang.org/nightly/src/core/hint.rs.html#214) which links to `std:🧵:yield_now` using a [url-based link](https://github.com/rust-lang/rust/blob/master/library/core/src/hint.rs#L265) and thus is a dead link when only building `core`'s docs.

ACP: https://github.com/rust-lang/libs-team/issues/506
2025-10-23 01:22:05 -04:00
bors
4b3ba5844e Auto merge of #147793 - cjgillot:no-null-op, r=scottmcm,oli-obk
Replace NullOp::SizeOf and NullOp::AlignOf by lang items.

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

Fixes https://github.com/rust-lang/rust/issues/119729
Keeps https://github.com/rust-lang/rust/issues/136175 as it involves `offset_of!` which this PR does not touch.

r? `@ghost`
2025-10-23 05:09:25 +00:00
bors
7838ce1a3a Auto merge of #148012 - Zalathar:rollup-ed6cnn8, r=Zalathar
Rollup of 4 pull requests

Successful merges:

 - rust-lang/rust#115501 (Add new inherit_handles flag to CommandExt trait)
 - rust-lang/rust#146629 (std: reorganize the UNIX-internal `weak` module)
 - rust-lang/rust#147762 (feat(rustdoc): `--emit=depinfo` output to stdout via `-`)
 - rust-lang/rust#148001 (fix: Don't add diff symbol to unchanged lines)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-10-23 02:01:36 +00:00
Stuart Cook
2f7e07bb4a Rollup merge of #148001 - Muscraft:fix-diff-symbol-unchanged-lines, r=fmease
fix: Don't add diff symbol to unchanged lines

When rendering a "multi-line" suggestion with the [`Diff`](dc1feabef2/compiler/rustc_errors/src/emitter.rs (L3078)) format, `rustc` uses a [diff symbol](dc1feabef2/compiler/rustc_errors/src/emitter.rs (L3017-L3022)) for
[any line that has a highlight part](dc1feabef2/compiler/rustc_errors/src/emitter.rs (L2705-L2713)). This includes highlight parts that are highlighting nothing, i.e., a span of `0..0`. This leads `rustc` to add a diff symbol unnecessarily to lines that have no changes and are not highlighted. This PR makes it so that `rustc` will not add a diff symbol to lines that contain no changes/highlights.

Note: This PR is part of my ongoing effort to have `rustc` use `annotate-snippets` for rendering. This change will make it so that `rustc` and `annotate-snippets` will match in this case.
2025-10-23 12:06:32 +11:00
Stuart Cook
b397b6b5b7 Rollup merge of #147762 - weihanglo:rustdoc-depinfo-stdout, r=fmease
feat(rustdoc): `--emit=depinfo` output to stdout via `-`

rustdoc's `--emit=depinfo` flag now supports using `-` to write the output to stdout,
aligning with rustc's behavior.

This will fix <https://github.com/rust-lang/rust/issues/147649>.

### How to review

* The first commit demonstrates that `rustdoc --emit=depinfo=-` hasn't yet supported emitting to stdout.
* The second implements it and the diff shows how the behavior changes.
2025-10-23 12:06:32 +11:00
Stuart Cook
e93ec9aab4 Rollup merge of #146629 - joboet:reorganize-weak, r=ibraheemdev
std: reorganize the UNIX-internal `weak` module

This moves the `dlsym`-based and weak-linkage versions of the `weak!` macro into separate files, both of which include a common test file. As a result, both versions will be tested on all the platforms where they are used.

Since the `#[link_name]` arm of the `dlsym` version was unused, I've removed it. I've also removed the unused `raw_syscall!` and non-Linux `syscall!` macros and gated the `#[allow(dead_code, unused_macros)]` to only apply on non-Linux platforms, so compilation will fail if `weak` turns out to be unused on all platforms.

The last change concerns the use of `dlsym!` on FreeBSD: it is only used once, to link against `sysctlbyname`. But that symbol is always available, so there is no need for weak linkage.
2025-10-23 12:06:31 +11:00
Stuart Cook
e4bf8b3fc3 Rollup merge of #115501 - michaelvanstraten:set_inherit_handles, r=ChrisDenton
Add new inherit_handles flag to CommandExt trait

This PR adds a new flag to the [`CommandExt`](https://doc.rust-lang.org/stable/std/os/windows/process/trait.CommandExt.html) trait to set whether to inherit the handles of the calling process ([ref][1]).

This is necessary when, for example, spawning a process with a `pseudoconsole` attached.

r? ``@ChrisDenton``

ACP: https://github.com/rust-lang/libs-team/issues/264
[1]: <https://learn.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-createprocessw>
2025-10-23 12:06:30 +11:00
Camille Gillot
15c91bf308 Retire ast::TyAliasWhereClauses. 2025-10-23 00:40:01 +00:00
Camille Gillot
5dfbf67f94 Replace NullOp::SizeOf and NullOp::AlignOf by lang items. 2025-10-23 00:38:28 +00:00
ltdk
cb7fb35ad1 Revert inference failure from AsRef constification 2025-10-22 20:31:43 -04:00
Shoyu Vanilla (Flint)
e13aab74c9 Merge pull request #20884 from ChayimFriedman2/fix-cfg-error
fix: Fix "cannot insert `true` or `false` to cfg" error in fixtures
2025-10-23 00:11:51 +00:00
Shoyu Vanilla
9610f01c52 Port CanonicalInstantiator from rustc 2025-10-23 09:09:49 +09:00
Shoyu Vanilla
40e36a0687 Bump rustc deps 2025-10-23 08:40:18 +09:00
bors
6244effd03 Auto merge of #147810 - bjorn3:lto_refactors6, r=wesleywiser
Split LTO out of the main codegen coordinator event loop into a separate event loop on the same thread

This will make it easier to in the future move all this code to link_binary.

Follow up to https://github.com/rust-lang/rust/pull/146209
Part of https://github.com/rust-lang/compiler-team/issues/908
2025-10-22 22:50:15 +00:00
Scott Schafer
c7f014ddc6 fix: Don't add diff symbol to unchanged lines 2025-10-22 15:30:57 -06:00
Jonathan Brouwer
24502dd2d2 Improve suggestions for cfg_attr
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-10-22 21:57:13 +02:00