Shoyu Vanilla
e9c80a9c25
fix: False positive diagnostic for necessary else
2024-02-19 15:19:27 +03:00
Rose Hudson
5390e4ce9b
feat: add non-exhaustive-let diagnostic
2024-02-19 12:36:30 +01:00
Rose Hudson
69c25327f4
internal: reduce body lookups in expr diagnostics
2024-02-19 12:34:06 +01:00
Nadrieril
43caf8323a
Prefer debug!
to never!
and add regression test
2024-02-11 23:46:05 +01:00
Nadrieril
b04e0df1ce
pattern_analysis
doesn't need an arena anymore
2024-02-11 22:30:14 +01:00
Nadrieril
3356ebd255
Update to latest rustc_pattern_analysis
2024-02-11 22:30:14 +01:00
davidsemakula
98e6f43a2f
remove trailing return in trailing match expression
2024-02-08 19:32:53 +03:00
davidsemakula
cad222ff1b
remove trailing return in trailing if expression
2024-02-08 19:32:53 +03:00
davidsemakula
2987fac76f
diagnostic to remove trailing return
2024-02-08 19:32:53 +03:00
bors
0e5766b0d8
Auto merge of #16477 - davidsemakula:trait-incorrect-case-diagnostic, r=Veykril
...
feat: Add incorrect case diagnostics for traits and their associated items
Updates incorrect case diagnostic to:
- Check traits and their associated items
- Ignore trait implementations except for patterns in associated function bodies
Also cleans up `hir-ty::diagnostics::decl_check` a bit (mostly to make it a bit more DRY and easier to maintain)
Also fixes : #8675 and fixes : #8225
2024-02-08 14:40:16 +00:00
bors
e9d3565cd1
Auto merge of #16502 - davidsemakula:unnecessary-else-diagnostic, r=Veykril
...
feat: Add "unnecessary else" diagnostic and fix
Fixes #9457
2024-02-08 14:25:00 +00:00
Lukas Wirth
545382db25
Fix warnings
2024-02-08 14:54:52 +01:00
davidsemakula
62cc4f9c46
add unnecessary else diagnostic
2024-02-06 19:00:10 +03:00
Nadrieril
d2d4119d24
Don't need an arena for types anymore
2024-02-06 05:09:30 +01:00
Nadrieril
ba7b12e062
Update rustc_pattern_analysis dependency
2024-02-06 05:08:19 +01:00
Nadrieril
c2d21242aa
Tweak variant_id_for_adt
2024-02-06 05:01:05 +01:00
davidsemakula
b45ee82811
incorrect case diagnostics for param names of trait impl assoc functions
2024-02-05 01:31:28 +03:00
davidsemakula
d761d86f03
refactor hir-ty::diagnostics::decl_check
for enum variants
2024-02-03 17:36:11 +03:00
davidsemakula
8e29104178
refactor hir-ty::diagnostics::decl_check
for struct fields
2024-02-03 17:33:25 +03:00
davidsemakula
23aa872f3c
refactor hir-ty::diagnostics::decl_check
for function bodies
2024-02-03 16:40:55 +03:00
davidsemakula
c0071ace5a
refactor hir-ty::diagnostics::decl_check
2024-02-03 15:51:14 +03:00
davidsemakula
080d223dd4
incorrect case diagnostics for type aliases
2024-02-02 17:07:08 +03:00
davidsemakula
0ffc088439
no incorrect case diagnostics for trait impl assoc functions and consts except for pats in fn bodies
2024-02-02 17:07:08 +03:00
davidsemakula
5fe3b75677
incorrect case diagnostics for trait name
2024-02-02 17:07:08 +03:00
David Barsky
251b14f2c5
internal: don't panic in debug_pat
2024-01-31 13:00:30 -05:00
David Barsky
e1ea7c8844
internal: switch to tracing
from log
...
This commit also adds `tracing` to NotificationDispatcher/RequestDispatcher,
bumps `rust-analyzer-salsa` to 0.17.0-pre.6, `always-assert` to 0.2, and
removes the homegrown `hprof` implementation in favor of a vendored
tracing-span-tree.
2024-01-30 12:27:31 -05:00
Johann Hemmann
43b1ae0446
cargo clippy --fix
2024-01-30 14:50:21 +01:00
Nadrieril
2370b70f25
Replace local copy of exhaustiveness checking with upstream librarified version
2024-01-23 15:54:00 +01:00
r0cky
1a9ef233b7
Remove unused codes
2024-01-21 12:56:23 +08:00
Johann Hemmann
b1a0c9ac40
single_match
2024-01-19 18:31:15 +01:00
Johann Hemmann
fad4fa163c
cargo clippy --fix
2024-01-18 13:59:49 +01:00
Lukas Wirth
d80d2fcae0
Eagerly lower enum variants in CrateDefMap construction
2024-01-15 10:24:14 +01:00
Lukas Wirth
634d588fd7
Simplify
2023-12-06 14:36:39 +01:00
Lukas Wirth
890eb17b4e
Replace ID based TokenMap with proper relative text-ranges / spans
2023-11-28 10:55:39 +01:00
Lukas Wirth
498f39eae2
fix: Diagnose everything in nested items, not just def diagnostics
2023-11-15 10:34:09 +01:00
hkalbasi
8b82ea4f51
Store binding mode for each instance independently
2023-10-22 23:35:33 +03:30
bors
bd38871a98
Auto merge of #15736 - rmehri01:15678_module_incorrect_case_diagnostics, r=HKalbasi
...
fix: add incorrect case diagnostics for module names
Adds diagnostics for checking both inline and file module names are snake case.
Closes #15678
2023-10-20 16:20:40 +00:00
Ryan Mehri
36eac9abee
fix: add incorrect case diagnostics for module names
2023-10-09 13:36:39 -07:00
bors
ab62c0186f
Auto merge of #15696 - rmehri01:14293_tuple_return_type_to_struct, r=Veykril
...
feat: implement tuple return type to tuple struct assist
This PR implements the `convert_tuple_return_type_to_struct` assist, for converting the return type of a function or method from a tuple to a tuple struct. Additionally, it moves the `to_camel_case` and `char_has_case` functions from `case_conv` to `stdx` so that they can be used similar to `to_lower_snake_case`.
[tuple_return_type_to_tuple_struct.webm](https://github.com/rust-lang/rust-analyzer/assets/52933714/2803ff58-fde3-4144-9495-7c7c7e139075 )
Currently, the assist puts the struct definition above the function, or above the nearest `impl` or `trait` if applicable and only rewrites literal tuples that are returned in the body of the function. Additionally, it only attempts to rewrite simple tuple pattern usages with the corresponding tuple struct pattern but does so across files and modules.
I think that this is sufficient for the majority of use cases but I could be wrong. One thing I'm still not sure how to approach is handling `Self` and generics/lifetimes in the tuple type to be extracted. I was thinking of either manually figuring out what lifetimes and generics are in scope and using them (sort of similar to the `generate_function` assist) or maybe using `ctx.sema.resolve_type` and `generic_params` on `hir::Type` but this seems to not deal with lifetimes.
Closes #14293
2023-10-09 08:14:42 +00:00
Lukas Wirth
88a00bf49d
Shrink PatPtr by swapping its AstPtr and Either wrap order
2023-10-06 12:32:37 +02:00
Ryan Mehri
40f80e29a5
move to_camel_case
and char_has_case
from case_conv to stdx
2023-09-30 08:04:04 -07:00
Lukas Wirth
affe5a7315
fix: Temporarily skip decl check in derive expansions
2023-09-12 23:10:03 +02:00
Lukas Wirth
a17d73ad36
Thread imports through the resolver
2023-08-17 10:52:13 +02:00
Lukas Wirth
ecb6d07d57
Add currently unused UseId variants
2023-08-02 14:53:45 +02:00
Ryo Yoshida
33b7b45f67
Report incorrect case for inner items within all bodies
2023-07-21 15:07:55 +09:00
Ryo Yoshida
b53a07835b
Report incorrect case for fn inner items
2023-07-21 15:07:49 +09:00
bors
45272efec5
Auto merge of #14990 - HKalbasi:diagnostic-map, r=HKalbasi
...
Map our diagnostics to rustc and clippy's ones
And control their severity by lint attributes `#[allow]`, `#[deny]` and ... .
It doesn't work with proc macros and I would like to fix that before merge but I don't know how to do it.
2023-07-03 18:58:47 +00:00
Lukas Wirth
9476fdaaa9
HIR ExternCrateDecl
2023-06-19 14:15:08 +02:00
hkalbasi
e55a1f1916
Map our diagnostics to rustc and clippy's ones
2023-06-15 01:47:22 +03:30
hkalbasi
a481e004b0
Lower const params with a bad id
2023-06-11 00:39:28 +03:30
Lukas Wirth
c7ef6c25b7
internal: Replace Display impl for Name
2023-05-24 20:55:12 +02:00
hkalbasi
c5ea2d7adc
handle match scrutinee in closure captures
2023-05-19 12:04:12 +03:30
hkalbasi
36c9d5ce17
Fix pattern type mismatch in tuples
2023-05-04 16:03:36 +03:30
Laurențiu Nicola
7197a27028
Use triomphe Arc
2023-05-02 20:02:43 +03:00
hkalbasi
6312fbf521
MIR episode 4
2023-05-01 23:23:10 +03:30
Josh Soref
bc7d84c3ce
Spelling
...
* a rule
* access
* after
* amount
* annotations
* assignment
* assist
* associated
* attribute
* borrowed
* built-in type
* clarification
* command
* const
* constructor
* corresponding
* counterparts
* curlies
* dependencies
* deterministic
* diagnostic
* duplicates
* edge
* edited
* efficient
* elsewhere
* execution
* expression
* extensions
* extracted
* fill
* github
* helper
* heuristic
* incomplete
* indent end
* inlay
* invocation
* lifetime
* looking
* maybe
* move
* mutability
* mutable
* necessarily
* necessary
* negative
* nonexistent
* occurred
* offsets
* offsetted
* overridden
* parameters
* params
* params_and_where_preds_in_scope
* paredit
* parent
* parentheses
* prepended if
* punctuation
* receive
* receiver
* referring
* repeated
* representing
* semantically
* separately
* shouldnot
* siblings
* similar
* something's
* statement
* struct
* structure
* surprise
* the
* this
* transparent
* unimplemented
* unnamed
* unnecessary
* unneeded
* unreachable
* unterminated
* utilities
* variant
* variants
* visibility
* work around (v)
* workaround
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2023-04-19 09:45:55 -04:00
Lukas Wirth
99b69525f4
hir_def::expr -> hir_def::hir, hir_def::type_ref -> hir_def::hir::type_ref
2023-04-06 19:36:25 +02:00
Lukas Wirth
8e7c104b3a
Move hir_def::adt to hir_def::data::adt
2023-04-06 19:23:29 +02:00
Lukas Wirth
33b6012827
Introduce StructFlags
2023-03-30 12:49:08 +02:00
hkalbasi
b7b9ae59a0
desugar ? operator
2023-03-17 13:08:35 +03:30
iDawer
17b9d35b31
Refactor: Distinguish scrutinee expression from match expression
2023-03-10 18:43:50 +05:00
iDawer
8f189f62c6
Remove unnecessary argument
2023-03-10 16:35:04 +05:00
iDawer
c38aa5f4f0
Use anonymous lifetimes
2023-03-10 16:16:28 +05:00
hkalbasi
61ad6a96ad
Add BindingId
2023-03-06 21:09:08 +03:30
Lukas Wirth
95c4cb991f
Handle new hir block kinds in scope calculations
2023-03-04 15:22:39 +01:00
Lukas Wirth
1b5bc83118
Remove weird nesting of effect blocks in hir
2023-03-04 14:45:57 +01:00
Ryo Yoshida
29c957f973
Lower and handle trait aliases in HIR
2023-03-04 00:24:07 +09:00
Ryo Yoshida
cf0c8fe000
minor: import Either
from either
2023-02-25 21:55:11 +09:00
Ryo Yoshida
98c8077495
fix: support non-ascii characters in case conversion
2023-02-03 18:11:11 +09:00
Lukas Wirth
f8ed4d7ae4
Use lang item resolution instead of known paths
2023-01-21 19:03:36 +01:00
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
hkalbasi
86b5b609f1
Compute data layout of types
2022-12-04 00:29:34 +03:30
OleStrohm
997fc46efa
Implemented basic enum const eval
2022-09-12 20:19:13 +01:00
iDawer
8ae58b9fe4
Record enabled unstable features into DefMap
2022-09-02 16:31:15 +05:00
iDawer
1a580a3396
Implement unstable RFC 1872 exhaustive_patterns
2022-08-31 20:17:54 +05:00
Ryo Yoshida
805ac666ca
fix: consider assignee expressions in record fields exhaustiveness check
2022-07-24 22:40:04 +09:00
Ryo Yoshida
fb063d360c
Add ellipsis
to HIR RecordLit
2022-07-24 17:10:31 +09:00
Amos Wenger
816f7fe12a
Run cargo fix --edition-idioms
2022-07-20 15:02:08 +02:00
a-kenji
f2963cf8ff
fix: typos in hir-ty
2022-07-02 17:19:06 +02:00
iDawer
e417992674
Add static assertions for some unreachble paths
2022-06-30 18:36:05 +05:00
iDawer
461c0cc07a
Correct wording
2022-06-30 17:19:03 +05:00
iDawer
fb6278e750
Reduce intermediate allocations while printing witnesses
2022-06-25 20:08:00 +05:00
iDawer
4ff9bedbed
Display witnesses of non-exhaustive match
...
Reporting format follows rustc and shows at most three witnesses.
2022-06-20 15:48:09 +05:00
Lukas Wirth
6b696fced8
feat: Add binding mode inlay hints
2022-05-14 14:58:35 +02:00
Peh
1f011fa4a3
style: rename crates to kebab case
2022-05-01 10:48:58 +00:00