Commit graph

31825 commits

Author SHA1 Message Date
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
bors
afe015b8f9 Auto merge of #18216 - davidbarsky:davidbarsky/push-ustyovtqrpoq, r=davidbarsky
internal: switch remaining OpQueues to use named structs

Building atop of https://github.com/rust-lang/rust-analyzer/pull/18195, I switched `GlobalState::fetch_build_data_queue` to use a struct instead of a tuple.

(I didn't switch `fetch_proc_macros_queue` to not return a bool, as the return value is only used in one spot.)
2024-10-14 14:05:42 +00: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
0402da4cbf Auto merge of #18265 - kouhe3:master, r=Veykril
Add support for LLDB-DAP
2024-10-14 12:21:42 +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
bors
d7628c0a8b Auto merge of #18281 - darichey:async-subprocess, r=lnicola
Run subprocesses async in vscode extension

Extensions should not block the vscode extension host. Replace uses of `spawnSync` with `spawnAsync`, a convenience wrapper around `spawn`.

These `spawnSync`s are unlikely to cause a real issue in practice, because they spawn very short-lived processes, so we aren't blocking for very long. That said, blocking the extension host is poor practice, and if they _do_ block for too long for whatever reason, vscode becomes useless.
2024-10-12 07:45:15 +00:00
bors
b551482c41 Auto merge of #18289 - darichey:fix-relative-buildfiles, r=lnicola
Fix panic when json project has relative buildfile paths

The `build_file` path may be relative to the workspace root.
2024-10-12 07:30:26 +00:00
David Richey
eded3a8e29 Fix panic when json project has relative buildfile paths 2024-10-12 02:25:40 -05:00
David Richey
0260e41283 Run subprocesses async in vscode extension 2024-10-10 20:44:13 -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
bors
9aa4293594 Auto merge of #18269 - jhgg:hir-ty/change-struct-constructor-formatting, r=flodiebold
hir-ty: change struct + enum variant 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

likewise the second commit, also makes this uniform for enum variants as well.

fixes #18259
2024-10-09 07:09:06 +00: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
bors
efaf8bd5de Auto merge of #18267 - lnicola:sync-from-rust, r=lnicola
minor: Sync from downstream
2024-10-08 11:27:18 +00:00
Laurențiu Nicola
b9e58a2379 Merge from rust-lang/rust 2024-10-08 14:25:39 +03:00
Laurențiu Nicola
a9ed9c51fd Preparing for merge from rust-lang/rust 2024-10-08 14:25:24 +03:00
bors
9806060d55 Auto merge of #18266 - lnicola:macos-13, r=lnicola
internal: Use macos-13 runners and bump MACOSX_DEPLOYMENT_TARGET to 13.0

As Monterey seems to be EOL.
2024-10-08 10:39:04 +00:00
Laurențiu Nicola
525c1ceaf0 Use macos-13 runners and bump MACOSX_DEPLOYMENT_TARGET 2024-10-08 13:00:58 +03:00
kouhe3
9a207be986 prettier format 2024-10-08 17:50:29 +08:00
kouhe3
e9c8a84a35 semicolon 2024-10-08 17:47:54 +08:00
kouhe3
64caa6bbf1 fix array sourceMap 2024-10-08 17:43:02 +08:00
kouhe3
82b114dbf0 lldbdap env dict to string 2024-10-08 15:11:31 +08:00
kouhe3
85caf88b54 add knownEngines lldb-dap 2024-10-08 00:22:58 +08:00
bors
2b750da1a1 Auto merge of #18255 - ChayimFriedman2:stack-overflow, r=HKalbasi
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).

Fixes #18223 (who thought DFS will be the problem).
2024-10-06 21:23:00 +00: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
bors
b1cc7b0746 Auto merge of #130540 - veera-sivarajan:fix-87525, r=estebank
Add a Lint for Pointer to Integer Transmutes in Consts

Fixes #87525

This PR adds a MirLint for pointer to integer transmutes in const functions and associated consts. The implementation closely follows this comment: https://github.com/rust-lang/rust/pull/85769#issuecomment-880969112. More details about the implementation can be found in the comments.

Note: This could break some sound code as mentioned by RalfJung in https://github.com/rust-lang/rust/pull/85769#issuecomment-886491680:

> ... technically const-code could transmute/cast an int to a ptr and then transmute it back and that would be correct -- so the lint will deny some sound code. Does not seem terribly likely though.

References:
1. https://doc.rust-lang.org/std/mem/fn.transmute.html
2. https://doc.rust-lang.org/reference/items/associated-items.html#associated-constants
2024-10-06 02:39:23 +00: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
d03c7511be Auto merge of #130157 - eduardosm:stabilize-const_float_classify, r=RalfJung
Stabilize `const_float_classify`

Tracking issue: https://github.com/rust-lang/rust/issues/72505

Also reverts https://github.com/rust-lang/rust/pull/114486

Closes https://github.com/rust-lang/rust/issues/72505

Stabilized const API:

```rust
impl f32 {
    pub const fn is_nan(self) -> bool;
    pub const fn is_infinite(self) -> bool;
    pub const fn is_finite(self) -> bool;
    pub const fn is_subnormal(self) -> bool;
    pub const fn is_normal(self) -> bool;
    pub const fn classify(self) -> FpCategory;
    pub const fn is_sign_positive(self) -> bool;
    pub const fn is_sign_negative(self) -> bool;
}

impl f64 {
    pub const fn is_nan(self) -> bool;
    pub const fn is_infinite(self) -> bool;
    pub const fn is_finite(self) -> bool;
    pub const fn is_subnormal(self) -> bool;
    pub const fn is_normal(self) -> bool;
    pub const fn classify(self) -> FpCategory;
    pub const fn is_sign_positive(self) -> bool;
    pub const fn is_sign_negative(self) -> bool;
}
```

cc `@rust-lang/wg-const-eval` `@rust-lang/libs-api`
2024-10-04 18:03:16 +00:00