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
bors
daba334611
Auto merge of #15206 - Veykril:let-else-fmt, r=Veykril
...
internal: Format let-else
As nightly finally got support for it I went ahead and formatted r-a with the latest nightly, then with the latest stable (in case other stuff changed)
2023-07-03 18:41:59 +00:00
Lukas Wirth
69cd3c30ac
Format let-else
2023-07-03 20:34:09 +02:00
Lukas Wirth
e52027861e
Add analysis-stats flag to trigger some IDE features
2023-07-03 16:04:08 +02:00
Ryo Yoshida
4e793e7859
Use anonymous lifetime where possible
2023-06-29 23:27:28 +09:00
Lukas Wirth
d8b970f1fc
Skip mutable diagnostics on synthetic bindings
2023-06-21 19:38:19 +02:00
hkalbasi
e55a1f1916
Map our diagnostics to rustc and clippy's ones
2023-06-15 01:47:22 +03:30
hkalbasi
b4907a531f
Fix missing terminator for slice pattern
2023-06-04 20:59:27 +03:30
hkalbasi
0408af6453
Fix unused-mut
false positive for Box
2023-06-04 15:56:01 +03:30
hkalbasi
71f3e4b08c
Detect "bound more than once" error and suppress need-mut
for it.
2023-06-04 12:39:36 +03:30
hkalbasi
08f89193b5
Fix drop scopes in mir
2023-06-04 01:03:32 +03:30
bors
0b4c09b1d2
Auto merge of #14941 - Veykril:def-map, r=Veykril
...
Shrink `DefMap`, share crate level items with block def maps
2023-06-01 16:42:12 +00:00
hkalbasi
f4c52b40bd
fix bug in labeled for loop desugaring
2023-06-01 17:51:53 +03:30
Lukas Wirth
dc7c6d43c7
Slightly shrink DefMap
2023-06-01 14:46:36 +02:00
Lukas Wirth
ecb8616870
fix: Don't duplicate sysroot crates in rustc workspace
2023-05-31 15:37:35 +02:00
hkalbasi
51368793b4
MIR episode 6
2023-05-28 23:25:15 +03:30
Lukas Wirth
8bc826dd53
Add diagnostic for _
expressions (typed holes)
2023-05-28 14:55:28 +02:00
hkalbasi
c21d09f3cc
insert type vars in function arguments
2023-05-26 14:26:13 +03:30
hkalbasi
780349bdaf
fix need-mut
false positive in closure capture of match scrutinee
2023-05-26 02:08:37 +03:30
hkalbasi
7ef185d65e
evaluate UnevaluatedConst
in unify
2023-05-25 19:37:20 +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
b55fbd3ad7
Add moved-out-of-ref
diagnostic
2023-05-18 19:17:06 +03:30
Lukas Wirth
478705baf5
fix: Diagnose non-value return and break type mismatches
2023-05-16 22:47:27 +02:00
hkalbasi
7da80d4f67
Use double reference in debug derive
2023-05-12 12:36:57 +03:30
hkalbasi
36c9d5ce17
Fix pattern type mismatch in tuples
2023-05-04 16:03:36 +03:30
hkalbasi
3a3c3630a2
fix break-outside-of-loop false positive in try block
2023-05-02 03:11:56 +03:30
Aleksey Kladov
f3de9d8f54
fix: don't wavy-underline iterator chains
2023-04-29 17:31:53 +01:00
bors
8f06f995c5
Auto merge of #14644 - matklad:matklad/diag-adj, r=lnicola
...
feat: don't wavy-underline the whole for loop
2023-04-24 10:38:27 +00:00
Aleksey Kladov
774575106c
feat: don't wavy-underline the whole for loop
2023-04-24 11:31:52 +01:00
hkalbasi
01c1b3dc71
Fix panic in const eval and parameter destructing
2023-04-24 00:49:57 +03:30
hkalbasi
0c621065fb
Fix need-mut large span in closures and a false positive
2023-04-21 02:15:19 +03:30
bors
2400b36a2e
Auto merge of #14577 - jsoref:spelling, r=lnicola
...
Spelling
This PR corrects misspellings identified by the [check-spelling action](https://github.com/marketplace/actions/check-spelling ).
The misspellings have been reported at https://github.com/jsoref/rust-analyzer/actions/runs/4699991040#summary-12751355796
The action reports that the changes in this PR would make it happy: https://github.com/jsoref/rust-analyzer/actions/runs/4699991284#summary-12751356293
closes #14567
2023-04-19 14:05:40 +00:00
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
hkalbasi
f05f7ab082
Add minicore smoke test
2023-04-18 17:38:38 +03:30
Lukas Wirth
a2a3fecae3
Option begone part 2
2023-04-16 19:20:48 +02:00
Lukas Wirth
0f4ffaa5af
Fix duplicate eager expansion errors
2023-04-16 19:20:35 +02:00
Lukas Wirth
d1632c2727
Report syntax errors from item level macro expansions
2023-04-16 17:22:06 +02:00
Lukas Wirth
a5558cdfe5
internal: Report macro definition errors on the definition
2023-04-16 14:15:59 +02:00
hkalbasi
7cb4318331
Fix explicit deref problems in closure capture
2023-04-14 15:32:40 +03:30
Ryo Yoshida
ac03de773f
Add flag to disallow opaque types for DisplayTarget::SourceCode
2023-04-12 19:03:48 +09:00
hkalbasi
59b6f2d9f2
Compute closure captures
2023-04-10 23:04:34 +03:30
Lukas Wirth
98a673c4a8
fix: Fix project linking popup appearing for modules that can be linked to a crate
2023-04-09 10:17:58 +02:00
Lukas Wirth
fbb1bd5880
Re-enable controlflow outside loop diagnostic
2023-04-06 15:37:53 +02:00
Lukas Wirth
0e7117900c
internal: Resolve labels in body lowering
2023-04-06 14:21:20 +02:00
hkalbasi
d7fe4e2fa8
lower adjusts in simple index except the last one
2023-04-01 16:49:32 +03:30
Lukas Wirth
f1f64e92d7
Fix mutability_error::overloaded_index test
2023-03-29 18:07:25 +02:00
bors
7a98e24777
Auto merge of #14431 - Veykril:simplify, r=Veykril
...
minor: Simplify
2023-03-29 07:28:42 +00:00
Lukas Wirth
8ea1afce28
Simplify
2023-03-28 16:32:26 +02:00
hkalbasi
d5c7ec499a
fix stack overflow in is_ty_uninhabited_from
2023-03-28 15:45:35 +03:30
bors
5bba438c9c
Auto merge of #14366 - Veykril:linked-proj, r=Veykril
...
feat: Pop a notification prompting the user to add a Cargo.toml of unlinked file to the linkedProjects
cc https://github.com/rust-lang/rust-analyzer/issues/13226 https://github.com/rust-lang/rust-analyzer/issues/9661
2023-03-28 07:05:43 +00:00
Lukas Wirth
ee02213e65
Handle proc macro fetching via OpQueue
2023-03-26 09:33:41 +02:00
hkalbasi
9ad83deecc
Support overloaded index MIR lowering
2023-03-17 19:10:25 +03:30
hkalbasi
eb4939e217
Support overloaded deref MIR lowering
2023-03-17 14:02:55 +03:30
hkalbasi
a063f000ff
Support function pointer MIR lowering
2023-03-17 13:08:35 +03:30
Lukas Wirth
66636939a6
feat: Pop a notification prompting the user to add a Cargo.toml of unlinked file to the linkedProjects
2023-03-16 16:26:19 +01:00
XFFXFF
0c935732bc
do not offer fixit for macro expansions and refactor the code
2023-03-15 09:12:40 +08:00
XFFXFF
bf0322cd0c
pick the best ancestor expr of unsafe expr to add unsafe block. Thanks! @Veykril
2023-03-15 09:07:11 +08:00
XFFXFF
82780d8caf
feat: add an autofix for inserting an unsafe block to missing unsafe diagnostic
2023-03-15 09:07:11 +08:00
Lukas Wirth
f34b2469bd
lint incoherent inherent impls
2023-03-14 19:20:44 +01:00
Lukas Wirth
1a9fbf0a6d
fix: Fix visibility resolution not respecting parent blocks
2023-03-14 13:42:08 +01:00
bors
6a98e961f8
Auto merge of #14340 - Veykril:expand, r=lnicola
...
internal: Rename AstDatabase to ExpandDatabase
2023-03-14 09:37:54 +00:00
hkalbasi
d7da9e64d1
Add storage dead for let bindings without initializer
2023-03-14 12:15:16 +03:30
Lukas Wirth
9fb9ee3b6a
internal: Rename AstDatabase to ExpandDatabase
2023-03-13 16:35:41 +01:00
bors
70e10deee8
Auto merge of #14326 - iDawer:refactor, r=Veykril
...
internal: Rename `hir::diagnostics::MissingMatchArms.match_expr` field
`hir::diagnostics::MissingMatchArms.match_expr` had confusing name: it is pointing to scrutinee expression. Renamed to `scrutinee_expr` and used better fitting type for it.
Also small refactorings/cleanup.
2023-03-11 07:36:00 +00:00
iDawer
5e8c586f3b
Refactor hir::diagnostics::MissingMatchArms fields, better naming
2023-03-10 18:22:32 +05:00
hkalbasi
a980b562a7
Fix stack overflow when derefrencing &!
2023-03-10 13:44:34 +03:30
hkalbasi
8593132a43
fix block with no termination in or patterns
2023-03-09 22:32:12 +03:30
bors
ecc32c2f85
Auto merge of #14271 - Veykril:ty-diag-err, r=Veykril
...
Don't trigger unresolved method/field diagnostics on types containing errors
2023-03-07 14:25:20 +00:00
Lukas Wirth
d45708fabe
Don't trigger unresolved method/field diagnostics on types containing errors
2023-03-07 15:24:43 +01:00
bors
44ff3c407a
Auto merge of #14232 - HKalbasi:mir, r=Veykril
...
MIR episode 2
This PR adds:
1. `need-mut` and `unused-mut` diagnostics
2. `View mir` command which shows MIR for the body under cursor, useful for debugging
3. MIR lowering for or-patterns and for-loops
2023-03-07 09:49:49 +00:00
hkalbasi
bcd7ecb242
Add profiling to mir lower and borrowck query
2023-03-07 12:42:52 +03:30
Lukas Wirth
34a3187ee8
internal: Mark unresolved field, unresolved method and expected function diagnostics experimental
2023-03-06 22:24:38 +01:00
hkalbasi
2cce9dc3e9
Make unused_mut
diagnostic experimental
2023-03-06 21:09:09 +03:30
hkalbasi
af90ec8096
Partially support "overloaded deref" MIR lowering
2023-03-06 21:09:09 +03:30
hkalbasi
bf0f99f15d
Fix overloaded deref unused mut false positive
2023-03-06 21:09:09 +03:30
hkalbasi
6377d50bd1
Support "for loop" MIR lowering
2023-03-06 21:09:09 +03:30
hkalbasi
ac04bfd7a7
Add View Mir
command and fix some bugs
2023-03-06 21:09:09 +03:30
hkalbasi
a25710b0c0
Add need-mut
and unused-mut
diagnostics
2023-03-06 21:09:08 +03:30
Lukas Wirth
29150c2315
Disable pattern type mismatches again
2023-03-03 22:41:41 +01:00
Lukas Wirth
e7485a0416
Diagnose unresolved method calls
2023-03-03 20:43:13 +01:00