Commit Graph

26316 Commits

Author SHA1 Message Date
bors
548d2f08e0 Auto merge of #15575 - HKalbasi:mir, r=HKalbasi
Intern projections in mir place

I hope this reduces mir memory usage.
2023-09-08 09:28:46 +00:00
bors
829e77709e Auto merge of #15524 - vsrs:bind_unused_param, r=Veykril
Bind unused parameter assistant

This PR introduces a new **Bind unused parameter assistant**.

While we do have a QuickFix from `rustc` (prefixing the parameter with an underscore), it's sometimes more convenient to suppress the warning using the following approach:
```rust
 fn some_function(unused: i32) {}
```
->
```rust
fn some_function(unused: i32) {
    let _ = unused;
}
```
2023-09-08 09:12:31 +00:00
hkalbasi
9708a29e57 Intern projections in mir place 2023-09-08 12:39:41 +03:30
Lukas Wirth
fddef42e92 Only set rust-analyzer cfg for workspace members 2023-09-08 11:02:56 +02:00
Lukas Wirth
e9e2c1ae75 Update project-model test outputs 2023-09-08 10:49:15 +02:00
Lukas Wirth
853f8a21f7 Fix cfg completions not working 2023-09-08 10:49:15 +02:00
Lukas Wirth
ca6ddd8ea3 Enable rust_analyzer for cfgs when code is being analyzed by rust-analyzer 2023-09-08 10:49:12 +02:00
bors
3325622230 Auto merge of #15430 - alibektas:deunwrap/wrap_return_type_in_result, r=Veykril
minor : Deunwrap wrap_return_type_in_result

#15398 subtask 7
2023-09-08 08:24:29 +00:00
bors
fac77a8a07 Auto merge of #15558 - davidbarsky:davidbarsky/add-companion-extension-integration, r=Veykril
code: remove `rust-analyzer.discoverProjectCommand` in favor of a companion extension

I think it's time to remove this functionality from the `rust-analyzer` and move it into a dedicated extension responsible for this. Selfishly, this changes makes it tenable to do progress reporting to the editor and potentially do some more complicated things around managing _which_ workspaces are being used.
2023-09-08 08:02:44 +00:00
bors
47e0d07eb0 Auto merge of #15573 - alibektas:15539/into_to_from, r=Veykril
assist : `into_to_qualified_from`

fixes #15539. This assist converts an `.into()` call into an explicit fully qualified `from()` call.
2023-09-08 07:44:24 +00:00
bors
5ddad87b1a Auto merge of #15574 - alibektas:15572/false_crate_name_env, r=Veykril
minor : use crate name for `CARGO_CRATE_NAME`

fixes #15572 . Until now we used the package name as a replacement of crate name. With this PR r-a first sets all the env variables it set before and on top of those it tries to set `CARGO_CRATE_NAME` to crates name, following envvar's naming convention.
2023-09-08 07:25:34 +00:00
Ali Bektas
506a477acf Use cargo name as the CARGO_CRATE_NAME instead of package name 2023-09-08 01:41:00 +02:00
Ali Bektas
9762f764ae Add assist into_to_qualified_from
This assist converts an `.into()` call into an explicit
fully qualified from call.
2023-09-07 23:43:46 +02:00
David Barsky
912b22fa07 add doc comment to rustc_cfg::RustcCfgConfig 2023-09-07 15:30:11 -04:00
David Barsky
fad3823a20 rename rustc_cfg::Config to rustc_cfg::RustcCfgConfig and import 2023-09-07 15:19:04 -04:00
David Barsky
553152e2d5 refactor rustc_cfg to be more inline with docs/dev/style.md 2023-09-07 15:06:51 -04:00
bors
d5b6ab2fa5 Auto merge of #15571 - Veykril:mir-alloc, r=Veykril
Remove allocation on mir eval memory write
2023-09-07 17:27:57 +00:00
Lukas Wirth
cd53bd6b8e Remove allocation on mir eval memory write 2023-09-07 18:41:50 +02:00
David Barsky
5b5bce8aaf project-model: when using rust-project.json, prefer the sysroot-defined rustc over an env-based one 2023-09-07 11:46:14 -04:00
bors
8edd81f166 Auto merge of #15568 - Veykril:upstream-rustc-ap, r=Veykril
Replace format-args parser with upstream fork

Turns out we can't bump rustc_abi right now because it got its generics removed accidentally https://github.com/rust-lang/rust/pull/107163
2023-09-07 09:52:08 +00:00
Lukas Wirth
10b0cd7047 Replace format-args parser with upstream fork 2023-09-07 11:37:59 +02:00
bors
d04cff6102 Auto merge of #15567 - HKalbasi:mir, r=HKalbasi
Ignore enum variants in analysis stats of mir bodies
2023-09-06 21:42:42 +00:00
hkalbasi
e4c469321c Ignore enum variants in analysis stats of mir bodies 2023-09-07 01:08:47 +03:30
bors
77b359ae31 Auto merge of #15532 - SomeoneToIgnore:more-brackets-on-type-formatting, r=Veykril
On type format '(', by adding closing ')' automatically

If I understand right, `()` can surround pretty much the same `{}` can, so add another on type formatting pair for convenience: sometimes it's not that pleasant to write parenthesis in `Some(2).map(|i| (i, i+1))` cases and I would prefer r-a to do that for me.

One note: currently, b06503b6ec/crates/rust-analyzer/src/handlers/request.rs (L357) fires always.
Should we remove the assertion entirely now, since apparently things work in release despite that check?
2023-09-06 20:32:04 +00:00
bors
5906c26e85 Auto merge of #15565 - Veykril:mir, r=Veykril
Implement `write_via_move` intrinsic for mir-eval

Required for getting `write!`ing to work again. we fail with an odd type mimsatch eval error after this change though
2023-09-06 20:12:48 +00:00
bors
a843e4699e Auto merge of #15564 - davidbarsky:davidbarsky/use-current-subcrates-rustfmt-toml-with-custom-command, r=Veykril
internal: use current folder's `rustfmt.toml` with all rustfmt configurations

## Introduction

Resolves https://github.com/rust-lang/rust-analyzer/issues/15540. I moved the `chdir` functionality outside of the `match` to ensure that this functionality wouldn’t fall through again. As part of this PR, I also changed `from_proto::file_range` to accept a `TextDocumentIdentifier` by reference instead of by value, but I can undo this change if desired.

## Testing

I added a `rustfmt.toml` will the contents below at `crates/rust-analyzer/rustfmt.toml`:


```toml
reorder_modules = false
use_small_heuristics = "Max"
# this is the only difference from the `rustfmt.toml` at the root of the repo
tab_spaces = 8
```

In addition, I've also added `"rust-analyzer.rustfmt.overrideCommand": ["rustfmt"]` to my VS Code configuration.

With the above changes, saving `crates/rust-analyzer/src/handlers/request.rs` results in 8-space indentation. Meanwhile, saving `crates/toolchain/src/lib.rs` _does not_ result in any formatting changes.
2023-09-06 19:51:07 +00:00
Lukas Wirth
f13b184eb3 Implement write_via_move intrinsic for mir-eval 2023-09-06 21:49:16 +02:00
David Barsky
42f77f89ff internal: use current subcrate's rustfmt.toml with all rustfmt configurations 2023-09-06 15:32:38 -04:00
bors
f29867bd26 Auto merge of #15559 - Veykril:builtin-format-args, r=Veykril
Implement builtin#format_args, using rustc's format_args parser

`format_args!` now expands to `builtin#format_args(template, args...)`, the actual expansion now instead happens in lowering where we desugar this expression by using lang paths.

As a bonus, we no longer need to evaluate `format_args` as an eager macro which means less macro expansions overall -> less cache thrashing!

Fixes https://github.com/rust-lang/rust-analyzer/issues/15082
2023-09-06 17:44:33 +00:00
Lukas Wirth
96f19231d3 Fix hir pretty printing emitting trailing whitespace 2023-09-06 19:31:48 +02:00
Lukas Wirth
5046889f43 Don't allocate the format_args template string as an expression 2023-09-06 19:18:12 +02:00
Lukas Wirth
3fa0bf0dd3 Fix ide-diagnostics test fixture 2023-09-06 18:31:16 +02:00
Lukas Wirth
c0e402637e Emit builtin#format_args in builtin format_args expander 2023-09-06 18:08:20 +02:00
Lukas Wirth
5fdd1e36e3 Remove todo!()s 2023-09-06 15:30:44 +02:00
Lukas Wirth
e243a03da1 Desugar builtin#format_args 2023-09-06 15:21:41 +02:00
bors
b9a9722bda Auto merge of #15556 - gigaroby:master, r=lnicola
Update notify to 6.1.1

Unlike version 6.0.1, this does not pull windows-sys 0.45.0 as observed in #15077.

```
$ cargo tree --target=x86_64-pc-windows-gnu --charset=ascii | grep windows-sys

|           |   `-- windows-sys v0.42.0
|   |   |   |   |   |       `-- windows-sys v0.42.0 (*)
|       `-- windows-sys v0.48.0
    |   |   `-- windows-sys v0.48.0 (*)
    |   `-- windows-sys v0.48.0 (*)
|   `-- windows-sys v0.48.0 (*)
|   `-- windows-sys v0.42.0 (*)
```
2023-09-05 20:01:54 +00:00
David Barsky
6260c635ee fmt 2023-09-05 15:45:52 -04:00
Lukas Wirth
abe8f1ece4 Implement builtin#format_args, using rustc's format_args parser 2023-09-05 19:19:46 +02:00
David Barsky
68781aeab0 fix some more lints 2023-09-05 12:38:33 -04:00
David Barsky
1ee7f54fa6 fix lints 2023-09-05 12:38:33 -04:00
David Barsky
b1b044f2d5 code: yeet rust-analyzer.discoverProjectCommand 2023-09-05 12:38:33 -04:00
bors
caeea45999 Auto merge of #15557 - Veykril:builtin-syntax, r=Veykril
Parse builtin# syntax and add typechecking for builtin#offset_of expression

Also removes box syntax, fixes https://github.com/rust-lang/rust-analyzer/issues/14504

cc https://github.com/rust-lang/compiler-team/issues/580 https://github.com/rust-lang/rust-analyzer/issues/15082
2023-09-05 12:10:31 +00:00
Lukas Wirth
3431d586e5 Insert builtin#asm into asm! expansion 2023-09-05 14:00:49 +02:00
Lukas Wirth
15048304e3 Implement offset_of in hir-def and hir-ty 2023-09-05 12:27:52 +02:00
Lukas Wirth
9b8eb807a3 Parse builtin# syntax 2023-09-05 10:36:35 +02:00
Roberto Bampi
4f22e1a187 Update notify to 6.1.1
Unlike version 6.0.1, this does not pull windows-sys 0.4.5 as observed in #15077.

$ cargo tree --target=x86_64-pc-windows-gnu --charset=ascii | grep windows-sys

|           |   `-- windows-sys v0.42.0
|   |   |   |   |   |       `-- windows-sys v0.42.0 (*)
|       `-- windows-sys v0.48.0
    |   |   `-- windows-sys v0.48.0 (*)
    |   `-- windows-sys v0.48.0 (*)
|   `-- windows-sys v0.48.0 (*)
|   `-- windows-sys v0.42.0 (*)
2023-09-04 18:00:12 +02:00
bors
2df30e1e07 Auto merge of #15553 - Veykril:metrics-hyper, r=Veykril
Add hyper-0.14.18 to metrics

should give us a bit of async stuff
2023-09-03 09:42:32 +00:00
Lukas Wirth
db4684ef6c Add hyper-0.14.18 to metrics 2023-09-03 11:39:29 +02:00
bors
63867dd477 Auto merge of #15552 - Veykril:metrics-new, r=Veykril
Bump `rustc-perf` checkout for metrics, replace webrender, diesel and ripgrep with newer versions

The previous versions were removed hence the updates. The metric results for the changed ones are disconnected now as to not muddle things up.

I think it's worth it for us to occasionally bump the `rustc-perf` checkout, as it allows us to include more interesting new targets.

Notably, the newer diesel is 3 times as fast to analyze as the one of the current checkout.
2023-09-03 08:34:45 +00:00
Lukas Wirth
f76f025889 Fix metrics CI to use new json file names 2023-09-03 10:34:32 +02:00