Commit graph

31729 commits

Author SHA1 Message Date
bors
68f3e4d636 Auto merge of #18204 - ChrisDenton:cc, r=lnicola
Update cc to 1.1.22

This version of `cc` contains [a fix](https://github.com/rust-lang/cc-rs/releases/tag/cc-v1.1.22) to prevent spurious rebuilds. Hopefully this should help avoid the CI issues rustc has been having.
2024-09-27 17:57:14 +00:00
Chris Denton
c4103bdf59
Update cc to 1.1.22 2024-09-27 17:50:06 +00:00
bors
62649a57be Auto merge of #17923 - basvandriel:feature/build-before-restart-debug, r=Veykril
Building before a debugging session was restarted

# Background
Resolves #17901. It adds support for rebuilding after debugging a test was restarted. This means the test doesn't have to be aborted and manually re-ran again.

# How this is tested
First, all the Visual Studio Code extensions are loaded into an Extension Host window. Then, a sample test like below was ran and restarted to see if it was correctly rebuild.

```rust
#[test]
fn test_x() {
    assert_eq!("1.1.1", "1.1.0");
}
```
2024-09-27 11:06:21 +00:00
bors
233b1ac14e Auto merge of #18196 - DropDemBits:sed-syntax-factory, r=Veykril
internal: Add `SyntaxFactory` to ease generating nodes with syntax mappings

Part of [#​15710](https://github.com/rust-lang/rust-analyzer/issues/15710)

Instead of requiring passing a `&mut SyntaxEditor` to every make constructor to generate mappings, we instead wrap that logic in `SyntaxFactory`, and afterwards add all the mappings to the `SyntaxEditor`.

Includes an example of using `SyntaxEditor` & `SyntaxFactory` in the `extract_variable` assist.
2024-09-27 05:44:11 +00:00
bors
c482421316 Auto merge of #18197 - alibektas:buggy_flycheck_message, r=Veykril
minor: Stricter requirements for package wide flycheck

Require the existence of a target and `check_workspace` to be false to restart package-wide flycheck. Fixes #18194 , #18104
2024-09-27 05:14:35 +00:00
Ali Bektas
aeed8f89a3 minor: Require both the existence of a target and check_workspace to be false to restart package-wide flycheck 2024-09-27 02:40:53 +02:00
DropDemBits
f9ad9a0bb6
minor: Use SyntaxEditor in extract_variable 2024-09-26 16:29:16 -04:00
DropDemBits
05b48e4005
internal: Add SyntaxFactory to ease generating nodes with syntax mappings 2024-09-26 16:28:48 -04:00
bors
c88ea11832 Auto merge of #18193 - Wilfred:startup_error, r=lnicola
fix: Don't report a startup error when a discover command is configured

Previously, r-a would show an error if both fetch_workspaces_queue and discover_workspace_queue were empty. We're in this state at startup, so users would see an error if they'd configured
discover_workspace_config.

Instead, allow the fetch_workspaces_queue to have zero items if discover_workspace_config is set.

Whilst we're here, prefer "failed to fetch" over "failed to discover", so the error message better reflects what this function is doing.
2024-09-26 18:56:08 +00:00
Wilfred Hughes
f498184cbb fix: Don't report a startup error when a discover command is configured
Previously, r-a would show an error if both fetch_workspaces_queue and
discover_workspace_queue were empty. We're in this state at startup,
so users would see an error if they'd configured
discover_workspace_config.

Instead, allow the fetch_workspaces_queue to have zero items if
discover_workspace_config is set.

Whilst we're here, prefer "failed to fetch" over "failed to discover",
so the error message better reflects what this function is doing.
2024-09-26 14:33:30 -04:00
bors
af9a658864 Auto merge of #18188 - darichey:msrv, r=lnicola
Require rust 1.81

rust-analyzer doesn't build on 1.80 because we use `#[expect(lint)]`:
```
error[E0658]: the `#[expect]` attribute is an experimental feature
  --> crates/hir-expand/src/prettify_macro_expansion_.rs:11:1
   |
11 | #[expect(deprecated)]
   | ^^^^^^^^^^^^^^^^^^^^^
   |
   = note: see issue #54503 <https://github.com/rust-lang/rust/issues/54503> for more information
```
2024-09-26 10:54:00 +00:00
David Richey
0536f18db2 Require rust 1.81 2024-09-25 17:02:17 -04:00
bors
88fad4983e Auto merge of #18180 - kpreid:search, r=davidbarsky
feat: Index workspace symbols at startup rather than on the first symbol search.

This will eliminate potential many-second delays when performing the first search, at the price of making cache priming (“Indexing N/M” in the VS Code status bar) take a little longer in total. Hopefully this additional time is insignificant because a typical session will involve at least one symbol search.

Further improvement would be to do this as a separate parallel task (which will be beneficial if the workspace contains a small number of large crates), but that would require significant additional refactoring of the progress-reporting mechanism to understand multiple tasks per crate. Happy to tackle that in this PR if desired, but I thought I'd propose the minimal change first.
2024-09-25 17:14:39 +00:00
bors
df478ea93c Auto merge of #18181 - davidbarsky:davidbarsky/push-nzstpumovmmx, r=davidbarsky
internal: add tracing to project discovery and VFS loading

With `"env RA_PROFILE=vfs_load|parallel_prime_caches|discover_command>500`, this results in the following output:

```
21888ms discover_command
11627ms vfs_load @ total = 701
1503ms vfs_load @ total = 701
30211ms parallel_prime_caches
```

As a followup, I'd like to make hprof emit the information above as JSON.
2024-09-25 16:48:05 +00:00
Kevin Reid
a050c5de9b Prime caches for symbol search too. 2024-09-25 09:41:09 -07:00
David Barsky
338003f30e internal: add tracing to project discovery and VFS loading 2024-09-25 10:10:25 -04:00
Bas van Driel
b4f278b463
Changes for debug restarting 2024-09-25 15:02:36 +02:00
bors
7ab2c171bf Auto merge of #18183 - lnicola:sync-from-rust, r=lnicola
internal: Sync from downstream
2024-09-25 06:41:56 +00:00
bors
82b2d07f6a Auto merge of #18184 - Veykril:veykril/push-wsqsyxynttps, r=Veykril
fix: Pass all-targets for build scripts in more cli commands

Without this, build scripts don't run for tests and as such any proc-macros in dev-deps fail to resolve
2024-09-25 06:27:31 +00:00
Laurențiu Nicola
f4bcae32fe Run rustfmt 2024-09-25 09:26:15 +03:00
Lukas Wirth
10ada02019 Pass all-targets for build scripts in more cli commands
Without this, build scripts don't run for tests and as such any proc-macros in dev-deps fail to resolve
2024-09-25 08:23:09 +02:00
Laurențiu Nicola
6c24765cd4 Add more LayoutError variants 2024-09-25 09:15:11 +03:00
Laurențiu Nicola
d0c3ef0ae4 Bump rustc crates 2024-09-25 09:05:38 +03:00
Laurențiu Nicola
37f7190b3e Merge from rust-lang/rust 2024-09-25 09:00:53 +03:00
Laurențiu Nicola
d62a3e74fe Preparing for merge from rust-lang/rust 2024-09-25 09:00:31 +03:00
bors
34842bc6ab Auto merge of #129587 - Voultapher:opt-for-size-variants-of-sort-impls, r=cuviper
Add `optimize_for_size` variants for stable and unstable sort as well as select_nth_unstable

- Stable sort uses a simple merge-sort that re-uses the existing - rather gnarly - merge function.
- Unstable sort jumps directly to the branchless heapsort fallback.
- select_nth_unstable jumps directly to the median_of_medians fallback, which is augmented with a custom tiny smallsort and partition impl.

Some code is duplicated but de-duplication would bring it's own problems. For example `swap_if_less` is critical for performance, if the sorting networks don't inline it perf drops drastically, however `#[inline(always)]` is also a poor fit, if the provided comparison function is huge, it gives the compiler an out to only instantiate `swap_if_less` once and call it. Another aspect that would suffer when making `swap_if_less` pub, is having to cfg out dozens of functions in in smallsort module.

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

r​? `@Kobzol`
2024-09-24 18:48:08 +00:00
bors
2f55a91552 Auto merge of #18164 - ShoyuVanilla:use-as-alias, r=Veykril
fix: Temporary fix for `remove_unused_imports` not handling import aliases correctly

Fixes #18129
2024-09-24 15:22:57 +00:00
Shoyu Vanilla
d4de84f58a fix: Temporary fix for remove_unused_imports not handling import aliases correctly 2024-09-24 23:48:04 +09:00
bors
af6b99c159 Auto merge of #130389 - Luv-Ray:LLVMMDNodeInContext2, r=nikic
llvm: replace some deprecated functions

`LLVMMDStringInContext` and `LLVMMDNodeInContext` are deprecated, replace them with `LLVMMDStringInContext2` and `LLVMMDNodeInContext2`.
Also replace `Value` with `Metadata` in some function signatures for better consistency.
2024-09-24 12:07:48 +00:00
bors
e775dd6c70 Auto merge of #18166 - ChayimFriedman2:dollar-crate-root, r=Veykril
fix: Fix a bug in span map merge, and add explanations of how span maps are stored

Because it took me hours to figure out that contrary to common sense, the offset stored is the *end* of the node, and we search by the *start*. Which is why we need a convoluted `partition_point()` instead of a simple `binary_search()`. And this was not documented at all. Which made me make mistakes with my implementation of `SpanMap::merge()`.

The other bug fixed about span map merging is correctly keeping track of the current offset in presence of multiple sibling macro invocations. Unrelated, but because of the previous issue it took me hours to debug, so I figured out I'll put them together for posterity.

Fixes #18163.
2024-09-24 11:01:05 +00:00
bors
f30d4ea9c0 Auto merge of #18161 - ChayimFriedman2:postfix-mut, r=Veykril
fix: Better support references in consuming postfix completions

Fixes #18155.
2024-09-24 10:46:48 +00:00
bors
a159b370ba Auto merge of #18160 - ChayimFriedman2:fix-18138, r=Veykril
fix: Fix name resolution when an import is resolved to some namespace and then later in the algorithm another namespace is added

The import is flagged as "indeterminate", and previously it was re-resolved, but only at the end of name resolution, when it's already too late for anything that depends on it.

This issue was tried to fix in https://github.com/rust-lang/rust-analyzer/pull/2466, but it was not fixed fully.

That PR is also why IDE features did work: the import at the end was resolved correctly, so IDE features that re-resolved the macro path resolved it correctly.

I was concerned about the performance of this, but this doesn't seem to regress `analysis-stats .`, so I guess it's fine to land this. I have no idea about the incremental perf however and I don't know how to measure that, although when typing in `zbus` (including creating a new function, which should recompute the def map) completion was fast enough.

I didn't check what rustc does, so maybe it does something more performant, like keeping track of only possibly problematic imports.

Fixes #18138.
Probably fixes #17630.
2024-09-24 10:32:28 +00:00
bors
b6b56d2abe Auto merge of #18157 - davidbarsky:davidbarsky/respect-disabling-proc-macros-in-analysis-stats, r=Veykril
analysis-stats: respect `--disable-proc-macros` flag

I noticed that this flag wasn't being respected by `analysis-stats` when profiling proc macro expansion, so here's a small fix.
2024-09-24 10:17:56 +00:00
bors
b4eff8971d Auto merge of #18123 - jhgg:fix-ambigius-package-cargo-check, r=Veykril
fix: fix ambigious package name in flycheck

fixes #18121
2024-09-24 10:03:41 +00:00
bors
7eb10bda57 Auto merge of #18175 - Wilfred:completion_marker, r=Veykril
internal: Make COMPLETION_MARKER more explicitly r-a

If a user ever sees the completion marker, it's confusing to see text about IntelliJ. Use a string that's more explicitly about completion for rust-analyzer.
2024-09-24 09:49:25 +00:00
bors
dfee4c8690 Auto merge of #18162 - ChayimFriedman2:gat-object-safe, r=Veykril
fix: Consider lifetime GATs object unsafe

Fixes #18156.
2024-09-24 08:14:00 +00:00
bors
f7ca65ff56 Auto merge of #130620 - onur-ozkan:update-make-prepare, r=Kobzol
remove workaround for make prepare and use dry-run build instead

Removes an annoying hard-coded logic.

try-job: x86_64-msvc
2024-09-23 22:19:24 +00:00
Wilfred Hughes
d95ad12c9c internal: Make COMPLETION_MARKER more explicitly r-a
If a user ever sees the completion marker, it's confusing to see text
about IntelliJ. Use a string that's more explicitly about completion
for rust-analyzer.
2024-09-23 17:04:04 -04:00
bors
3d0343251f Auto merge of #18172 - lnicola:expect-attr-completions, r=davidbarsky
fix: Support expect in attribute completion and hover

Fixes #18171
2024-09-23 15:16:15 +00:00
Laurențiu Nicola
a6572e9234 Support expect in attribute completion and hover 2024-09-23 14:55:50 +03:00
bors
3d1569dc2c Auto merge of #130641 - cuviper:llvm-19.1.0, r=nikic
Update to LLVM 19.1.0

This is a branch rebase of the submodule, now that LLVM 19.1.0 is final.
Our *only* extra patch right now is the one we're carrying for SGX unwind.
2024-09-23 10:54:29 +00:00
bors
b3a3bf770a Auto merge of #18170 - rust-lang:revert-18169-disable-gh-releases, r=lnicola
minor: Revert "internal: Disable GitHub releases for now"

Turns out, this wasn't needed for long.
2024-09-23 08:52:30 +00:00
Laurențiu Nicola
8a49375f64
Revert "internal: Disable GitHub releases for now" 2024-09-23 11:47:37 +03:00
bors
00037a0d67 Auto merge of #129047 - DianQK:early_otherwise_branch_scalar, r=cjgillot
Apply `EarlyOtherwiseBranch` to scalar value

In the future, I'm thinking of hoisting discriminant via GVN so that we only need to write very little code here.

r? `@cjgillot`
2024-09-23 07:22:29 +00:00
bors
1301e4268f Auto merge of #18169 - lnicola:disable-gh-releases, r=lnicola
internal: Disable GitHub releases for now

These are currently throwing `Error: HttpError: Resource not accessible by integration` because of the organization change, let's disable them for today's release.
2024-09-23 05:58:48 +00:00
Laurențiu Nicola
aed88d349a Disable GitHub releases for now 2024-09-23 08:56:27 +03:00
bors
bbffadb673 Auto merge of #130680 - saethlin:module-name-to-str, r=jieyouxu
Call module_name_to_str instead of just unwrapping

This makes the ICE message in https://github.com/rust-lang/rust/issues/130678 more clear. It looks like not calling this function was just an oversight in https://github.com/rust-lang/rust/pull/76859, but clearly not a major one because it's taken us 4 years to notice.

try-job: i686-msvc
2024-09-22 23:14:12 +00:00
Chayim Refael Friedman
b275f37db6 Fix a bug in span map merge, and add explanations of how span maps are stored
Because it took me hours to figure out that contrary to common sense, the offset stored is the *end* of the node, and we search by the *start*. Which is why we need a convoluted `partition_point()` instead of a simple `binary_search()`. And this was not documented at all. Which made me make mistakes with my implementation of `SpanMap::merge()`.

The other bug fixed about span map merging is correctly keeping track of the current offset in presence of multiple sibling macro invocations. Unrelated, but because of the previous issue it took me hours to debug, so I figured out I'll put them together for posterity.
2024-09-23 01:54:40 +03:00
bors
77c49ae70a Auto merge of #130697 - bjoernager:const-char-make-ascii, r=dtolnay
Mark `char::make_ascii_uppercase` and `char::make_ascii_lowercase` as const.

Relevant tracking issue: #130698

The `make_ascii_uppercase` and `make_ascii_lowercase` methods in `char` should be marked "const."

With the stabilisation of [`const_mut_refs`](https://github.com/rust-lang/rust/issues/57349/), this simply requires adding the `const` specifier to the function signatures.
2024-09-22 13:55:07 +00:00
Chayim Refael Friedman
141833850c Consider lifetime GATs object unsafe 2024-09-22 15:00:01 +03:00