Lukas Wirth
deddbbfa60
Surpress type mismatches in calls with mismatched arg counts
2024-08-05 16:15:28 +02:00
bors
6f3030f316
Auto merge of #17586 - ShoyuVanilla:tuple-arg-macro-rest, r=Veykril
...
Allow macro expansions into `RestPat` in tuple args work as ellipsis like plain `RestPat`
Fixes #17292
Currently, Rust Analyzer lowers `ast::Pat::RestPat` into `Pat::Missing` in general cases on the following lines;
ffbc5ad993/crates/hir-def/src/body/lower.rs (L1359-L1367)
And in some proper positions such as `TupleStruct(..)`, it is specially handed on the following lines;
ffbc5ad993/crates/hir-def/src/body/lower.rs (L1429-L1437)
This behavior is reasonable because rustc does similar things in
62c068feea/compiler/rustc_ast_lowering/src/pat.rs (L108-L111)
and
62c068feea/compiler/rustc_ast_lowering/src/pat.rs (L123-L142)
But this sometimes works differently because Rust Analyzer expands macros while ast lowering;
ffbc5ad993/crates/hir-def/src/body/lower.rs (L1386-L1398)
ffbc5ad993/crates/hir-def/src/body/lower.rs (L941-L963)
but rustc uses expanded ast in the corresponding tuple-handling process, so it does not have macro patterns there.
62c068feea/compiler/rustc_ast_lowering/src/pat.rs (L114)
So, if a macro expansion in a tuple arg results in `..`, rustc permits it like plain `..` pattern, but Rust Analyzer rejects it.
This is the root cause of #17292 and this PR allows macros expanded into `..` in a tuple arg position work as ellipsis like that.
2024-07-22 09:08:12 +00:00
Lukas Wirth
5264f86242
Encode edition within FileId in the hir layer
2024-07-18 08:49:10 +02:00
Shoyu Vanilla
b238855892
Allow macro expansions into RestPat
in tuple args work as ellipsis like plain RestPat
2024-07-13 07:09:17 +09:00
davidsemakula
33b3b6dbf9
refactor: disable "unused" lint using parameter name
2024-02-05 01:07:44 +03:00
davidsemakula
6d2d6323ac
incorrect case diagnostics for trait assoc functions and consts
2024-02-02 17:07:08 +03:00
Lukas Wirth
604479c373
internal: Use improved adjusted_display_range for all diagnostics
2024-01-31 09:16:30 +01:00
Ar4ys
8f05e7ce55
Replaced adjusted_display_range with it's new version in mismatched_arg_count
2024-01-25 20:15:46 +01:00
Johann Hemmann
fad4fa163c
cargo clippy --fix
2024-01-18 13:59:49 +01:00
Lukas Wirth
ba01ff4f88
Fix diagnostics panicking when resolving to different files due to macros
2023-12-06 14:39:26 +01:00
Lukas Wirth
88a00bf49d
Shrink PatPtr by swapping its AstPtr and Either wrap order
2023-10-06 12:32:37 +02:00
hkalbasi
ab52ba2de7
Fix unused_variables in tests
2023-09-24 23:45:36 +03:30
Lukas Wirth
8654a098c7
Diagnose mismatched arg count for tuple struct patterns
2023-09-08 14:54:43 +02:00
hkalbasi
e55a1f1916
Map our diagnostics to rustc and clippy's ones
2023-06-15 01:47:22 +03:30
Yuri Astrakhan
e16c76e3c3
Inline all format arguments where possible
...
This makes code more readale and concise,
moving all format arguments like `format!("{}", foo)`
into the more compact `format!("{foo}")` form.
The change was automatically created with, so there are far less change
of an accidental typo.
```
cargo clippy --fix -- -A clippy::all -W clippy::uninlined_format_args
```
2022-12-24 14:36:10 -05:00
Aleksey Kladov
5bd84432dd
internal: extract common code for adjusting diagnostic range
2022-07-23 22:24:44 +01:00
Peh
1f011fa4a3
style: rename crates to kebab case
2022-05-01 10:48:58 +00:00