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
6d2d6323ac
incorrect case diagnostics for trait assoc functions and consts
2024-02-02 17:07:08 +03:00
davidsemakula
5fe3b75677
incorrect case diagnostics for trait name
2024-02-02 17:07:08 +03:00
Lukas Wirth
9e8a0fae0c
Lint debug prints and disallowed types with clippy
2024-02-01 17:57:27 +01:00
bors
355c9444e1
Auto merge of #16448 - Young-Flash:typos, r=lnicola
...
minor: correct typos
I use [crate-ci/typos](https://github.com/crate-ci/typos ) to check typos in codebase, if it's ok with you, I'd like to add a typo check CI using [typos](https://github.com/crate-ci/typos ) (with Apache-2.0, MIT licenses).
BTW, we can add a [_typos.toml](https://github.com/crate-ci/typos/blob/master/docs/reference.md ) as white list for some intentional typos
2024-01-31 13:29:55 +00:00
Lukas Wirth
604479c373
internal: Use improved adjusted_display_range for all diagnostics
2024-01-31 09:16:30 +01: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
Young-Flash
db9fd370ee
minor: correct typos
2024-01-30 21:43:43 +08:00
bors
7219414e81
Auto merge of #16427 - Young-Flash:fix_no_such_field_diagnostics, r=Veykril
...
fix: filter out cfg disabled filed when lowering `RecordPat`
we should filter out field with disabled cfg when lowering ast `RecordPat` to hir.
close https://github.com/rust-lang/rust-analyzer/issues/16169
2024-01-27 10:52:36 +00:00
bors
27c3ed9de8
Auto merge of #16434 - Veykril:things, r=Veykril
...
internal: Restructure and cleanup hir-expand a bit
2024-01-27 10:16:35 +00:00
Lukas Wirth
8a5829cf28
Re-order mod declarations
2024-01-27 11:02:34 +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
Young-Flash
1374bc8c93
test: ensure no_such_field
diagnostic don't work for field with disabled cfg
2024-01-25 19:30:04 +08:00
bors
85c9a83262
Auto merge of #16398 - Urhengulas:satisfy-clippy, r=Veykril
...
`cargo clippy --fix`
This PR is the result of running `cargo clippy --fix && cargo fmt` in the root of the repository. I did not manually review all the changes, but just skimmed through a few of them. The tests still pass, so it seems fine.
2024-01-19 09:43:35 +00:00
Johann Hemmann
fad4fa163c
cargo clippy --fix
2024-01-18 13:59:49 +01:00
Ali Bektas
9bd9a17ce5
Add a new config to allow renaming of non-local items
...
With #15656 we started disallowing renaming of non-local items.
Although this makes sense there are some false positives that
impacted users' workflows. So this config aims to mitigate this
by giving users the liberty to disable this feature.
2024-01-18 00:26:22 +01:00
Zach
1aff8157bc
Set experimental field at diagnostic new instead of lib
2024-01-10 05:58:25 -06:00
Zach
beeaaf184e
Mark unresolved associated item diagnostic as experimental
2024-01-09 17:09:50 -06:00
Matthias Krüger
3fb2cd2002
autofix remaining perf findings
2024-01-07 01:20:20 +01:00
Matthias Krüger
196650dfaf
don't to_string() format args
2024-01-07 01:11:57 +01:00
Matthias Krüger
476e10e961
remove redundant clones
2024-01-07 00:17:48 +01:00
bors
2980d54160
Auto merge of #16223 - Young-Flash:quickfix_redundant_assoc_item, r=Veykril
...
feat: add quickfix for redundant_assoc_item diagnostic
Happy New Year 😊
follow up https://github.com/rust-lang/rust-analyzer/pull/15990 , now it's time to close https://github.com/rust-lang/rust-analyzer/issues/15958 , closes https://github.com/rust-lang/rust-analyzer/issues/16269
![demo](https://github.com/rust-lang/rust-analyzer/assets/71162630/74022c52-1566-49a0-9be8-03b82f3e730f )
EDIT: add a demo.git would be more illustrated when making release change log.
2024-01-05 13:15:01 +00:00
Johann Hemmann
03b1ecd90d
Replace only occurence of check_expect with check_diagnostics
2024-01-04 18:20:38 +01:00
Young-Flash
c5c1360f7b
fix: make diagnostic range accommodate for macros
2024-01-03 22:05:30 +08:00
bors
426d2842c1
Auto merge of #16222 - rosefromthedead:unresolved-assoc-item, r=Veykril
...
add unresolved-assoc-item assist
I tried to copy from private-assoc-item for this
2024-01-02 15:06:13 +00:00
bors
86e559bf3f
Auto merge of #16211 - tetsuharuohzeki:update-lint, r=Veykril
...
Use Cargo's [workspace.lints.*] to config clippy
This change begin to use [`[workspace.lints.*]`](https://doc.rust-lang.org/cargo/reference/workspaces.html#the-lints-table ) that is stabilized since [Rust 1.74](https://blog.rust-lang.org/2023/11/16/Rust-1.74.0.html ).
By this change, we make the configure more readable and simplify `xargo lint` more.
2024-01-02 14:53:22 +00:00
Young-Flash
91bd59682a
fix: make editing range accommodate for macros
2024-01-02 21:30:13 +08:00
Young-Flash
481fab1591
chore: add test case for assoc func fix in unresolved_method
diagnostic
2024-01-02 20:53:41 +08:00
Young-Flash
69410bb488
feat: add assoc func quickfix for unresolved_method
diagnostic
2024-01-02 20:53:41 +08:00
Young-Flash
4eb3d2e279
test: add test case for redundant_assoc_item quickfix
2024-01-01 11:19:12 +08:00
Young-Flash
613774e331
feat: add quickfix for redundant_assoc_item diagnostic
2024-01-01 11:17:06 +08:00
Rose Hudson
5878651e7e
add unresolved-assoc-item diagnostic
2023-12-31 17:36:40 +00:00
Tetsuharu Ohzeki
efc87092b3
Use Cargo's [workspace.lints.*] to config clippy
2023-12-29 23:51:32 +09:00
Young-Flash
cc73c00d81
add test case for negative impl
2023-12-24 20:07:33 +08:00
Lukas Wirth
f49a2fed3f
internal: Move out WithFixture
into dev-dep only crate
2023-12-18 15:24:08 +01:00
Lukas Wirth
35620306a6
internal: Move proc-macro knowledge out of base-db
2023-12-18 12:37:18 +01:00
hkalbasi
7b9595a5ab
Run rust-analyzer on rustc tests in metrics
2023-12-15 02:10:25 +03:30
hkalbasi
801c0ea478
Replace doc_comments_and_attrs
with collect_attrs
, 2nd round
2023-12-11 22:56:50 +03:30
bors
457b966b17
Auto merge of #16039 - WaffleLapkin:don't-emit-missing-assoc-items-diagnostic-for-negative-impls, r=Veykril
...
fix: Don't emit "missing items" diagnostic for negative impls
Negative impls can't have items, so there is no reason for this diagnostic.
LMK if I should add a test somewhere. Also LMK if that's not how we usually check multiple things in an if in r-a.
2023-12-10 22:24:32 +00:00
Maybe Waffle
1630477985
fix: Don't emit "missing items" diagnostic for negative impls
2023-12-10 22:21:59 +00:00
hkalbasi
9337519df5
Replace doc_comments_and_attrs
with collect_attrs
2023-12-09 23:32:51 +03:30
Lukas Wirth
b1a8f83a0c
fix: Smaller spans for unresolved field and method diagnostics
2023-12-08 18:46:36 +01:00
Young-Flash
fbe494a106
fix: change default diagnostic range into impl body
2023-12-07 20:45:42 +08:00
Young-Flash
861e47431b
update: make each trait_impl_reduntant_assoc_item into individual diagnostic
2023-12-06 22:17:55 +08:00
Young-Flash
5d84edd430
feat: add trait_impl_reduntant_assoc_item diagnostic
2023-12-06 22:17:55 +08:00
Lukas Wirth
ba01ff4f88
Fix diagnostics panicking when resolving to different files due to macros
2023-12-06 14:39:26 +01:00
Igor Matuszewski
a7224c998d
Don't explicitly warn against semicolon_in_expressions_from_macros
...
This has been warn-by-default for two years now and has already been
added to the future-incompat lints in 1.68.
2023-12-05 11:35:09 +01:00
bors
e91fdf7860
Auto merge of #15959 - Veykril:macro-shower3, r=lnicola
...
TokenMap -> SpanMap rewrite
Opening early so I can have an overview over the full diff more easily, still very unfinished and lots of work to be done.
The gist of what this PR does is move away from assigning IDs to tokens in arguments and expansions and instead gives the subtrees the text ranges they are sourced from (made relative to some item for incrementality). This means we now only have a single map per expension, opposed to map for expansion and arguments.
A few of the things that are not done yet (in arbitrary order):
- [x] generally clean up the current mess
- [x] proc-macros, have been completely ignored so far
- [x] syntax fixups, has been commented out for the time being needs to be rewritten on top of some marker SyntaxContextId
- [x] macro invocation syntax contexts are not properly passed around yet, so $crate hygiene does not work in all cases (but most)
- [x] builtin macros do not set spans properly, $crate basically does not work with them rn (which we use)
~~- [ ] remove all uses of dummy spans (or if that does not work, change the dummy entries for dummy spans so that tests will not silently pass due to havin a file id for the dummy file)~~
- [x] de-queryfy `macro_expand`, the sole caller of it is `parse_macro_expansion`, and both of these are lru-cached with the same limit so having it be a query is pointless
- [x] docs and more docs
- [x] fix eager macro spans and other stuff
- [x] simplify include! handling
- [x] Figure out how to undo the sudden `()` expression wrapping in expansions / alternatively prioritize getting invisible delimiters working again
- [x] Simplify InFile stuff and HirFIleId extensions
~~- [ ] span crate containing all the file ids, span stuff, ast ids. Then remove the dependency injection generics from tt and mbe~~
Fixes https://github.com/rust-lang/rust-analyzer/issues/10300
Fixes https://github.com/rust-lang/rust-analyzer/issues/15685
2023-12-04 19:59:53 +00:00
Lukas Wirth
5edf7bddc6
Fix mod item in included file resolving incorrectly
2023-12-02 13:49:09 +01:00
Lukas Wirth
c11737cd63
Simplify include handling
2023-12-01 14:58:57 +01:00
Young-Flash
b46f37854e
update: filter out syntax error in test
2023-11-30 19:35:25 +08:00
Lukas Wirth
f48fa0c6cb
Re-implement syntax fixups
2023-11-29 16:00:39 +01:00
Lukas Wirth
30093a6d81
spans always come from real file
2023-11-28 10:55:39 +01:00
Lukas Wirth
890eb17b4e
Replace ID based TokenMap with proper relative text-ranges / spans
2023-11-28 10:55:39 +01:00
Young-Flash
cab91480b2
fix: don't make MissingMatchArms
diagnostic for empty match body
2023-11-26 22:57:30 +08:00
Young-Flash
cfc881ae13
fix missing assoc item
2023-11-16 22:27:21 +08:00
Laurențiu Nicola
2bfd6b659d
Bump serde_json
2023-11-15 13:17:36 +02:00
Laurențiu Nicola
cb8434e594
Bump either
2023-11-15 13:07:36 +02:00
Laurențiu Nicola
f66df10f87
Bump itertools
2023-11-15 12:53:56 +02:00
Lukas Wirth
498f39eae2
fix: Diagnose everything in nested items, not just def diagnostics
2023-11-15 10:34:09 +01:00
Lukas Wirth
723d799ec1
Diagnose missing assoc items in trait impls
2023-11-14 22:00:52 +01:00
Lukas Wirth
e21d21a8fb
Diagnose incorrect unsafety for trait impls
2023-11-14 21:05:27 +01:00
Lukas Wirth
6ddccc9a6e
Diagnose some orphan trait impl cases
2023-11-14 18:09:34 +01:00
Lukas Wirth
e844784d8d
Simplify
2023-11-14 12:53:14 +01:00
Lukas Wirth
ba61766217
Add config for preferring / ignoring prelude modules in find_path
2023-11-11 14:56:38 +01:00
hkalbasi
3bcdb7d886
Truncate closure capture place for raw pointer
2023-11-09 20:59:17 +03:30
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
Lukas Wirth
88a00bf49d
Shrink PatPtr by swapping its AstPtr and Either wrap order
2023-10-06 12:32:37 +02:00
hkalbasi
af28458643
Downgrade unused_variables
to experimental
2023-09-30 08:38:55 +03:30
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
jDomantas
b3aba94cbd
use code from bug report for regression test
2023-09-17 16:52:32 +03:00
jDomantas
a77789e7aa
regression test
2023-09-17 11:54:42 +03:00
Lukas Wirth
affe5a7315
fix: Temporarily skip decl check in derive expansions
2023-09-12 23:10:03 +02:00
Lukas Wirth
8f5fee4a5a
Diagnose incorrect and private fields in record structs
2023-09-09 10:45:29 +02:00
Lukas Wirth
55c75450fb
Diagnose private fields in record constructor
2023-09-08 23:19:30 +02:00
Lukas Wirth
8654a098c7
Diagnose mismatched arg count for tuple struct patterns
2023-09-08 14:54:43 +02:00
Lukas Wirth
3fa0bf0dd3
Fix ide-diagnostics test fixture
2023-09-06 18:31:16 +02:00
hkalbasi
514fefab9c
Respect #[allow(unused_braces)]
2023-08-28 22:22:28 +03:30
xffxff
204bc2cb60
fix: diagnostics for 'while let' loop with label in condition
2023-08-26 10:41:19 +08:00
Lukas Wirth
bcff166b3a
Add ExternCrateDecl to HIR
2023-08-02 11:52:55 +02:00
bors
151c750dac
Auto merge of #15367 - Veykril:eager-macro-inputs, r=Veykril
...
fix: Strip unused token ids from eager macro input token maps
2023-08-01 11:23:02 +00:00
Lukas Wirth
a5059da57a
Update test fixture
2023-08-01 13:13:56 +02:00
bors
c71e1368fd
Auto merge of #15269 - DropDemBits:structured-snippets-deferred-rendering, r=Veykril
...
internal: Defer structured snippet rendering to allow escaping snippet bits
Since we know exactly where snippets are, we can transparently escape snippet bits to the exact text edits that need it, and not have to do it for anything other text edits.
Also will eventually fix #11006 once all assists are migrated. This comes as a side-effect of text edits that don't have snippets get marked as having no insert formatting at all.
2023-08-01 09:18:46 +00:00
Lukas Wirth
7c765d9f9e
fix: Expand eager macros to delimited comma separated expression list
2023-07-30 17:31:26 +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
hkalbasi
832eb0d94c
Normalize type alias in projected_ty
2023-07-17 01:16:26 +03:30
DropDemBits
89f7bf7411
Add SnippetEdit
to be alongside source changes
...
Rendering of snippet edits is deferred to places using source change
2023-07-12 00:43:41 -04:00
hkalbasi
42d35f8af9
Fix missing terminator in pattern matching of consts
2023-07-10 01:01:59 +03:30
bors
db17f792bf
Auto merge of #15223 - lowr:patch/no-unresolved-field-for-missing, r=HKalbasi
...
Don't show `unresolved-field` diagnostic for missing names
I don't think reporting ``"no field `[missing name]` on type `SomeType`"`` makes much sense because it's a syntax error rather than a semantic error. We already report a syntax error for it and I find it sufficient.
2023-07-06 11:54:08 +00:00
Ryo Yoshida
827a0530bc
Don't show unresolved-field
diagnostic for missing names
2023-07-06 20:39:48 +09:00
AmrDeveloper
54e897368d
Cover disable diagnostic from case with invalid syntax
2023-07-05 19:31:37 +02:00
AmrDeveloper
fe65eabc81
Remove un used import
2023-07-05 17:41:51 +02:00
AmrDeveloper
3fb6a3be82
Remove un needed extra handling for remove self with braces
2023-07-05 17:38:58 +02:00
AmrDeveloper
ce0239bd6a
Disable remove unnecessary braces diagnotics for self imports
2023-07-05 16:34:04 +02: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