Commit Graph

891 Commits

Author SHA1 Message Date
Laurențiu Nicola
85f797f59c Bump chalk 2022-03-27 10:11:02 +03:00
hkalbasi
bf4a1e4842 use pat_id instead of name in const eval stack 2022-03-24 13:36:37 +04:30
hkalbasi
22eaee25b8 organize const eval tests 2022-03-24 13:20:35 +04:30
hkalbasi
0e2989e421 Support constants in const eval 2022-03-24 13:09:22 +04:30
bors[bot]
b8e1d09b90
Merge #11806
11806: fix: Fix async block type inference using containing function return type r=Veykril a=Veykril

Fixes https://github.com/rust-analyzer/rust-analyzer/issues/11804
Should fix https://github.com/rust-analyzer/rust-analyzer/issues/11798#issuecomment-1076880521

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-03-23 22:45:44 +00:00
Lukas Wirth
ed0c62597f fix: Fix async block type inference using containing function return type 2022-03-23 23:43:04 +01:00
bors[bot]
75fada4aab
Merge #11805
11805: fix: Don't try to resolve methods on unknown types r=Veykril a=flodiebold

Fixes #10454, and some type mismatches.

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2022-03-23 20:20:09 +00:00
Florian Diebold
e0e6bfb924 Fix filter_map in minicore 2022-03-23 19:47:11 +01:00
Florian Diebold
8d98f3c983 Don't try to resolve methods on unknown types
Fixes #10454, and some type mismatches.
2022-03-23 19:18:12 +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
Florian Diebold
5f24ff0d84 Fix unreachable_pub 2022-03-21 18:54:20 +01:00
Florian Diebold
8498eaa6ab Implement type checking for legacy_const_generics 2022-03-21 16:46:01 +01:00
Florian Diebold
2ef541b35f Cleanups 2022-03-21 16:46:01 +01:00
Florian Diebold
b632d706c7 Remove old diagnostics 2022-03-21 16:46:01 +01:00
Florian Diebold
2d30dd67d3 Expose coercion logic in hir API 2022-03-21 16:45:59 +01:00
Florian Diebold
6133e6a002 Extract coercion logic to InferenceTable
To make it accessible without an InferenceContext.
2022-03-21 16:45:30 +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]
966b692422
Merge #11771
11771: feat: Visualize compiler inserted reborrows via inlay hints r=Veykril a=Veykril

Disabled by default.

![image](https://user-images.githubusercontent.com/3757771/159165178-baaf968a-4381-468e-933f-5326ca1b203d.png)

Closes https://github.com/rust-analyzer/rust-analyzer/issues/11275


Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-03-20 13:47:16 +00:00
Lukas Wirth
37b48ceb8f feat: Visualize compiler inserted reborrows via inlay hints 2022-03-20 14:38:16 +01:00
Florian Diebold
60aeb8fa1a Move fallback_bound_vars to the only place it's used now 2022-03-17 17:08:43 +01:00
Florian Diebold
9ea2e0bd5b Fixes for consts 2022-03-17 17:04:32 +01:00
Florian Diebold
59b5696aaa Snapshot obligations 2022-03-17 17:04:32 +01:00
Florian Diebold
8f5b6ac556 Properly try unifying the receivers during method resolution
Instead of hackily checking if they're equal.
2022-03-17 17:03:54 +01:00
Florian Diebold
1b71cd074d Add test for DynMap type inference 2022-03-17 15:44:14 +01:00
hkalbasi
0141f28475 fix regression_11688_2 2022-03-17 12:47:31 +03:30
hkalbasi
1f3d18718c fix const generic panic 2022-03-15 22:34:05 +03:30
hkalbasi
b301b040f5 Add const generics 2022-03-14 14:38:37 +03:30
Matthias Krüger
5a0078c9d1 more clippy fixes:
clippy::search_is_some
clippy::redundant_static_lifetimes
clippy::match_single_binding
clippy::match_ref_pats
clippy::map_entry
clippy::manual_map
clippy::iter_overeager_cloned
clippy::into_iter_on_ref
clippy::extra_unused_lifetimes
2022-03-12 16:50:49 +01:00
Matthias Krüger
77790f2b8e fix clippy::needless_return 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
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
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
eba90936c1 Move ide crates to new hir::Macro 2022-03-08 23:52:26 +01:00
hkalbasi
1282178783 insert dummy values for const generics in subst 2022-03-09 02:02:42 +03:30
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
a148c49f1c Fix test fixture 2022-03-05 23:21:20 +01:00
bors[bot]
79a7ba0bdf
Merge #11623
11623: fix: Add type variable table to InferenceTableSnapshot r=flodiebold a=tysg

Fixes #11601. 

I observed that removing the `rollback` line in 6fc3d3aa4c fixes the issue.  

Looking at the stacktrace, I believe not restoring `type_variable_table` causes `type_variable_table` and `var_unification_table` to go out of sync, then when `hir_ty::infer::unify::InferenceTable::new_var` tries to extend `type_variable_table` to be the same length as `var_unification_table`, problems will arise.

However, I cannot pinpoint exactly how or where the vector capacity overflow happens, so my understanding might not be correct after all. 

Co-authored-by: Tianyi Song <42670338+tysg@users.noreply.github.com>
2022-03-05 10:32:07 +00:00
Tianyi Song
c49bcc7814 Add type variable table to InferenceTableSnapshot 2022-03-05 17:59:28 +08:00
hkalbasi
660fd4ab41 Resolve only type params in type ns 2022-03-04 12:30:53 +03:30
hkalbasi
4fa8749c44 Preserve order of generic args 2022-03-04 11:46:14 +03:30
Florian Diebold
82fe1c77b5 Add a (currently failing) test for #11242 2022-03-03 18:32:40 +01:00
Chayim Refael Friedman
744f0ea2e7
Remove misleading comments
They're not true anymore after #11375.
2022-02-27 09:52:11 +02:00