Commit Graph

19669 Commits

Author SHA1 Message Date
Milo Moisson
c5686c8941
fix: set the right postfix snippets competion source range
Changed the completion item source_range to match
the replaced text. Though in VS Code it may not be
disturbing because the snippet is previewed in a
box, but in Helix editor, it's previewed by applying
the main text edit.
2024-04-03 00:00:34 +02:00
bors
c3b8c2a254 Auto merge of #16996 - Veykril:lt-err, r=Veykril
internal: Lower outlive goals, respect them in display impls
2024-04-02 14:13:22 +00:00
Lukas Wirth
600747a1b4 Fix patch_cfg_if not applying with stitched sysroot 2024-04-02 15:04:40 +02:00
Lukas Wirth
707be6b99c Adjust display impls to respect lifetime bounds 2024-04-02 14:51:08 +02:00
Lukas Wirth
0927f86247 Replace static_lifetime usages with error_lifetime, lower outlives goals 2024-04-02 14:51:06 +02:00
bors
23dd54b010 Auto merge of #16968 - roife:fix-issue-16801, r=Veykril
fix: silence mismatches involving unresolved projections

fix #16801
2024-04-01 20:05:33 +00:00
roife
2636e44378 fix: simplify the usage of UnknownMismatch 2024-04-02 03:26:32 +08:00
roife
3d373fec8c tests: add tests for mismatches with unresolved projections 2024-04-02 01:32:43 +08:00
roife
8d6b65c544 fix: silence mismatches involving unresolved projections 2024-04-02 01:27:22 +08:00
bors
3691380c35 Auto merge of #16920 - Veykril:clippy-lints, r=Veykril
internal: Fix new nightly clippy lints
2024-04-01 16:00:18 +00:00
Lukas Wirth
2ae3e57c26 Fix new clippy lints 2024-04-01 17:55:56 +02:00
bors
ff8a24a740 Auto merge of #16988 - Veykril:config-docs, r=Veykril
fix: Fix `allFeatures` config docs
2024-04-01 12:28:14 +00:00
Lukas Wirth
ff279f1e91 Fix allFeatures config docs 2024-04-01 14:16:36 +02:00
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
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
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
Wilfred Hughes
0f72ab1dd3 Define a separate type for crate indexes in a rust-project.json 2024-03-27 14:18:52 -07: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
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
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
84d38c7e94 Move xtask flags around outide the generated section 2024-03-23 11:35:32 +02:00
Sculas
966d387afa
fix: Rename func_like to FuncLike
Fixes rust-lang/rust-analyzer#16926
2024-03-22 23:03:44 +01:00
Lukas Wirth
8e324e98a1 Rename ProcMacroKind::FuncLike to Bang 2024-03-22 11:20:56 +01:00
roife
0e8170e846 fix: handle self::super in lowering of UseTree 2024-03-22 15:36:00 +08:00
bors
5577612fd0 Auto merge of #16918 - Veykril:utf8-paths, r=Veykril
fix: Don't assert paths being utf8 when filtering them in the watcher

Closes https://github.com/rust-lang/rust-analyzer/issues/16914
2024-03-22 07:06:13 +00:00
Lukas Wirth
ea447062c4 fix: Don't assert paths being utf8 when filtering them in the watcher 2024-03-22 08:04:50 +01:00
6d7a
7c1be82cd9 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-21 22:57:21 +01:00
bors
7ef7f442fc Auto merge of #16913 - Veykril:client-watched-files, r=Veykril
fix: Some file watching related vfs fixes

Fixes https://github.com/rust-lang/rust-analyzer/issues/15554, additionally it seems that client side file watching was broken on windows this entire time, this PR switches `DidChangeWatchedFilesRegistrationOptions` to use relative glob patterns which do work on windows in VSCode.
2024-03-21 20:29:02 +00:00