Commit Graph

28211 Commits

Author SHA1 Message Date
Johann Hemmann
454e481422 Add edition to all parse functions of the parser crate 2024-04-14 15:07:43 +02:00
Johann Hemmann
392538c830 Add edition to parser struct 2024-04-14 15:06:09 +02:00
bors
f3c7bd0c90 Auto merge of #17064 - Veykril:inlay-hints-fix, r=Veykril
minor: Carry inlay hint resolve hash as a string
2024-04-14 10:27:40 +00:00
Lukas Wirth
189aba7943 minor: Carry inlay hint resolve hash as a string 2024-04-14 10:55:20 +02:00
bors
7dad0a231e Auto merge of #17063 - Veykril:inlay-hints-fix, r=Veykril
fix: Fix inlay hint resolution being broken

So, things broke because we now store a hash (u64) in the resolution payload, but javascript and hence JSON only support integers of up to 53 bits (anything beyond gets truncated in various ways) which caused almost all hashes to always differ when resolving them. This masks the hash to 53 bits to work around that.

Fixes https://github.com/rust-lang/rust-analyzer/issues/16962
2024-04-14 06:28:40 +00:00
Lukas Wirth
2c5c12acfe fix: Fix inlay hint resolution being broken 2024-04-14 08:27:24 +02:00
bors
beb205f347 Auto merge of #17062 - Veykril:disable-unlinked-file-popup, r=Veykril
Temporarily disable unlinked file popup

Not gonna look into this until the next release, so I'd rather disable it for the time being
2024-04-13 22:55:03 +00:00
Lukas Wirth
ff9ebc747d Temporarily disable unlinked file popup 2024-04-13 22:45:22 +02:00
bors
773b4a5ac7 Auto merge of #17019 - Wilfred:source_root_prefixes, r=Veykril
fix: VFS should not confuse paths with source roots that have the same prefix

Previously, the VFS would assign paths to the source root that had the longest string prefix match. This would break when we had source roots in subdirectories:

```
/foo
/foo/bar
```

Given a file `/foo/bar_baz.rs`, we would attribute it to the `/foo/bar` source root, which is wrong.

As a result, we would attribute paths to the wrong crate when a crate was in a subdirectory of another one. This is more common in larger monorepos, but could occur in any Rust project.

Fix this in the VFS, and add a test.
2024-04-13 20:30:08 +00:00
bors
9b1946250f Auto merge of #17054 - roife:fix-issue-17036, r=Veykril
Revert "fix: set the right postfix snippets competion source range"

This reverts commit c5686c8941.

Fix #17036. See https://github.com/rust-lang/rust-analyzer/issues/17036#issuecomment-2050185641
2024-04-13 19:34:45 +00:00
bors
e1d7ce71ae Auto merge of #17051 - roife:auto-closing-for-triple-backticks, r=Veykril
fix: support auto-closing for triple backticks

It might fix #16051, see https://github.com/rust-lang/rust-analyzer/issues/16051#issuecomment-2042606030
2024-04-13 19:22:03 +00:00
bors
85542e0de3 Auto merge of #17035 - Wilfred:windows_ci_on_prs, r=Veykril
Run Windows tests on PRs too

Previously PRs would only do a build on Windows, which confusingly meant that PRs got a green tick for Windows despite not testing them.

See discussion in #17019.
2024-04-13 19:07:13 +00:00
bors
a1884b0958 Auto merge of #17030 - Veykril:bump-chalk, r=Veykril
internal: Bump chalk

And make use of the new error lifetime
2024-04-13 18:54:17 +00:00
bors
0636e7c436 Auto merge of #17059 - Kohei316:refactor-generate-function, r=Veykril
internal: make function builder create ast directly

I am working on #17050.
In the process, I noticed a place in the code that could be refactored.
Currently, the `function builder` creates the `ast` through the `function template` , but those two processes can be combined into one function.
I thought I should work on this first and created a PR.
2024-04-13 18:41:27 +00:00
morine0122
145078e09f make function builder create ast directly 2024-04-13 20:16:12 +09:00
bors
07ae540f4e Auto merge of #17056 - HKalbasi:test-explorer, r=HKalbasi
Run cargo test per workspace in the test explorer

fix #16875
fix #17022
2024-04-13 03:27:47 +00:00
hkalbasi
964afc92c1 Run cargo test per workspace in the test explorer 2024-04-13 06:22:58 +03:30
roife
7528460151 Revert "fix: set the right postfix snippets competion source range"
This reverts commit c5686c8941.
2024-04-12 19:20:41 +08:00
roife
4346bbcd92 fix: support auto-closing for triple backticks 2024-04-11 18:46:22 +08:00
bors
657b33b0cb Auto merge of #17033 - ShoyuVanilla:flyck-log, r=Veykril
Log flycheck errors

Resolves #16969

The non-cargo messages are appended to the error strings here;

7a8374c162/crates/flycheck/src/lib.rs (L460-L482)

that one is formatted into `Err` here;

7a8374c162/crates/flycheck/src/command.rs (L144-L155)

and finally, this PR appends it at the end of existing Flycheck error message
2024-04-11 07:01:20 +00:00
bors
a5feb4f05f Auto merge of #17034 - ColinKinloch:flatpak_sdk_rust_enable, r=lnicola
Document enabling the flatpak rust SDK extension

Just having `org.freedesktop.Sdk.Extension.rust-stable` and `org.freedesktop.Sdk.Extension.llvm15` installed is not enough.
`/usr/lib/sdk/rust-stable/bin` at least needs to be added to the `PATH`.

In the case of VSCodium [ide-flatpak-wrapper](https://github.com/noonsleeper/ide-flatpak-wrapper) in included to do this.
2024-04-09 11:53:28 +00:00
Wilfred Hughes
b03844d786 [vfs] Don't confuse paths with source roots that have the same prefix 2024-04-08 15:48:04 -07:00
Wilfred Hughes
6df559f706 Run Windows tests on PRs too
Previously PRs would only do a build on Windows, which confusingly
meant that PRs got a green tick for Windows despite not testing them.

See discussion in #17019.
2024-04-08 11:36:09 -07:00
Colin Kinloch
81ef59f6ff Document enabling the flatpak rust SDK extension 2024-04-08 18:00:29 +01:00
Shoyu Vanilla
f7a66fd94c Log flycheck errors 2024-04-09 01:21:25 +09:00
Lukas Wirth
8078c3d9e8 Bump chalk 2024-04-08 11:03:19 +02:00
bors
7a8374c162 Auto merge of #17029 - lnicola:revert-jemalloc, r=lnicola
Revert "Use jemalloc for releases"

This reverts commit 692c41e593: https://github.com/rust-lang/rust-analyzer/actions/runs/8592641551/job/23542950551.
2024-04-08 05:42:56 +00:00
Laurențiu Nicola
14252e16df Revert "Use jemalloc for releases"
This reverts commit 692c41e593.
2024-04-08 08:40:06 +03:00
bors
d9c29afaee Auto merge of #17023 - Veykril:cleanup, r=Veykril
internal: Some cleanup and perf
2024-04-06 13:06:11 +00:00
Lukas Wirth
a82e028e30 Cleanup util::Generics method names 2024-04-06 14:29:40 +02:00
Lukas Wirth
f3567bb604 Arc CrateData::cfg_options 2024-04-06 13:55:10 +02:00
Lukas Wirth
336dee3415 Remove some allocs 2024-04-06 13:40:15 +02:00
Lukas Wirth
13890697eb Simplify 2024-04-06 13:12:07 +02:00
bors
9cced6da93 Auto merge of #17016 - HKalbasi:test-explorer, r=HKalbasi
Apply cargo flags in test explorer

cc #16827
2024-04-05 00:06:41 +00:00
hkalbasi
eab385e1f6 Apply cargo flags in test explorer 2024-04-05 02:37:40 +03:30
bors
6a852d7627 Auto merge of #17007 - lnicola:jemalloc, r=lnicola
internal: Use jemalloc in releases

Closes #1441
2024-04-04 13:17:37 +00:00
bors
f8a4553d02 Auto merge of #17014 - Veykril:runnables-exported-main-test, r=Veykril
fix: Consider `exported_name="main"` functions in test modules as tests

Fixes https://github.com/rust-lang/rust-analyzer/issues/17011
2024-04-04 13:04:44 +00:00
Lukas Wirth
5957835cdf Consider exported_name="main" functions in test modules as tests 2024-04-04 14:51:10 +02:00
Laurențiu Nicola
692c41e593 Use jemalloc for releases 2024-04-03 18:25:34 +03:00
bors
8e581ac348 Auto merge of #17003 - krobelus:utf8-positions-multibyte, r=Veykril
Fix off-by-one error converting to LSP UTF8 offsets with multi-byte char

On this file,

```rust
fn main() {
    let 된장 = 1;
}
```

when using `"positionEncodings":["utf-16"]` I get an "unused variable" diagnostic on the variable
name (codepoint offset range `8..10`). So far so good.

When using `positionEncodings":["utf-8"]`, I expect to get the equivalent range in bytes (LSP:
"Character offsets count UTF-8 code units (e.g bytes)."), which is `8..14`, because both
characters are 3 bytes in UTF-8.  However I actually get `10..14`.

Looks like this is because we accidentally treat a 1-based index as an offset value: when
converting from our internal char-indices to LSP byte offsets, we look at one character to many.
This causes wrong results if the extra character is a multi-byte one, such as when computing
the start coordinate of 된장.

Fix that by actually passing an offset. While at it, fix the variable name of the line number,
which is not an offset (yet).

Originally reported at https://github.com/kakoune-lsp/kakoune-lsp/issues/740
2024-04-03 14:58:16 +00:00
bors
c0eb78e839 Auto merge of #17006 - Veykril:cfg-censor-fixes, r=Veykril
fix: Fix some cfg censoring bugs

Fixes https://github.com/rust-lang/rust-analyzer/issues/16947
2024-04-03 14:45:19 +00:00
Lukas Wirth
2b62d4b2ba Fix some cfg censoring bugs 2024-04-03 16:43:08 +02:00
Johannes Altmanninger
d24b0ba330 Fix off-by-one error converting to LSP UTF8 offsets with multi-byte char
On this file,

```rust
fn main() {
    let 된장 = 1;
}
```

when using `"positionEncodings":["utf-16"]` I get an "unused variable" diagnostic on the variable
name (codepoint offset range `8..10`). So far so good.

When using `positionEncodings":["utf-8"]`, I expect to get the equivalent range in bytes (LSP:
"Character offsets count UTF-8 code units (e.g bytes)."), which is `8..14`, because both
characters are 3 bytes in UTF-8.  However I actually get `10..14`.

Looks like this is because we accidentally treat a 1-based index as an offset value: when
converting from our internal char-indices to LSP byte offsets, we look at one character to many.
This causes wrong results if the extra character is a multi-byte one, such as when computing
the start coordinate of 된장.

Fix that by actually passing an offset. While at it, fix the variable name of the line number,
which is not an offset (yet).

Originally reported at https://github.com/kakoune-lsp/kakoune-lsp/issues/740
2024-04-03 14:46:51 +02:00
bors
5b08b1776c Auto merge of #17000 - mrnossiom:master, r=Veykril
fix: set the right postfix snippets competion source range

Hi 👋,

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.

Before :
![image](https://github.com/rust-lang/rust-analyzer/assets/43814157/75960e02-64f0-4ecd-964f-7e1dd894c713)

After :
![image](https://github.com/rust-lang/rust-analyzer/assets/43814157/84102f0e-9c81-4e7c-8ab5-a25986630e6f)

Thanks
2024-04-03 08:37:12 +00:00
bors
0140272daa Auto merge of #17002 - Veykril:layout-defaults, r=Veykril
internal: Consider ADT generic parameter defaults for unsubstituted layout calculations

For one, this brings back layout information for lifetime generic ADTs (which "regressed" when we started adding lifetimes to chalks-ir), but it also allows layout calculation to work for definitions that don't actually use the generics (where its only used in a `PhantomData` for example)
2024-04-03 07:04:19 +00:00
Lukas Wirth
86967032f7 Consider ADT generic parameter defaults for unsubstituted layout calculations 2024-04-03 09:01:27 +02:00
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
bors
54faa03121 Auto merge of #16997 - Veykril:cfg-if-patch, r=Veykril
fix: Fix `patch_cfg_if` not applying with stitched sysroot

The condition was inverted accidentally..
2024-04-02 13:06:35 +00:00
Lukas Wirth
600747a1b4 Fix patch_cfg_if not applying with stitched sysroot 2024-04-02 15:04:40 +02:00