Commit Graph

28201 Commits

Author SHA1 Message Date
bors
c82d168b79 Auto merge of #16979 - Nadrieril:contiguous-enum-id, r=Veykril
pattern analysis: Use contiguous indices for enum variants

The main blocker to using the in-tree version of the `pattern_analysis` crate is that rustc requires enum indices to be contiguous because it uses `IndexVec`/`BitSet` for performance. Currently we swap these out for `FxHashMap`/`FxHashSet` when the `rustc` feature is off, but we can't do that if we use the in-tree crate.

This PR solves the problem by using contiguous indices on the r-a side too.
2024-04-01 12:15:23 +00:00
bors
a6ddf5fb80 Auto merge of #16961 - Wilfred:fix_crate_ids, r=Veykril
Fix crate IDs when multiple workspaces are loaded

Previously, we assumed that the crate numbers in a `rust-project.json` always matched the `CrateId` values in the crate graph. This isn't true when there are multiple workspaces, because the crate graphs are merged and the `CrateId` values in the merged graph are different.

This broke flycheck (see first commit), because we were unable to find the workspace when a file changed, so we every single flycheck, producing duplicate compilation errors.

Instead, use the crate root module path to look up the relevant flycheck. This makes `ProjectWorkspace::Json` consistenet with `ProjectWorkspace::Cargo`.

Also, define a separate JSON crate number type, to prevent bugs like this happening again.
2024-04-01 10:43:06 +00:00
bors
2678660880 Auto merge of #16924 - poliorcetics:ab/push-kxwqvtypvlsq, r=Veykril
feat: Add `rust-analyzer.cargo.allTargets` to configure passing `--all-targets` to cargo invocations

Closes #16859

## Unresolved question:

Should this be a setting for build scripts only ? All the other `--all-targets` I found where already covered by `checkOnSave.allTargets`
2024-04-01 10:30:15 +00:00
Nadrieril
7e8f2d8fd3 Use contiguous indices for enum variants 2024-04-01 12:27:16 +02:00
bors
f3f14d4552 Auto merge of #16970 - Wilfred:fix_tasks, r=Veykril
Fix tasks in tasks.json

#16839 refactored the representation of tasks inside the VS Code extension. However, this data type is exposed to users, who can define their own tasks in the same format in `tasks.json` or `.code-workspace`.

Revert the data type to have a `command` field rather than a `program` field, and document the different fields. This code is also a little complex, so split out a `cargoToExecution` to handle the Task to Execution conversion logic.

After this change, any tasks.json with a `command` field works again. For example, the following tasks.json works as expected:

```
{
	"version": "2.0.0",
	"tasks": [
		{
			"type": "cargo",
			"command": "build",
			"problemMatcher": [
			  "$rustc"
			],
			"group": "build",
			"label": "my example cargo build task"
		}
	]
}
```

Fixes #16943 #16949
2024-04-01 10:17:07 +00:00
bors
9774b114c6 Auto merge of #16986 - roife:update-issue-template, r=Veykril
update: add editor/extension information to bug report template

When attempting to reproduce issues, I encounter difficulties due to differences in versions of LSP clients and editors (such as #16985, #16867, and more)

This sometimes consumes a lot of efforts from contributors to communicate the details about LSP client information. Therefore, I believe adding editor/extension information to the issue template would be helpful for problem reproduction.
2024-04-01 10:03:57 +00:00
roife
d0d23a250d update: add editor/extension information to bug report template 2024-04-01 14:01:56 +08:00
bors
e4a405f877 Auto merge of #16983 - lnicola:sync-from-rust, r=lnicola
minor: sync from downstream
2024-03-31 11:48:14 +00:00
Laurențiu Nicola
424054a8aa Merge branch 'master' into sync-from-rust 2024-03-31 14:32:00 +03:00
Laurențiu Nicola
d3fb9f798a Merge commit 'f5a9250147f6569d8d89334dc9cca79c0322729f' into sync-from-ra 2024-03-31 09:57:00 +03:00
Wilfred Hughes
a758e349bc Document CargoTaskDefinition and factor out converting TaskDefinition to Execution 2024-03-29 16:07:22 -07:00
Wilfred Hughes
e8d6a5ec0b Rename RustTargetDefinition to CargoTaskDefinition 2024-03-29 16:07:22 -07:00
bors
f5a9250147 Auto merge of #16975 - HKalbasi:test-explorer, r=HKalbasi
Prompt the user to reload the window when enabling test explorer
2024-03-29 17:01:51 +00:00
hkalbasi
34cde2cebc Prompt the user to reload the window when enabling test explorer 2024-03-29 18:08:16 +03:30
bors
9d84142ef2 Auto merge of #16974 - dfireBird:generic_params_refactor, r=lnicola
refactor: Implement len and is_empty method in generic_params
2024-03-29 13:15:08 +00:00
dfireBird
69c4ac6304
implement len and is_empty method in generic_params 2024-03-29 18:26:46 +05:30
bors
a8b7acf22f Auto merge of #16971 - HKalbasi:test-explorer, r=HKalbasi
Resolve tests per file instead of per crate in test explorer

Fix part of #16827
2024-03-29 02:06:22 +00:00
hkalbasi
beec6914c8 Resolve tests per file instead of per crate in test explorer 2024-03-29 05:34:43 +03:30
bors
ab10eea62e Auto merge of #16967 - dfireBird:fix-16963, r=lnicola
fix: ADT hover considering only type or const len not lifetimes

I feel like test doesn't do much. Please suggest if I should improve it?

Fixes #16963
2024-03-28 16:45:45 +00:00
dfireBird
34a8cd6a7a
fix ADT hover considering only type or const len not lifetimes 2024-03-28 21:53:22 +05:30
bors
899db83128 Auto merge of #16957 - poliorcetics:ab/push-tlzsqmqqurxs, r=lnicola
fix: check for client support of relative glob patterns before using them

Fixes #16955
2024-03-28 08:57:29 +00:00
bors
29a8e65bbe Auto merge of #16965 - roife:use-lldb-for-cpp-ext, r=lnicola
fix: use lldb when debugging with C++ extension on MacOS

See https://github.com/rust-lang/rust-analyzer/issues/16901#issuecomment-2024486941

This PR resolves the issue of being unable to debug using the C++ extension on macOS. By using special configurations for the `MIMode` on macOS, it enables the C++ extension to connect to lldb when debugging (without affecting other platforms).
2024-03-28 06:49:49 +00:00
roife
3521089985 fix: use lldb when debugging with C++ extension 2024-03-28 14:38:23 +08:00
bors
4bf521df35 Auto merge of #16964 - lnicola:debugger-order, r=roife
fix: Revert debug extension priorities

Close #16901
2024-03-28 06:08:47 +00:00
Laurențiu Nicola
662ea73e4e Revert debug extension priorities 2024-03-28 07:58:36 +02:00
Wilfred Hughes
0f72ab1dd3 Define a separate type for crate indexes in a rust-project.json 2024-03-27 14:18:52 -07:00
bors
ad51a17c62 Auto merge of #16960 - dfireBird:fix-16958, r=lnicola
fix: lifetime length are not added in count of params in highlight

I found these two instances easily but I wonder how many such instances are there.

Fixes #16958
2024-03-27 18:05:45 +00:00
dfireBird
20b12c2bac
fix lifetime length are not added in count of params in highlight 2024-03-27 23:21:17 +05:30
Wilfred Hughes
5e370b1cb8 Use crate root to choose relevant workspace for flycheck 2024-03-27 10:33:20 -07:00
Alexis (Poliorcetics) Bourget
8f9a58c73d
fix: check for client support of relative glob patterns before using them 2024-03-27 03:21:34 +01:00
Alexis (Poliorcetics) Bourget
174af88e76
feat: Add rust-analyzer.cargo.allTargets to configure passing --all-targets to cargo invocations 2024-03-27 01:57:41 +01:00
bors
4b33850c39 Auto merge of #16951 - lnicola:provenance-split-comment, r=lnicola
minor: Update comment on provenance_split

Hope I got this right `@dfireBird.`
2024-03-26 09:00:24 +00:00
Laurențiu Nicola
85947bba49 Update comment on provenance_split 2024-03-26 10:58:35 +02:00
bors
0583aaa555 Auto merge of #16805 - dfireBird:lifetime_lowering, r=Veykril
feat: Implement resolving and lowering of Lifetimes (no inference yet)
2024-03-26 07:58:43 +00:00
dfireBird
0e54e2b55a
use references in Generics iter methods 2024-03-26 13:04:54 +05:30
bors
e52bb8cddb Auto merge of #16906 - Young-Flash:limit_struct_hover_display, r=Veykril
feat: limit struct hover display nums

follow up https://github.com/rust-lang/rust-analyzer/pull/15847, https://github.com/rust-lang/rust-analyzer/pull/15938
2024-03-25 22:13:59 +00:00
bors
9b79fa2393 Auto merge of #16930 - lnicola:dist-malloc, r=Veykril
internal: Support choosing the allocator in `xtask dist`
2024-03-25 22:01:23 +00:00
bors
dacfa72f85 Auto merge of #16944 - Nadrieril:update-pat-ana, r=lnicola
Revert to the crates.io version of rustc_pattern_analysis

The API hasn't fully settled yet, and there's an extra wrinkle with `IdxContainer` which blocked the [subtree update](https://github.com/rust-lang/rust/pull/122981). Let's just keep using the crates.io version for a bit longer.

r? `@lnicola`
2024-03-25 12:17:18 +00:00
Nadrieril
1716cc8433 Revert to the crates.io version of rustc_pattern_analysis 2024-03-25 13:09:37 +01:00
Young-Flash
58013ad70d add test for struct field hover display limit 2024-03-25 19:55:19 +08:00
Young-Flash
ba8c9810aa review update 2024-03-25 19:55:19 +08:00
Young-Flash
a89e417ce5 adjust test 2024-03-25 19:55:19 +08:00
Young-Flash
1c85234bcd limit struct field hover display nums 2024-03-25 19:55:19 +08:00
Young-Flash
d81148a009 expose config for hover struct field display 2024-03-25 19:55:19 +08:00
bors
6f6b03f9de Auto merge of #16935 - Nilstrieb:dont-panic, r=HKalbasi
Handle panicking like rustc CTFE does

Instead of using `core::fmt::format` to format panic messages, which may in turn panic too and cause recursive panics and other messy things, redirect `panic_fmt` to `const_panic_fmt` like CTFE, which in turn goes to `panic_display` and does the things normally. See the tests for the full call stack.

The tests don't work yet, I probably missed something in minicore.

fixes #16907 in my local testing, I also need to add a test for it
2024-03-24 18:17:36 +00:00
bors
3dfd4c1f4c Auto merge of #16915 - 6d7a:master, r=HKalbasi
fix: Prevent stack overflow in recursive const types

In the evaluation of const values of recursive types certain declarations could cause an endless call-loop within the interpreter (hir-ty’s create_memory_map), which would lead to a stack overflow.
This commit adds a check that prevents values that contain an address in their value (such as TyKind::Ref) from being allocated at the address they contain.
The commit also adds a test for this edge case.
2024-03-24 15:05:14 +00:00
Nilstrieb
2dfe7de8b6 Handle panicking like rustc CTFE does
Instead of using `core::fmt::format` to format panic messages, which may in turn
panic too and cause recursive panics and other messy things, redirect
`panic_fmt` to `const_panic_fmt` like CTFE, which in turn goes to
`panic_display` and does the things normally. See the tests for the full
call stack.
2024-03-24 15:40:26 +01:00
6d7a
142ef764ee fix: Check stack depth to prevent stack overflows in create_memory_map 2024-03-24 10:19:25 +01:00
Laurențiu Nicola
f6b9cff105 Support choosing the allocator in xtask dist 2024-03-23 11:48:21 +02:00
Laurențiu Nicola
84d38c7e94 Move xtask flags around outide the generated section 2024-03-23 11:35:32 +02:00