Commit graph

28190 commits

Author SHA1 Message Date
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
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
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
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
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