Commit Graph

26371 Commits

Author SHA1 Message Date
bors
15e1356149 Auto merge of #15601 - Veykril:diag-derive, r=Veykril
fix: Temporarily skip decl check in derive expansions

"Fixes https://github.com/rust-lang/rust-analyzer/issues/15344"
2023-09-12 21:11:28 +00:00
Lukas Wirth
affe5a7315 fix: Temporarily skip decl check in derive expansions 2023-09-12 23:10:03 +02:00
David Barsky
2974416a81 fix: ensure rustfmt runs when configured with ./ 2023-09-12 14:35:24 -04:00
Ryan Mehri
cd0a89ac4f fix: field shorthand overwritten in promote local to const assist 2023-09-11 10:59:23 -07:00
dfireBird
df1239bf92
add tests for insert use with renamed imports
Tested for two cases:
1. Simple Use
2. Complex Use
2023-09-11 17:43:53 +05:30
dfireBird
d79486529e
remove as _ on auto importing on trait that is aliased with _ 2023-09-11 17:43:53 +05:30
Ali Bektas
145a101fe8 Deunwrap add_missing_match_arms 2023-09-11 14:09:19 +02:00
Ali Bektas
893e19137e Make assist lazy again 2023-09-11 13:33:26 +02:00
Ali Bektas
0863024b1a Make assist lazy again 2023-09-11 13:31:42 +02:00
bors
cc6c8209cb Auto merge of #15431 - alibektas:deunwrap/extract_function, r=Veykril
minor : Deunwrap extract_function

#15398 subtask 5.
2023-09-11 08:37:57 +00:00
bors
0e251ff768 Auto merge of #15232 - alibektas:14850, r=Veykril
ide : Disallow renaming of non-local items

fixes #14850 . This makes me wonder , why stop at structs and not do the same for other ADTs? Would be happy to add them too if nothing speaks against it.
2023-09-11 08:21:51 +00:00
Ryan Mehri
25b1b3e753 feat: add support for other ADT types and destructuring patterns 2023-09-10 22:21:12 -07:00
Ali Bektas
0118741632 v4 2023-09-10 23:25:36 +02:00
Ali Bektas
a0c8bee35e Add more comments as requested 2023-09-10 23:19:58 +02:00
Ali Bektas
6dc7fa9423 v3 2023-09-10 23:19:58 +02:00
Ali Bektas
43edb51b21 Generalize disallowing of definition renaming 2023-09-10 23:19:58 +02:00
Ali Bektas
7ae70a06ce Disallow renaming of non-local structs 2023-09-10 23:19:58 +02:00
Ali Bektas
2fdf7e4b75 v3 2023-09-10 23:15:37 +02:00
Ali Bektas
a66dbd11ed v2 2023-09-10 23:15:05 +02:00
Ali Bektas
b316bccc97 replace for loops with sth more idiomatic 2023-09-10 23:15:05 +02:00
Ali Bektas
9c6257138d Deunwrap convert_comment_block 2023-09-10 23:15:05 +02:00
Ali Bektas
0f1673c6f1 v3 2023-09-10 23:00:19 +02:00
Ali Bektas
6f7460484a v2 2023-09-10 22:45:09 +02:00
Ali Bektas
35e0d800f0 Deunwrap extract_function 2023-09-10 22:45:09 +02:00
Ali Bektas
38491fcf07 v3 2023-09-10 22:39:07 +02:00
Ali Bektas
68d24b69d4 Deunwrap inline call v2 2023-09-10 22:39:07 +02:00
Ali Bektas
5683df2965 Deunwrap inline call 2023-09-10 22:39:07 +02:00
Ryan Mehri
7ba2e130b9 fix: add checks for overwriting incorrect ancestor 2023-09-10 00:21:11 -07:00
bors
326f37ef1f Auto merge of #15592 - Veykril:shrink, r=Veykril
Shrink some stuff
2023-09-10 06:55:01 +00:00
Lukas Wirth
ccff704c25 Shrink some stuff 2023-09-10 08:24:26 +02:00
Ryan Mehri
2e13aed3bc feat: support cross module imports 2023-09-09 11:59:59 -07:00
Ryan Mehri
136a9dbe36 style: rename some locals 2023-09-09 11:59:59 -07:00
Ryan Mehri
455dacfd3b fix: only trigger assist on Name 2023-09-09 11:59:59 -07:00
Ryan Mehri
91ac1d6194 fix: initializing struct multiple times 2023-09-09 11:59:59 -07:00
Ryan Mehri
83196fd4d9 fix: remove trailing whitespace 2023-09-09 11:59:59 -07:00
Ryan Mehri
59738d5fd5 fix: add generated doctest 2023-09-09 11:59:58 -07:00
Ryan Mehri
d7a8e800c9 feat: initial version of bool_to_enum assist 2023-09-09 11:58:19 -07:00
bors
994df3d6a3 Auto merge of #15586 - Veykril:shrink, r=Veykril
shrink_to_fit body source map
2023-09-09 12:53:39 +00:00
Lukas Wirth
cfcef69072 shrink_to_fit body source map 2023-09-09 14:40:56 +02:00
bors
a3cfb457ca Auto merge of #15584 - Veykril:diag-private-field-constructor, r=Veykril
Diagnose private fields in record constructor
2023-09-09 09:02:50 +00:00
Lukas Wirth
8f5fee4a5a Diagnose incorrect and private fields in record structs 2023-09-09 10:45:29 +02:00
vxpm
6b487ed4be fix & run tests 2023-09-08 22:03:42 -03:00
vxpm
6afa5b0ba2 better handling of spaces & newlines 2023-09-08 22:03:42 -03:00
vxpm
23ffda1a97 full function signatures option 2023-09-08 22:03:42 -03:00
Lukas Wirth
55c75450fb Diagnose private fields in record constructor 2023-09-08 23:19:30 +02:00
bors
c405509f2e Auto merge of #15560 - davidbarsky:davidbarsky/use-sysroot-rustc-to-determine-cfgs, r=Veykril
project-model: when using `rust-project.json`, prefer the sysroot-defined rustc over discovery in `$PATH`

At the moment, rust-analyzer discovers `rustc` via the `$PATH` even if the `sysroot` field is defined in a `rust-project.json`. However, this does not work for users who do not have rustup installed, resulting in any `cfg`-based inference in rust-analzyer not working correctly. In my (decently naive!) opinion, it makes more sense to rely on the `sysroot` field in the `rust-project.json`.

One might ask "why not add `rustc` to the `$PATH`?" That is a reasonable question, but that doesn't work for my use case:
- The path to the sysroot in my employer's monorepo changes depending on which platform a user is on. For example, if they're on Linux, they'd want to use the sysroot defined at path `a`, whereas if they're on macOS, they'd want to use the sysroot at path `b` (I wrote the sysroot resolution functionality [here](765da4ca1e/integrations/rust-project/src/sysroot.rs (L39)), if you're curious).
- The location of the sysroot can (and does!) change, especially as people figure out how to make Rust run successfully on non-Linux platforms (e.g., iOS, Android, etc.) in a monorepo. Updating people's `$PATH` company-wide is hard while updating a config inside a CLI is pretty easy.

## Testing

I've created a `rust-project.json` using [rust-project](https://github.com/facebook/buck2/tree/main/integrations/rust-project) and was able to successfully load a project with and without the `sysroot`/`sysroot_src` fields—without those fields, rust-analyzer fell back to the `$PATH` based approach, as evidenced by `[DEBUG project_model::rustc_cfg] using rustc from env rustc="rustc"` showing up in the logs.
2023-09-08 18:14:25 +00:00
David Barsky
0bf6ffaf82
Update crates/project-model/src/rustc_cfg.rs
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2023-09-08 14:07:59 -04:00
bors
c31d418a31 Auto merge of #15578 - Veykril:diag-tuple-struct-count, r=Veykril
Diagnose mismatched arg count for tuple struct patterns
2023-09-08 13:08:10 +00:00
Lukas Wirth
8654a098c7 Diagnose mismatched arg count for tuple struct patterns 2023-09-08 14:54:43 +02:00
bors
ea71a49c8e Auto merge of #15577 - Veykril:clear-native-diags, r=Veykril
Clear native diagnostics on file closing

Fixes https://github.com/rust-lang/rust-analyzer/issues/15562
2023-09-08 11:54:59 +00:00