Commit Graph

26323 Commits

Author SHA1 Message Date
Ryan Mehri
40f80e29a5 move to_camel_case and char_has_case from case_conv to stdx 2023-09-30 08:04:04 -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
Ryan Mehri
bce4be9478 fix: make bool_to_enum assist create enum at top-level 2023-09-25 21:01:54 -07:00
bors
d3cc3bc00e Auto merge of #15665 - Milo123459:milo/remove-unwraps, r=lnicola
internal: De-`unwrap` `generate_function.rs`

Fixes https://github.com/rust-lang/rust-analyzer/issues/15398#issuecomment-1733462185

cc `@Inicola`
2023-09-25 11:53:34 +00:00
Milo
85ead6ec27 remove other unwraps 2023-09-25 11:48:23 +00:00
Milo
f64eecd2e2 fix one 2023-09-25 11:30:21 +00:00
bors
972a19f4cb Auto merge of #15659 - HKalbasi:unused-var, r=HKalbasi
Add `unused_variables` native diagnostic
2023-09-25 06:38:14 +00:00
Henry Chen
963ba59579 minor: update libc to 0.2.148
`cargo update -p libc`
2023-09-25 10:13:25 +08:00
Ryan Mehri
7306504b82 fix panic with wrapping/unwrapping result return type assists 2023-09-24 16:00:55 -07:00
bors
862a3004e9 Auto merge of #15660 - DaniPopes:hover-simple-refactor, r=HKalbasi
minor: hover_simple refactor

A minor refactor of `hover_simple` opportunity I noticed while skimming through the code.

- `if let`s -> `match`
- `iter::once(x).cycle` -> `iter::repeat`
- `classify_token` -> `classify_node`
2023-09-24 21:30:09 +00:00
DaniPopes
588c7d9182
minor: hover_simple refactor 2023-09-24 22:47:29 +02:00
hkalbasi
ab52ba2de7 Fix unused_variables in tests 2023-09-24 23:45:36 +03:30
hkalbasi
7834b8fadb Add unused_variables native diagnostic 2023-09-24 21:29:15 +03:30
bors
e5e937ae5e Auto merge of #15582 - vxpm:master, r=HKalbasi
add option to show full function signatures in completion docs

implements #15538

with `"rust-analyzer.completion.fullFunctionSignatures.enable": false`:
![image](https://github.com/rust-lang/rust-analyzer/assets/59714841/ff739ad1-9975-461f-a62d-22c7823e7b71)

with `"rust-analyzer.completion.fullFunctionSignatures.enable": true`:
![image](https://github.com/rust-lang/rust-analyzer/assets/59714841/9bc98300-cef6-44ef-a353-dcf35cd36fce)
2023-09-24 07:38:38 +00:00
vxpm
10fae62820 split detail function 2023-09-23 19:43:19 -03:00
vxpm
9f3d627681 add tests for full signatures 2023-09-23 19:39:42 -03:00
Ali Bektas
fc258de5a3 Make QualPathTy case readable 2023-09-22 21:23:03 +02:00
bors
2b580a1f3c Auto merge of #15492 - RalfJung:invocation, r=Veykril
extend check.overrideCommand and buildScripts.overrideCommand docs

Extend check.overrideCommand and buildScripts.overrideCommand docs regarding invocation strategy and location.

However something still seems a bit odd -- the docs for `invocationStrategy`/`invocationLocation` talk about "workspaces", but the setting that controls which workspaces are considered is called `linkedProjects`. Is a project the same as a workspace here or is there some subtle difference?
2023-09-22 16:09:01 +00:00
bors
8139e8e072 Auto merge of #15425 - alibektas:deunwrap/convert_comment_block, r=Veykril
minor : Deunwrap convert_comment_block and desugar_doc_comment

Closes subtask 13 of #15398 . I still don't know a more idiomatic way for the for loops I added, any suggestion would make me happy.
2023-09-22 15:47:55 +00:00
Lukas Wirth
ba7f2bfb85 Update config docs 2023-09-22 17:46:17 +02:00
bors
59bcbafc95 Auto merge of #15594 - alibektas:deunwrap/add_missing_match_arms, r=Veykril
Deunwrap add_missing_match_arms

Last subtask of #15398
2023-09-22 15:31:30 +00:00
Ali Bektas
132a6ce8fc Omit QualPathTy when possible 2023-09-22 14:04:17 +02:00
Ali Bektas
622e1a8d88 Add a test case to add_missing_match_arms
Although it doesn't panic now, further changes to how we recover from incomplete syntax
may cause this assist to panic. To mitigate this a test case has been added.
2023-09-22 13:51:19 +02:00