Commit graph

947 commits

Author SHA1 Message Date
hkalbasi
003a6b74e4 suggest infered type in auto complete 2022-04-03 11:17:33 +04:30
Lukas Wirth
1da2d82f58 internal: outline child modules with missing backing file 2022-04-02 16:17:54 +02:00
Lukas Wirth
75689f2ad8 internal: Enforce Resolver to always have a module scope 2022-03-31 11:12:08 +02:00
Lukas Wirth
e55ed52003 Simplify 2022-03-26 18:37:40 +01:00
Jonas Schievink
18ad750786 fix: properly import all types of macros with #[macro_use] again 2022-03-23 14:34:27 +01:00
bors[bot]
1a92ee5db5
Merge #11792
11792: minor: Bump dependencies r=Veykril a=Veykril



Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-03-22 21:00:24 +00:00
Lukas Wirth
8e91bb7660 minor: Bump dependencies 2022-03-22 17:42:24 +01:00
bors[bot]
800ae516db
Merge #11788
11788: internal: Improve `find_path` and extern prelude handling r=Veykril a=Veykril



Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-03-22 15:17:50 +00:00
Lukas Wirth
cb1b7e18fe internal: Improve find_path and extern prelude handling 2022-03-22 15:54:46 +01:00
Florian Diebold
ab3313b1cb Add new type-mismatch diagnostic 2022-03-21 16:46:01 +01:00
Laurențiu Nicola
1a37b17162 Replace write! with direct calls 2022-03-21 10:43:36 +02:00
bors[bot]
fedf724d82
Merge #11774
11774: feat: Tag macro calls as unsafe if they expand to unsafe expressions r=Veykril a=Veykril

as long as they aren't inside an unsafe block inside the macro that is.

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-03-20 18:15:29 +00:00
Lukas Wirth
3b7b223b25 Simplify 2022-03-20 19:13:50 +01:00
Lukas Wirth
68de7b30e0 feat: Tag macro calls as unsafe if they expand to unsafe expressions 2022-03-20 19:07:44 +01:00
bors[bot]
6ad8c022ed
Merge #11750
11750: fix: Fix runnables trying to add doc tests in the crate root from #[macro_export] macros r=Veykril a=Veykril

Fixes https://github.com/rust-analyzer/rust-analyzer/issues/11746
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-03-18 11:13:37 +00:00
Lukas Wirth
828196be3b fix: Fix runnables trying to add doc tests in the crate root from #[macro_export] macros 2022-03-18 12:01:59 +01:00
Florian Diebold
9ea2e0bd5b Fixes for consts 2022-03-17 17:04:32 +01:00
bors[bot]
683fea4de4
Merge #11707
11707: minor: Simplify r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-03-14 20:05:46 +00:00
Lukas Wirth
fbc1d2a514 Simplify 2022-03-14 20:36:35 +01:00
hkalbasi
b301b040f5 Add const generics 2022-03-14 14:38:37 +03:30
Matthias Krüger
56e4ea59d9 more clippy fixes:
clippy::match_like_matches_macro
clippy::to_string_in_format_args
clippy::single_char_add_str
clippy::filter_map_identity
clippy::clone_on_copy
clippy::useless_format
clippy::unused_unit
2022-03-12 16:50:49 +01:00
Matthias Krüger
21ffc5350d fix clippy::redundant_clone 2022-03-12 16:50:49 +01:00
Matthias Krüger
62ed658311 fix clippy::useless_conversion 2022-03-12 16:50:49 +01:00
Matthias Krüger
451fcd3c79 fix clippy::redundant_closure 2022-03-12 16:50:49 +01:00
Matthias Krüger
1f70886b15 fix clippy::single_char_pattern 2022-03-12 16:50:49 +01:00
Matthias Krüger
7912e33ed6 fix clippy::needless_borrow 2022-03-12 16:50:49 +01:00
Lukas Wirth
a9dd606387 fix: Show what file paths were expected for unresolved modules 2022-03-11 17:08:30 +01:00
bors[bot]
5b51cb835a
Merge #11664
11664: fix: Properly handle proc-macro crate types for nameres r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-03-09 21:45:42 +00:00
bors[bot]
4fcaefa62a
Merge #11660
11660: Insert dummy values for const generics in subst r=flodiebold a=HKalbasi

fix #11659 

This is a band-aid until proper const generic support.

Co-authored-by: hkalbasi <hamidrezakalbasi@protonmail.com>
2022-03-09 17:18:03 +00:00
Lukas Wirth
5b9799bba4 Specify proc-macro crate type for proc-macro hir_def test fixtures 2022-03-09 15:36:05 +01:00
Lukas Wirth
3edc5dcea8 fix: Properly handle proc-macro crate types for nameres 2022-03-09 14:33:39 +01:00
bors[bot]
d70ea759b3
Merge #11663
11663: Internal: Add hir_def::MacroId, add Macro{Id} to ModuleDef{Id} r=Veykril a=Veykril

With this we can now handle macros like we handle ModuleDefs making them work more like other definitions and allowing us to remove a bunch of special cases. This also enables us to track the modules these macros are defined in, instead of only recording the crate they come from.

Introduces a new class of `MacroId`s (for each of the 3 macro kinds) into `hir_def`. We can't reuse `MacroDefId` as that is defined in `hir_expand` which doesn't know of modules, so now we have two different macro ids, this unfortunately requires some back and forth mapping between the two via database accesses which I hope won't be too expensive.

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-03-09 10:26:34 +00:00
Lukas Wirth
2537ad0d9e Simplify 2022-03-09 11:26:06 +01:00
Lukas Wirth
f9c8646d89 fix symbol index collection not collecting legacy macros 2022-03-09 01:44:20 +01:00
Lukas Wirth
4e94fb7028 Fix ProcMacroData recording wrong name for derives 2022-03-09 01:13:38 +01:00
Lukas Wirth
c37fe779c6 Add data queries for macros 2022-03-09 00:41:54 +01:00
Lukas Wirth
55ec93a337 Remove unnecessary macro_declarations from ItemScope 2022-03-09 00:19:53 +01:00
Lukas Wirth
dbada38b61 Only store derive<->derive-helper mapping in DefMap 2022-03-09 00:01:19 +01:00
Lukas Wirth
ad54ee2939 Rename MacroDef to Macro 2022-03-08 23:51:19 +01:00
hkalbasi
1282178783 insert dummy values for const generics in subst 2022-03-09 02:02:42 +03:30
Lukas Wirth
42d46325a1 Add MacroId to hir_def in attempt to unify Macros with ModuleDefId 2022-03-08 21:50:00 +01:00
bors[bot]
96c11f5fd6
Merge #11630
11630: fix: Recognize `Self` as a proper keyword r=Veykril a=Veykril

Fixes https://github.com/rust-analyzer/rust-analyzer/issues/11627

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-03-05 23:48:54 +00:00
Lukas Wirth
0bb631bf71 Simplify 2022-03-05 23:53:24 +01:00
Lukas Wirth
b454f11f38 Fix hover for Self keyword 2022-03-05 23:47:44 +01:00
bors[bot]
b032993733
Merge #11629
11629: fix: Fix macro-calls expanding to items in if/while conditions r=Veykril a=Veykril

Fixes https://github.com/rust-analyzer/rust-analyzer/issues/11617

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-03-05 22:34:59 +00:00
Lukas Wirth
c0d6471143 fix: Recognize Self as a proper keyword 2022-03-05 23:20:06 +01:00
Lukas Wirth
bb47c5f56c fix: Fix macro-calls expanding to items in if/while conditions 2022-03-05 21:58:51 +01:00
bors[bot]
8f504dc873
Merge #11598
11598: feat: Parse destructuring assignment r=Veykril a=ChayimFriedman2

Part of #11532.

Lowering is not as easy and may not even be feasible right now as it requires generating identifiers: `(a, b) = (b, a)` is desugared into
```rust
{
    let (<gensym_a>, <gensym_b>) = (b, a);
    a = <gensym_a>;
    b = <gensym_b>;
}
```

rustc uses hygiene to implement that, but we don't support hygiene yet.

However, I think parsing was the main problem as lowering will just affect type inference, and while `{unknown}` is not nice it's much better than a syntax error.

I'm still looking for the best way to do lowering, though.

Fixes #11454.

Co-authored-by: Chayim Refael Friedman <chayimfr@gmail.com>
2022-03-05 11:31:29 +00:00
bors[bot]
908c17bfa6
Merge #11595
11595: fix: lower string literals with actual value instead of default r=lnicola a=tysg

Fixes #11582. Some questions below in the code review section.

Co-authored-by: Tianyi Song <42670338+tysg@users.noreply.github.com>
2022-03-04 20:21:43 +00:00
Lukas Wirth
4a866fc672 Simplify 2022-03-04 20:23:25 +01:00