Commit Graph

228 Commits

Author SHA1 Message Date
zhoufan
7b952cb1aa infer associated method in local scope 2021-12-14 15:34:57 +08:00
Lukas Wirth
1bbc255ec5 Remove some allocations 2021-12-10 20:01:24 +01:00
Lukas Wirth
f9c59d3752 Use known names instead of string literals 2021-12-09 18:13:15 +01:00
Jonas Schievink
b365b6119c Treat extern blocks as item containers 2021-12-07 17:31:26 +01:00
Laurențiu Nicola
26aba38168 Bump chalk 2021-12-04 15:08:43 +02:00
Lukas Wirth
ceaec9d866 internal: Replace Vec with Box in hir Pat 2021-11-20 16:17:30 +01:00
Lukas Wirth
cc327774b7 internal: Replace Vec with Box in hir Expr 2021-11-20 16:00:45 +01:00
Laurențiu Nicola
24eca25d8a Make some functions non-generic 2021-10-20 20:20:17 +03:00
Jonas Schievink
f8acae7895 Support let...else 2021-10-07 17:06:24 +02:00
Aramis Razzaghipour
9583dd5725
Replace if let with match where appropriate 2021-10-05 09:00:21 +11:00
Florian Diebold
a2d9f7d7bb Avoid type inference panic on bitslice methods
Should fix #10090, #10046, #10179.
This is only a workaround, but the proper fix requires some bigger
refactoring (also related to fixing #10058), and this at least prevents
the crash.
2021-09-12 10:49:40 +02:00
Lukas Wirth
36a5ce9790 minor: fix some clippy lints 2021-09-03 16:00:50 +02:00
bors[bot]
25368d2430
Merge #9954
9954: feat: Show try operator propogated types on ranged hover  r=matklad a=Veykril

Basically this just shows the type of the inner expression of the `?` expression as well as the type of the expression that the `?` returns from:
![Code_wIrCxMqLH9](https://user-images.githubusercontent.com/3757771/130111025-f7ee0742-214a-493b-947a-b4a671e4be92.png)

Unless both of these types are `core::result::Result` in which case we show the error types only.
![Code_Xruw5FCBNI](https://user-images.githubusercontent.com/3757771/130111024-f9caef82-92e4-4070-b3dd-f2ff9e5d87a9.png)

If both types are `core::option::Option` with different type params we do not show this special hover either as it would be pointless(instead fallback to default type hover)

Very much open to changes to the hover text here(I suppose we also want to show the actual type of the `?` expression, that is its output type?).

Fixes #9931

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-09-01 09:26:10 +00:00
Florian Diebold
424dda8113 Refactor & improve handling of overloaded binary operators
Fixes #9971. Also records them as method resolutions, which we could use
later.
2021-08-22 17:35:50 +02:00
bors[bot]
9e3517f8f3
Merge #9975
9975: minor: Fix panic caused by #9966 r=flodiebold a=flodiebold

Chalk can introduce new type variables when doing lazy normalization, so we have to do the proper 'fudging' after all.

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2021-08-21 18:07:36 +00:00
Florian Diebold
df77e2448c Fix panic caused by #9966
Chalk can introduce new type variables when doing lazy normalization, so
we have to do the proper 'fudging' after all.
2021-08-21 20:07:07 +02:00
Laurențiu Nicola
104d6124d7 Handle coercion on binary operator RHS 2021-08-21 17:54:45 +03:00
Florian Diebold
1791a35f9f Determine expected parameters from expected return in calls
Fixes #9560
2021-08-21 14:33:31 +02:00
Lukas Wirth
95923c7b29 Fix imports 2021-08-19 17:33:58 +02:00
Jonas Schievink
4757679b9a feat: type inference for if-let guards 2021-08-14 00:09:30 +02:00
Jonas Schievink
d568e7686a Support if let match guards 2021-08-13 00:25:14 +02:00
Dawer
6c366ade00 Clean up 2021-08-12 21:20:28 +05:00
Dawer
de074fe636 Accept ambiguous unsize coercion only if it has definite guidance. 2021-08-11 22:09:32 +05:00
Dawer
72002b401d internal: allow ambiguous unsize coercion. 2021-08-04 19:15:23 +05:00
Aleksey Kladov
12d7f5b56e internal: explain that we don't ref in style.md 2021-08-02 15:59:28 +03:00
Laurențiu Nicola
ea0014c500 Remove some redundant clones 2021-07-27 21:32:55 +03:00
Jonas Schievink
b596c32a41 Resolve tuple variants in value namespace 2021-07-22 13:40:18 +02:00
Florian Diebold
7c00ca2f51 Revert "Merge #9655"
This reverts commit 8c8c6fb73d, reversing
changes made to ec7b4cbf8f.
2021-07-20 22:53:39 +02:00
Florian Diebold
ae22050a42 Determine expected parameters from expected return in calls
Fixes #9560
2021-07-18 20:56:44 +02:00
Lukas Wirth
69e6511820 Record autoderef adjustments 2021-07-10 12:26:18 +02:00
Lukas Wirth
9272942b92 Use CoerceMany in BreakableContext 2021-07-09 15:51:07 +02:00
Lukas Wirth
f73d0ee439 Minor cleanup 2021-07-08 14:27:54 +02:00
Lukas Wirth
64a1b26b8d Implement CoerceMany 2021-07-08 14:16:23 +02:00
Lukas Wirth
9779526d8f Record coercion adjustments 2021-07-08 13:07:24 +02:00
Laurențiu Nicola
3b2602cbb2 Don't unify array elements with their arrays 2021-07-08 12:55:00 +03:00
Jonas Schievink
cb63b021ff Implement LUB coercion of array elements 2021-07-07 22:50:20 +02:00
Jonas Schievink
835d1cec59 Substitute self type instead of fusing binders 2021-07-02 00:16:36 +02:00
Jonas Schievink
cee9a7e26a Bind the right number of variables in the FnPointer 2021-07-01 20:54:25 +02:00
Jonas Schievink
e6fdb38d38 Use as_tuple() 2021-07-01 20:45:47 +02:00
Jonas Schievink
b5a2289676 Remove unneeded shifted_in 2021-06-30 15:45:00 +02:00
Jonas Schievink
b502a10b1e update comment 2021-06-30 15:13:59 +02:00
Jonas Schievink
88a86d4ff9 Fix deduction of dyn Fn closure parameter types 2021-06-30 15:04:04 +02:00
Laurențiu Nicola
e3ce88f6f2 Minor clippy perf fixes 2021-06-18 14:40:51 +03:00
Lukas Wirth
95c8c65139 Nest all the or-patterns! 2021-06-17 17:37:14 +02:00
bors[bot]
5a8ddb4b2d
Merge #9260
9260: tree-wide: make rustdoc links spiky so they are clickable r=matklad a=lf-

Rustdoc was complaining about these while I was running with --document-private-items and I figure they should be fixed.

Co-authored-by: Jade <software@lfcode.ca>
2021-06-14 07:16:48 +00:00
Jade
20b325c7d5 tree-wide: make rustdoc links spiky so they are clickable 2021-06-13 21:58:05 -07:00
Maan2003
5ac6804bb3
cargo fmt 2021-06-13 09:48:15 +05:30
Maan2003
aabd41cafc
clippy::redundant_field_names 2021-06-13 09:40:22 +05:30
Maan2003
c9b4ac5be4
clippy::redudant_borrow 2021-06-13 09:24:16 +05:30
Florian Diebold
20487a1b4a Fix coercion in match with expected type
Plus add infrastructure to test type mismatches without expect.
2021-06-12 23:04:43 +02:00