Commit graph

20863 commits

Author SHA1 Message Date
Lukas Wirth
e5af3ae427 fix: Fix CI running analysis-stats incorrectly against the standard libraries 2024-10-18 12:34:55 +02:00
Laurențiu Nicola
2fe603efe7 Bump rustc crates 2024-10-17 13:11:12 +02:00
Laurențiu Nicola
7ae97c1ef1 Merge from rust-lang/rust 2024-10-17 10:04:49 +03:00
Varun Gandhi
6db78a82d4 Bump version of scip crate 2024-10-17 13:19:48 +08:00
Wilfred Hughes
36b9f09917 internal: Use local time when formatting logs
When debugging rust-analyzer and looking at logs, it's much easier to read
when the timestamp is in the local timezone.

Before:

    2024-08-28T20:55:38.792321Z  INFO ParseQuery: invoked at R18460

After:

    2024-08-28T13:55:38.792321-07:00  INFO ParseQuery: invoked at R18460
2024-10-16 15:22:57 -07:00
bors
418c1365ec Auto merge of #18278 - ShoyuVanilla:never-place, r=Veykril
Do not consider match/let/ref of place that evaluates to ! to diverge, disallow coercions from them too

Resolves #18237
2024-10-15 07:29:55 +00:00
roife
a521702d9c fix: autofix for missing wrapped unit in return expr 2024-10-15 14:23:58 +08:00
Shoyu Vanilla
91293ea4d4 Do not consider match/let/ref of place that evaluates to ! to diverge, disallow coercions from them too 2024-10-15 00:37:40 +09:00
bors
eff79f171b Auto merge of #18292 - roife:fix-issue-17427, r=Veykril
feat: handle self-param outside of methods when renaming

close #17427
2024-10-14 14:51:57 +00:00
roife
1e8a03a56e feat: handle self-param outside of methods when renaming 2024-10-14 22:32:34 +08:00
bors
77d4376e05 Auto merge of #18239 - davidbarsky:davidbarsky/push-lswkwuyrpuqv, r=davidbarsky
chore: rename `salsa` to `ra_salsa`

Laying some groundwork to start before I import the new Salsa crate. Here's why:
1. As part of the migration, `@darichey,` `@Wilfred,` and I will create new Salsa equivalents of the existing databases/query groups. We'll get them to compile crate-by-crate.
2. Once we wrote all equivalents of all queries, we'd start to refactor usage sites of the vendored Salsa to use the new Salsa databases.
3. Starting porting usage sites of old Salsa to the new Salsa.
4. Remove the vendored `ra_salsa`; declare victory.
2024-10-14 14:20:59 +00:00
David Barsky
ccee36e8dd chore: rename salsa to ra_salsa 2024-10-14 10:09:22 -04:00
David Barsky
501ef0ee5e internal: switch remaining OpQueues to use named structs 2024-10-14 10:04:04 -04:00
bors
7b2548bd8d Auto merge of #18291 - roife:fix-issue-18212, r=Veykril
feat: respect references.exclude_tests in call-hierarchy

close #18212

### Changes

1. feat: respect `references.exclude_tests` in call-hierarchy
2. Modified the description of `references.exclude_tests`
2024-10-14 12:50:40 +00:00
bors
c560660391 Auto merge of #18275 - darichey:fix-test-case-hang, r=Veykril
Skip #[test_case] expansion

Fixes #18274, although I don't fully understand if this is the best fix (it's not clear to me why this didn't cause issues before https://github.com/rust-lang/rust-analyzer/pull/18085).
2024-10-14 12:36:13 +00:00
bors
9f1f5cd8f6 Auto merge of #18252 - ShoyuVanilla:issue-15799, r=Veykril
fix: Do not consider mutable usage of deref to `*mut T` as deref_mut

Fixes #15799

We are doing some heuristics for deciding whether the given deref is deref or deref_mut here;

5982d9c420/crates/hir-ty/src/infer/mutability.rs (L182-L200)

But this heuristic is erroneous if we are dereferencing to a mut ptr and normally those cases are filtered out here as builtin;

5982d9c420/crates/hir-ty/src/mir/lower/as_place.rs (L165-L177)

Howerver, this works not so well if the given dereferencing is double dereferencings like the case in the #15799.

```rust
struct WrapPtr(*mut u32);

impl core::ops::Deref for WrapPtr {
    type Target = *mut u32;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}

fn main() {
    let mut x = 0u32;
    let wrap = WrapPtr(&mut x);
    unsafe {
        **wrap = 6;
    }
}
```

Here are two - outer and inner - dereferences here, and the outer dereference is marked as deref_mut because there is an assignment operation.
And this deref_mut marking is propagated into the inner dereferencing.
In the later MIR lowering, the outer dereference is filtered out as it's expr type is `*mut u32`, but the expr type in the inner dereference is an ADT, so this false-mutablility is not filtered out.

This PR cuts propagation of this false mutablilty chain if the expr type is mut ptr.
Since this happens before the resolve_all, it may have some limitations when the expr type is determined as mut ptr at the very end of inferencing, but I couldn't find simple fix for it 🤔
2024-10-14 12:07:31 +00:00
bors
513b514818 Auto merge of #18242 - Veykril:veykril/push-tnynzqsmtnqw, r=Veykril
internal: Don't resolve extern crates in import fix point resolution

The fix point loop won't progress them given the potential extern crate candidates are set up at build time.
2024-10-14 11:52:17 +00:00
bors
1e302c81a8 Auto merge of #18229 - mrkajetanp:rustfmt-path, r=Veykril
fix: Join rustfmt overrideCommand with project root

When providing a custom rustfmt command, join it with the project root instead of the workspace root. This fixes rust-analyzer getting the wrong invocation path in projects containing subprojects.

This makes the behaviour consistent with how a custom path provided in rust-analyzer.procMacro.server behaves already.

Resolves issue #18222
2024-10-14 11:37:56 +00:00
bors
574c89155b Auto merge of #18217 - ChayimFriedman2:cast-unknown-ptr, r=Veykril
fix: Comment out cast checks for unknown ptr kind

Just like we don't check for types containing unknown.

Fixes #18214.

See also https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Frust-analyzer/topic/Another.20case.20of.20.2318064.3F.
2024-10-14 11:24:08 +00:00
bors
4717b2bb14 Auto merge of #18152 - CryZe:highlight-async-block-exit-points, r=Veykril
feat: Highlight exit points of async blocks

Async blocks act similar to async functions in that the await keywords are related, but also act like functions where the exit points are related.

Fixes #18147
2024-10-14 11:09:33 +00:00
bors
b5187ab853 Auto merge of #18226 - SabrinaJewson:fix-impl-use, r=Veykril
Correctly parse `use` in generic parameters

Fixes: #18225
2024-10-14 10:40:37 +00:00
roife
b7ed8150a3 feat: respect references.exclude_tests in call-hierarchy 2024-10-13 05:19:28 +08:00
David Richey
eded3a8e29 Fix panic when json project has relative buildfile paths 2024-10-12 02:25:40 -05:00
David Richey
3d6acb3d60 Skip #[test_case] expansion 2024-10-09 19:34:08 -05:00
bors
0fb804acb3 Auto merge of #18245 - boattime:master, r=davidbarsky
fix: include description in label details when detail field is marked for …

Fixes https://github.com/rust-lang/rust-analyzer/issues/18231.

When omitting the autocomplete detail field, the autocomplete label details can still be returned. Currently the label details are missing the description field if the detail field is included in resolveSupport since it is being overwritten as None and opted to be sent with `completionItem/resolve`.

Example completion capabilities.
```
completion = {
    completionItem = {
        commitCharactersSupport = true,
        deprecatedSupport = true,
        documentationFormat = { "markdown", "plaintext" },
        insertReplaceSupport = true,
        insertTextModeSupport = {
            valueSet = { 1, 2 }
        },
        labelDetailsSupport = true,
        preselectSupport = true,
        resolveSupport = {
            properties = { "documentation", "detail", "additionalTextEdits", "sortText", "filterText", "insertText", "textEdit", "insertTextFormat", "insertTextMode" }
        },
        snippetSupport = true,
        tagSupport = {
            valueSet = { 1 }
        }
}
```
2024-10-09 20:23:52 +00:00
bors
7692c82e0b Auto merge of #18247 - jhgg:lsp/fix-something-to-resolve, r=Veykril
lsp: fix completion_item something_to_resolve not being a latch to true

while looking at #18245 i noticed that `something_to_resolve` could technically flap between true -> false if some subsequent fields that were requested to be resolved were empty.

this fixes that by using `|=` instead of `=` when assigning to `something_to_resolve` which will prevent it from going back to false once set.

although some cases it's simply assigning to `true` i opted to continue to use `|=` there for uniformity sake. but happy to change those back to `=`'s.

cc `@SomeoneToIgnore`
2024-10-09 15:35:33 +00:00
bors
e33e819b12 Auto merge of #18246 - ChayimFriedman2:fix-18238, r=Veykril
fix: Fix `prettify_macro_expansion()` when the node isn't the whole file

Fixes #18238.
2024-10-09 15:20:47 +00:00
Peter Jaszkowiak
ec11c27e5c Reserve guarded string literals (RFC 3593) 2024-10-08 18:21:16 -06:00
Christopher Serr
68c263bdf6 Only Highlight Exit Points on async Token
This ensures that when being on an `await` token, it still only
highlights the yield points and not the exit points.
2024-10-08 23:30:05 +02:00
Jake
9434ceba40
include fn prefix for all callable defs 2024-10-08 11:37:08 -07:00
Jake
5cba3e72bc
hir-ty: change struct constructor formatting.
before, when formatting struct constructor for `struct S(usize, usize)` it would format as:

    extern "rust-call" S(usize, usize) -> S

but after this change, we'll format as:

    fn S(usize, usize) -> S
2024-10-08 11:05:03 -07:00
Laurențiu Nicola
b9e58a2379 Merge from rust-lang/rust 2024-10-08 14:25:39 +03:00
Chayim Refael Friedman
13f853464c Use external stack in borrowck DFS
Because damnit, it can crash r-a. Why do people make this stupid DFSes anyway (I get it, it's easier until it blows).
2024-10-06 23:48:16 +03:00
Shoyu Vanilla
d3446a78a0 fix: Do not consider mutable usage of deref to *mut T as deref_mut 2024-10-07 01:49:14 +09:00
Jake
bab2a6ec94
lsp: fix completion_item something_to_resolve not being a latch to true 2024-10-05 15:51:23 -07:00
Chayim Refael Friedman
c8540e7079 Fix prettify_macro_expansion() when the node isn't the whole file 2024-10-05 22:39:33 +03:00
Max
b857a0b488 Include description in label details when detail field is marked for resolution 2024-10-05 13:27:03 -04:00
Lukas Wirth
597d8e837a Fix IDE layer not correctly resolving opt-in extern crates 2024-10-05 15:36:44 +02:00
Lukas Wirth
727555fc04 Add excluded extern-prelude IDE resolution test 2024-10-05 15:17:34 +02:00
Lukas Wirth
a898493b82 Turn ImportSource into a struct 2024-10-05 15:02:47 +02:00
Lukas Wirth
f7ca085690 Remove ImportSource::ExternCrate as the fixed point loop can't affect it 2024-10-05 15:02:47 +02:00
bors
5982d9c420 Auto merge of #18227 - davidbarsky:davidbarsky/push-lmntvwvznyyx, r=davidbarsky
internal: add json `tracing` Layer for profiling startup

On `buck2/integrations/rust-project`, this results in the following being printed:

```json
{"name":"discover_command","elapsed_ms":18703}
{"name":"parallel_prime_caches","elapsed_ms":0}
{"name":"vfs_load","elapsed_ms":5895}
{"name":"vfs_load","elapsed_ms":547}
{"name":"parallel_prime_caches","elapsed_ms":23}
{"name":"parallel_prime_caches","elapsed_ms":84}
{"name":"parallel_prime_caches","elapsed_ms":5819}
```
2024-10-04 17:59:02 +00:00
David Barsky
56c10ca981 internal: add JSON formatting for hprof 2024-10-04 11:26:15 -04:00
bors
510f72e12c Auto merge of #18234 - Veykril:veykril/push-vzynqtlxmrnl, r=Veykril
internal: Filter out opaque tokens in some IDE feature macro descensions
2024-10-04 10:26:04 +00:00
Lukas Wirth
24d65bb7cf internal: Filter out opaque tokens in some of IDE feature macro descensions 2024-10-04 11:53:12 +02:00
Kajetan Puchalski
6656460490
fix: Join rustfmt overrideCommand with project root
When providing a custom rustfmt command, join it with the project
root instead of the workspace root. This fixes rust-analyzer
getting the wrong invocation path in projects containing subprojects.

This makes the behaviour consistent with how a custom path provided
in rust-analyzer.procMacro.server behaves already.

Resolves issue #18222
2024-10-02 17:01:10 +01:00
SabrinaJewson
e735906839
fix: correctly parse use in generic parameters 2024-10-01 22:10:47 +01:00
Shoyu Vanilla
e09c2a08d7 Fix: Handle block exprs as modules when finding their parents 2024-10-01 14:05:15 +09:00
Chayim Refael Friedman
ff3c95f414 Comment out cast checks for unknown ptr kind
Just like we don't check for types containing unknown.
2024-09-30 19:26:16 +03:00
David Barsky
fc6eb66450 internal: remove Default from OpQueue 2024-09-30 10:12:52 -04:00