Commit Graph

1070 Commits

Author SHA1 Message Date
Lukas Wirth
88a00bf49d Shrink PatPtr by swapping its AstPtr and Either wrap order 2023-10-06 12:32:37 +02:00
Lukas Wirth
fe398163b6 Recognize custom main function as binary entrypoint for runnables 2023-10-04 12:07:41 +02:00
hkalbasi
7834b8fadb Add unused_variables native diagnostic 2023-09-24 21:29:15 +03:30
bors
4a8622c8fa Auto merge of #15652 - Veykril:format_to, r=lnicola
minor: Various small fixes
2023-09-22 09:06:06 +00:00
Lukas Wirth
556f0c6704 Various small fixes 2023-09-22 10:13:51 +02:00
Maybe Waffle
a219dbda2b Remove most of the duplication from Semantics{,Impl} via deref 2023-09-13 22:02:28 +00: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
8eddc64f86 Simplify 2023-09-02 17:12:57 +02:00
Lukas Wirth
b1575528c0 Move doc comment handling into ide-db 2023-09-02 16:27:26 +02:00
Lukas Wirth
0bf0563a00 Add a few more db.unwind_if_cancelled() calls 2023-09-02 14:39:19 +02:00
Jessie Chatham Spencer
37e0e8af10 Implement extern crate completion 2023-08-20 16:36:59 +00:00
Lukas Wirth
eb6244c5f9 Record import aliases in symbol index 2023-08-18 11:46:35 +02:00
Lukas Wirth
637f496a81 fix: Fix auto-import (and completions) importing #[doc(hidden)] items 2023-08-17 12:30:19 +02:00
bors
49716e681a Auto merge of #15472 - Veykril:import-ide-support, r=Veykril
internal: Record import origins in ItemScope and PerNS

This records the import items definitions come from in the module scope (as well as what an import resolves to in an ItemScope). It does ignore glob imports as thats a lot more work for little to no gain, glob imports act as if the importing items are "inlined" into the scope which suffices for almost all use cases I believe (to my knowledge, attributes on them have little effect).

There is still a lot of work needed to make this available to the IDE layer, but this lays out the ground work for havin IDE layer support.

cc https://github.com/rust-lang/rust-analyzer/issues/14079
2023-08-17 09:56:42 +00:00
Lukas Wirth
a17d73ad36 Thread imports through the resolver 2023-08-17 10:52:13 +02:00
Lukas Wirth
53b292478d internal: Add offset param to token descending API 2023-08-16 10:07:18 +02:00
ponyii
fec5ff9890 start hovering default values of generic constants 2023-08-15 20:26:42 +04:00
bors
b771de3fdc Auto merge of #15179 - ponyii:fix/default-values-of-const-params-are-ignored, r=HKalbasi
the "add missing members" assists: implemented substitution of default values of const params

To achieve this, I've made `hir::ConstParamData` store the default values
2023-08-15 10:17:43 +00:00
bors
0fa822dfe1 Auto merge of #15418 - oxalica:fix/sig-from-macro, r=Veykril
Fix signature help of methods from macros

Currently the receiver type is copied from AST instead re-formatting through `HirDisplay`. Macro generated functions seem to have no spaces and their signature help are rendered like `fn foo(&'amutself)` instead of `fn foo(&'a mut self)`.
2023-08-15 06:25:13 +00:00
Lukas Wirth
9adff006e8 Simplify 2023-08-10 20:10:19 +02:00
bors
ddbbd6a7e7 Auto merge of #15417 - lowr:patch/purge-generic-arg-data-in-expr, r=HKalbasi
internal: use `Cast::cast()` instead of explicit interning

I firmly believe that we should generally use `cast()` instead of interning `GenericArgData` to construct `GenericArg` because it's less verbose and more readable.
2023-08-08 19:27:18 +00:00
oxalica
de86444756
Prefer hir::SelfParam and fix signature help of methods from macros 2023-08-09 02:42:08 +08:00
oxalica
6a2f83a8a2
Impl HirDisplay for SelfParam 2023-08-09 02:26:44 +08:00
ponyii
e4c45427dc refactoring 2023-08-08 21:57:55 +04:00
ponyii
4ebdc6f052 syntax update: the default value of ConstParam turned from Expr into ConstArg 2023-08-08 21:57:54 +04:00
ponyii
52b4392724 the "add missing members" assists: implemented substitution of default values of const params 2023-08-08 21:57:54 +04:00
Ryo Yoshida
6aa03c5d15
Use Cast::cast() instead of interning GenericArgData 2023-08-09 00:47:29 +09:00
Ryo Yoshida
0c433c23b1
Support doc links that resolve to fields 2023-08-07 00:59:35 +09:00
Lukas Wirth
ecb6d07d57 Add currently unused UseId variants 2023-08-02 14:53:45 +02:00
Lukas Wirth
6e2c3f610b Remove suspicious unwrap 2023-08-02 12:18:10 +02:00
Lukas Wirth
bcff166b3a Add ExternCrateDecl to HIR 2023-08-02 11:52:55 +02:00
bors
59d35d24a7 Auto merge of #15320 - lowr:fix/incorrect-name-case-for-inner-items, r=HKalbasi
Report `incorrect-ident-case` for inner items

Fixes #15319

Although we have been collecting the diagnostics for inner items within function bodies, we were discarding them and never reported to the users. This PR makes sure that they are all reported and additionally collects the diagnostics for inner items within const bodies, static bodies, and enum variant bodies.
2023-07-21 06:41:30 +00:00
Ryo Yoshida
b53a07835b
Report incorrect case for fn inner items 2023-07-21 15:07:49 +09:00
hkalbasi
eb143383c3 Pass TraitEnvironment into layout_ty and const_eval 2023-07-20 13:08:38 +03:30
Lukas Wirth
6a7b905c86 Fix the eager token maps by re-mapping the textranges between the input and input expansion 2023-07-13 09:22:38 +02:00
Lukas Wirth
d5f64f875a Infallibe ExpandDatabase::macro_def 2023-07-10 16:23:29 +02:00
hkalbasi
f0ba0dbe8a Use debug impl in rendering const eval result 2023-07-08 01:07:38 +03:30
hkalbasi
4a444e768c Implement recursion in mir interpreter without recursion 2023-07-07 15:07:29 +03:30
hkalbasi
3a1054fc1c Replace x with it 2023-07-06 17:33:17 +03:30
Lukas Wirth
8886d707b8 Stronger typing for AstId and AstIdMap 2023-07-04 09:16:15 +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
Lukas Wirth
69cd3c30ac Format let-else 2023-07-03 20:34:09 +02:00
Lukas Wirth
321e570d92 Don't diagnose builtin derives 2023-07-03 14:23:36 +02:00
Ryo Yoshida
4e793e7859
Use anonymous lifetime where possible 2023-06-29 23:27:28 +09:00
Ryo Yoshida
56dd5368f5
Refactor
- don't take `&self` as receiver for `Copy` types
- simplify `hir::Module::nearest_non_block_module()`
- style changes for consistency
2023-06-27 16:01:07 +09:00
Tetsuharu Ohzeki
7b418d3a8c Add the comment why HasSource::source() returns Option 2023-06-26 17:05:13 +09:00
hkalbasi
674cd5ab57 Add run-tests command 2023-06-22 19:33:37 +03:30