Commit Graph

26299 Commits

Author SHA1 Message Date
Victor Song
3682c3791b Set CARGO_TARGET_DIR when using Flycheck custom command 2023-10-09 02:15:05 -05:00
Victor Song
ef0b3bbef1 Clarify documentation on new parameter 2023-10-09 02:15:05 -05:00
Victor Song
53b6700594 Add dedicated target_dir field to CargoConfig and FlycheckConfig
Add dedicated field for `target_dir` in the configurations for Cargo
and Flycheck. Also change the directory to be a `PathBuf` as opposed to
a `String` to be more appropriate to the operating system.
2023-10-09 02:15:05 -05:00
Victor Song
aeef7b644b Add config option to use rust-analyzer specific target dir
Adds a Rust Analyzer configuration option to set a custom
target directory for builds. This is a workaround for Rust Analyzer
blocking debug builds while running `cargo check`. This change
should close #6007
2023-10-09 02:15:05 -05:00
bors
7e9b25bff7 Auto merge of #15725 - DaniPopes:fix-lintgen, r=Veykril
internal: fix automatic rustc/rustdoc lint generation

Missed in #15680: the output of `-Whelp` changed since the last run so it generated some bad rustdoc lints entries.
Also preemptively fix a `-Whelp` breakage that might get merged in rust-lang/rust#116412
2023-10-09 06:32:50 +00:00
DaniPopes
c5d9bfaa52
internal: fix automatic rustc/rustdoc lint generation 2023-10-07 23:24:55 +02:00
bors
b1f89a84ab Auto merge of #15600 - davidbarsky:davidbarsky/broken-rustfmt-in-ra, r=Veykril
fix: ensure `rustfmt` runs when configured with `./`

(Hopefully) resolves https://github.com/rust-lang/rust-analyzer/issues/15595. This change kinda approaches canonicalization—which I am not a fan of—but only in service of making `./`-configured commands run correctly.

Longer-term, I feel like this code should be removed once `rustfmt` supports recursive searches of configuration files or interpolation of values like `${workspace_folder}` lands in rust-analyzer.

## Testing

I cloned `rustc`, setup rust-analyzer as suggested in the [`rustc` dev guide](https://rustc-dev-guide.rust-lang.org/building/suggested.html#configuring-rust-analyzer-for-rustc), saved and formatted files in `src/tools/miri` and `compiler`, and saw `rustfmt` (seemingly) correctly.
2023-10-06 11:33:52 +00:00
Lukas Wirth
b3ebc9ab6a Check for both path separators on windows 2023-10-06 13:26:36 +02:00
bors
ef58843b9f Auto merge of #15721 - Veykril:shrink-pat-ptr, r=Veykril
Shrink PatPtr by swapping its AstPtr and Either wrap order

Will have neglible perf results I imagine, but it cleans up some code
2023-10-06 10:34:24 +00:00
Lukas Wirth
88a00bf49d Shrink PatPtr by swapping its AstPtr and Either wrap order 2023-10-06 12:32:37 +02:00
bors
a158670432 Auto merge of #15718 - Toby222:master, r=lnicola
Fix typos exec_intrinsic

Fix names of intrinsics in error messages from exec_intrinsic
(moved from rust-lang/rust#116478)
2023-10-06 07:29:12 +00:00
Tobias Berger
114f8a07e9
Fix typos exec_intrinsic 2023-10-06 09:24:28 +02:00
bors
03c5603035 Auto merge of #15714 - lnicola:rust-bors, r=lnicola
minor: Prepare for rust-bors

This [only works](https://rust-lang.zulipchat.com/#narrow/stream/242791-t-infra/topic/testing.20new.20bors.20implementation/near/395026488) for try builds at the moment, unfortunately.
2023-10-05 22:50:31 +00:00
bors
fd39a30b6c Auto merge of #15712 - cuishuang:master, r=lnicola
minor: Remove repetitive words
2023-10-05 22:29:45 +00:00
bors
54866a0df7 Auto merge of #15668 - connorskees:feat/close-backtick, r=Veykril
feat: add backtick to surrounding and auto-closing pairs

Makes backticks always complete as a pair and also surround the current selection, similar to double quotes. This is useful primarily in the context of markdown doc comments, but is applied globally for simplicity.

Closes https://github.com/rust-lang/rust-analyzer/issues/11381
2023-10-05 22:08:15 +00:00
Laurențiu Nicola
e7295ff40c Prepare for rust-bors 2023-10-05 15:26:09 +03:00
cui fliter
58239f2990 Remove repetitive words
Signed-off-by: cui fliter <imcusg@gmail.com>
2023-10-05 19:40:41 +08:00
bors
695c612489 Auto merge of #15641 - alibektas:15598/fix_into_to_from, r=Veykril
fix: preceding QualifiedPathType for into_to_from assist

fixes #15598
2023-10-05 08:25:58 +00:00
bors
b57658d9a9 Auto merge of #15707 - dfireBird:default-statusbar-action-config, r=lnicola
Add configuration for the default action of the status bar click action in VSCode

Fixes #15441

Please suggest any changes if necessary.
2023-10-04 17:31:44 +00:00
dfireBird
ab091b73d0
Add config for the default click action of extension status bar 2023-10-04 21:07:50 +05:30
bors
ad73597448 Auto merge of #15690 - Enselic:fix-regexp, r=Veykril
vscode: Fix line and col regexp for `rustc` problem matcher

When building the Rust compiler with `./x check` from within VS Code, the current `rustc` problem matcher thinks that the output from that command that looks like this:

    Build completed successfully in 0:00:26

is about a problem in a file named `0` on line 00, col 26. This wouldn't be so bad if it wasn't for that VS Code tends to get stuck on this problem because of problems with opening the file '0'.

The rust compiler will never output problems with a line or a column that starts with 0, so change the regexp to require lines and cols to begin with `[1-9]` to fix this problem.
2023-10-04 12:01:04 +00:00
bors
7e9da40078 Auto merge of #15700 - rmehri01:15694_iterator_demorgan, r=Veykril
feat: add assist for applying De Morgan's law to `Iterator::all` and `Iterator::any`

This PR adds an assist for transforming expressions of the form `!iter.any(|x| predicate(x))` into `iter.all(|x| !predicate(x))` and vice versa.

[IteratorDeMorgans.webm](https://github.com/rust-lang/rust-analyzer/assets/52933714/aad1a299-6620-432b-9106-aafd2a7fa9f5)

Closes #15694
2023-10-04 11:08:44 +00:00
Lukas Wirth
c266387e13
Replace unwrap with expect 2023-10-04 13:06:23 +02:00
bors
36be9134b8 Auto merge of #15709 - Veykril:runnables-custom-main, r=Veykril
fix: Recognize custom main function as binary entrypoint for runnables
2023-10-04 10:09:00 +00:00
Lukas Wirth
fe398163b6 Recognize custom main function as binary entrypoint for runnables 2023-10-04 12:07:41 +02:00
David Barsky
a8ec77dc7e address PR feedback. 2023-10-03 16:44:09 -04:00
bors
7b8330f283 Auto merge of #15706 - lnicola:rustc-dependencies-description, r=lnicola
minor: Add mock description to rustc-dependencies

Hopefully fixes auto-publishing.
2023-10-03 14:34:48 +00:00
Laurențiu Nicola
7c113ee77c Add mock description to rustc-dependencies 2023-10-03 17:32:57 +03:00
bors
4c9d2c75b5 Auto merge of #15698 - rmehri01:15695_make_guarded_return_more_lenient, r=Veykril
fix: allow more kinds of if let patterns in guarded return assist

Removes the checks that require the pattern to be a tuple struct with exactly 1 field that is unqualified and has an identifier pattern in it. I'm not sure if there should be more checks in place but they seem unnecessary now?

Closes #15695
2023-10-02 09:23:49 +00:00
bors
d7faec816b Auto merge of #15701 - lnicola:rustc_layout_scalar_valid_range2, r=lnicola
fix: strip base prefix in `layout_scalar_valid_range`

CC https://github.com/rust-lang/rust-analyzer/pull/15688/files#r1342311078
2023-10-02 07:49:53 +00:00
Laurențiu Nicola
084ee934b8 Strip base prefix in layout_scalar_valid_range 2023-10-02 10:47:18 +03:00
Ryan Mehri
34d3490198 feat: add assist for applying De Morgan's law to iterators 2023-10-01 21:30:10 -07:00
Ryan Mehri
146a7cc490 fix: allow more kinds of if let patterns in guarded return assist 2023-10-01 11:48:10 -07:00
bors
0840038f02 Auto merge of #15693 - HKalbasi:unused-var, r=HKalbasi
Downgrade `unused_variables` to experimental

I feel problems like #15679 are common.
2023-09-30 05:13:57 +00:00
hkalbasi
af28458643 Downgrade unused_variables to experimental 2023-09-30 08:38:55 +03:30
bors
4791a5de21 Auto merge of #15692 - Veykril:underscore-completions, r=Veykril
fix: Typing underscore should not trigger completions in types or patterns
2023-09-29 19:08:15 +00:00
Lukas Wirth
ae5d74dffb typing underscore should not trigger completions in types or patterns 2023-09-29 21:06:47 +02:00
Martin Nordholts
dd8ea977b7 vscode: Fix line and col regexp for problem matcher
When building the Rust compiler with `./x check` from within VS Code,
the current `rustc` problem matcher thinks that the output from that
command that looks like this:

    Build completed successfully in 0:00:26

is about a problem in a file named `0` on line 00, col 26. This wouldn't
be so bad if it wasn't for that VS Code tends to get stuck on this
problem because of problems with opening the file '0'.

The rust compiler will never output problems with a line or a column
that starts with 0, so change the regexp to require lines and cols to
begin with [1-9] to fix this problem.
2023-09-29 17:46:58 +02:00
bors
547bcf8bbf Auto merge of #15688 - Veykril:rustc_layout_scalar_valid_range, r=Veykril
Make rustc_layout_scalar_valid_range attributes work for non-decimal literals

Closes https://github.com/rust-lang/rust-analyzer/issues/15687
2023-09-29 13:32:09 +00:00
Lukas Wirth
a943b19e08 Make rustc_layout_scalar_valid_range attributes work for non-decimal literals 2023-09-29 15:30:47 +02:00
bors
e478db717e Auto merge of #15680 - DaniPopes:regenerate-lints, r=Veykril
internal: re-generate lints.rs

Looks like this hasn't been run in a while
2023-09-29 12:44:24 +00:00
DaniPopes
53f5c1c13f
internal: re-generate lints.rs 2023-09-29 14:20:17 +02:00
bors
17521788dd Auto merge of #15686 - Veykril:param-list-recov, r=Veykril
Only run tests on linux in pull requests

There is little gain from running them on all platforms, they should almost never fail if the linux one pass and if they do, bors will catch it still.
2023-09-29 11:54:30 +00:00
Lukas Wirth
dfeff9f40b Only run tests on linux in pull requests 2023-09-29 13:40:55 +02:00
bors
50678e0da0 Auto merge of #15682 - Veykril:param-list-recov, r=Veykril
Recover better on missing parameter in param list

We should do the same for argument lists, but that is more tricky to fix.
2023-09-29 11:14:02 +00:00
Lukas Wirth
a382e649ca Recover better on missing parameter in param list 2023-09-29 12:50:16 +02:00
bors
87e2c310f9 Auto merge of #15667 - rmehri01:bool_to_enum_top_level, r=Veykril
fix: make bool_to_enum assist create enum at top-level

This pr makes the `bool_to_enum` assist create the `enum` at the next closest module block or at top-level, which fixes a few tricky cases such as with an associated `const` in a trait or module:

```rust
trait Foo {
    const $0BOOL: bool;
}

impl Foo for usize {
    const BOOL: bool = true;
}

fn main() {
    if <usize as Foo>::BOOL {
        println!("foo");
    }
}
```

Which now properly produces:

```rust
#[derive(PartialEq, Eq)]
enum Bool { True, False }

trait Foo {
    const BOOL: Bool;
}

impl Foo for usize {
    const BOOL: Bool = Bool::True;
}

fn main() {
    if <usize as Foo>::BOOL == Bool::True {
        println!("foo");
    }
}
```

I also think it's a bit nicer, especially for local variables, but didn't really know to do it in the first PR :)
2023-09-29 10:20:11 +00:00
Ryan Mehri
1b3e5b2105 style: simplify node_to_insert_before 2023-09-28 10:09:13 -07:00
bors
f19479a2ad Auto merge of #15633 - emilio:scip-cargo-config, r=lnicola
scip: Allow customizing cargo config.

Re-use the LSP config json for simplicity.
2023-09-28 15:25:15 +00:00
Emilio Cobos Álvarez
791e6c8b1b
scip: Allow customizing cargo config.
Re-use the LSP config json for simplicity.
2023-09-28 17:22:19 +02:00