Commit Graph

257 Commits

Author SHA1 Message Date
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