Commit Graph

26287 Commits

Author SHA1 Message Date
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
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
bors
b3f45745ea Auto merge of #15677 - Veykril:param-ast-id, r=Veykril
Allocate ast ids for parameters

Since these can have attributes attached to them, we'll need this sooner or later (sooner being me tinkering with the token map right now)
2023-09-28 11:21:15 +00:00
Lukas Wirth
2b9dde14ab Allocate ast ids for parameters 2023-09-28 13:16:11 +02:00
bors
f93b6acb7f Auto merge of #15672 - veber-alex:useRustcErrorCode_descriptio, r=lnicola
Improve useRustcErrorCode description

Fixes #15666
2023-09-27 17:05:17 +00:00
Alex Veber
5b04a7d338
Update editors/code/package.json
Co-authored-by: Laurențiu Nicola <lnicola@users.noreply.github.com>
2023-09-27 18:33:22 +03:00
Alex Veber
6c907e1e20
Improve useRustcErrorCode description 2023-09-27 02:19:50 +03:00
bors
3b1b58c225 Auto merge of #15662 - rmehri01:fix_panic_with_return_in_match, r=Veykril
fix: panic with wrapping/unwrapping result return type assists

With the `wrap_return_type_in_result` assist, the following code results in a panic (note the lack of a semicolon):

```rust
fn foo(num: i32) -> $0i32 {
    return num
}

=>

thread 'handlers::wrap_return_type_in_result::tests::wrap_return_in_tail_position' panicked at crates/syntax/src/ted.rs:137:41:
called `Option::unwrap()` on a `None` value
```

I think this is because it first walks the body expression to change any `return` expressions and then walks all tail expressions, resulting in the `return num` being changed twice since it is both a `return` and in tail position. This can also happen when a `match` is in tail position and `return` is used in a branch for example. Not really sure how big of an issue this is in practice though since this seems to be the only case that is impacted and can be reduced to just `num` instead of `return num`.

This also occurs with the `unwrap_result_return_type` assist but panics with the following instead:

```
thread 'handlers::unwrap_result_return_type::tests::wrap_return_in_tail_position' panicked at /rustc/3223b0b5e8dadda3f76c3fd1a8d6c5addc09599e/library/alloc/src/string.rs:1766:29:
assertion failed: self.is_char_boundary(n)
```
2023-09-26 14:18:33 +00:00
bors
c945f90cb9 Auto merge of #15663 - chenx97:libc-148, r=Veykril
minor: update libc to 0.2.148

This update is a follow-up for [#112374](https://github.com/rust-lang/rust/pull/112374).

The command that does this update:

`cargo update -p libc`
2023-09-26 13:57:59 +00:00
bors
b0fe99f02f Auto merge of #15669 - Veykril:simplify, r=Veykril
Simplify
2023-09-26 10:27:41 +00:00
Lukas Wirth
0dbde71159 Simplify 2023-09-26 12:25:59 +02:00
Connor Skees
6ca48d98c4 feat: add backtick to surrounding and auto-closing pairs 2023-09-26 06:36:37 +00:00
Ryan Mehri
73150c3f36 fix: wrap method call exprs in parens 2023-09-25 21:44:16 -07:00