Lukas Wirth
28ca371755
Consider trait to be in scope for trait-impl
2021-05-25 16:16:29 +02:00
Lukas Wirth
3ee4e6c54c
Fix type inference not working for new Try trait
2021-05-25 14:59:54 +02:00
Florian Diebold
4a6cdd776d
Record method call substs and use them in call info
2021-05-23 18:24:21 +02:00
Florian Diebold
67f1a08fd8
Some remaining cleanups
2021-05-21 18:23:03 +02:00
Florian Diebold
556c9cebdb
Refactor expectation handling
...
So as to not use `TyKind::Error` as "no expectation".
2021-05-21 18:23:03 +02:00
Florian Diebold
9716c0b949
Deal with goals arising from unification
2021-05-21 17:49:09 +02:00
Florian Diebold
4bd446f5b3
Get rid of resolve_ty_as_possible
...
Instead use shallow resolving where necessary.
2021-05-21 17:49:07 +02:00
Florian Diebold
a78f0076ab
Make resolve_ty_shallow return Ty
2021-05-21 17:48:34 +02:00
Florian Diebold
1250ddc5cf
Rework obligation handling
...
We can't do the easy hack that we did before anymore, where we kept
track of whether any inference variables changed since the last time we
rechecked obligations. Instead, we store the obligations in
canonicalized form; that way we can easily check the inference variables
to see whether they have changed since the goal was canonicalized.
2021-05-21 17:48:34 +02:00
Florian Diebold
212f0477f2
Make diverging type variables work again
...
Chalk doesn't know about the `diverging` flag, so we need to instead
propagate it before fully resolving the variables.
2021-05-21 17:48:34 +02:00
Florian Diebold
0f7f1f0705
Temporary fix for unknown expectations
2021-05-21 17:48:34 +02:00
Florian Diebold
693582946f
Rewrite coercion using the new unification
2021-05-21 17:48:33 +02:00
Florian Diebold
84074cb185
Remove our unification code, use Chalk's instead
2021-05-21 17:48:33 +02:00
Dawer
472317c008
internal: Record mismatches of pattern types.
2021-05-19 11:08:59 +05:00
Florian Diebold
d992736e79
Remove unused
2021-04-08 14:36:14 +02:00
Florian Diebold
0f058d61ce
Replace remaining fold
calls
2021-04-08 14:08:55 +02:00
Florian Diebold
be0084a0bc
InEnvironment::new takes a reference
2021-04-07 20:48:58 +02:00
bors[bot]
a8f1e41f0f
Merge #8394
...
8394: Infer variants through type aliased enums r=Veykril a=Veykril
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-04-07 09:35:40 +00:00
Lukas Wirth
41563fd612
Infer variants through type aliased enums
2021-04-07 11:31:50 +02:00
Florian Diebold
b03969cda9
Remove SolutionVariables
, add ConstrainedSubst analogous to Chalk
...
... just missing the constraints.
2021-04-06 23:46:32 +02:00
Florian Diebold
768ee3e47a
Align InferenceVar
to Chalk
2021-04-06 21:10:22 +02:00
Jonas Schievink
230c763648
infer: remove record_pat_field_resolutions
field
...
Same as https://github.com/rust-analyzer/rust-analyzer/pull/8376 , this
can be computed from other data
2021-04-06 19:44:28 +02:00
Jonas Schievink
e9752308bb
infer: remove record_field_resolutions
field
...
It stores no useful data, since we can derive all fields from
`variant_resolutions`
2021-04-06 17:59:18 +02:00
Lukas Wirth
9b4699a9be
Move Ty accessors to TyExt
2021-04-06 13:58:48 +02:00
Florian Diebold
30a339e038
Add Interner parameter to Binders::substitute
2021-04-05 19:21:01 +02:00
Florian Diebold
05eba0db3d
Binders::subst -> substitute
2021-04-05 19:20:28 +02:00
Laurențiu Nicola
65c2e51940
Rename TyKind::Unknown to Error
2021-04-05 15:39:06 +03:00
Florian Diebold
645a9c3a27
Move things from traits
module to types
as well
2021-04-04 20:27:40 +02:00
Florian Diebold
a4d7bdf1c8
Replace Substitution::bound_vars and ::type_params_for_generics
2021-04-04 13:16:39 +02:00
Florian Diebold
5d2b488aeb
Replace remaining uses of Substitution::build_for_def
2021-04-04 13:16:38 +02:00
Florian Diebold
cd227f581e
Add and start using TraitRef and ProjectionTy builders
2021-04-04 13:16:38 +02:00
Florian Diebold
c551604b5a
Rename Ty::interned to Ty::kind
...
... since that's the actual method on Chalk side that matches the signature.
2021-04-03 13:08:29 +02:00
Aleksey Kladov
387d7c7d96
minor: add profile call for resolve_obligations
2021-04-02 15:28:51 +03:00
Florian Diebold
0e8c4503bf
Don't recheck obligations if we have learned nothing new
...
This is just the most trivial check: If no inference variables have been
updated, and there are no new obligations, we can just skip trying to
solve them again. We could be smarter about it, but this already helps
quite a bit, and I don't want to touch this too much before we replace
the inference table by Chalk's.
Fixes #8263 (well, improves it quite a bit).
2021-04-01 21:45:44 +02:00
Josh Mcguigan
957939292e
completion relevance consider if types can be unified
2021-03-26 09:11:50 -07:00
Florian Diebold
c4fd3f47f5
Align InEnvironment with Chalk
...
This in particular means storing a chalk_ir::Environment, not our
TraitEnvironment. This makes InEnvironment not usable for Type, where we
need to keep the full TraitEnvironment.
2021-03-21 20:19:07 +01:00
Florian Diebold
7ec3b66f7a
Turn Obligation into something similar to chalk_ir::DomainGoal
...
This includes starting to make use of Chalk's `Cast` trait.
2021-03-20 12:47:12 +01:00
Lukas Wirth
8996b1a235
Replace Projection variant in GenericPredicate with AliasEq
2021-03-19 12:12:18 +01:00
Florian Diebold
7a7e47eab7
Chalkify TraitRef
2021-03-18 21:53:19 +01:00
Florian Diebold
ce2cae45b5
Rename Substs -> Substitution
2021-03-16 17:58:17 +01:00
bors[bot]
6139bd7649
Merge #8018
...
8018: Make Ty wrap TyKind in an Arc r=flodiebold a=flodiebold
... to further move towards Chalk.
This is a bit of a slowdown (218ginstr vs 213ginstr for inference on RA), even though it allows us to unwrap the Substs in `TyKind::Ref` etc..
Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2021-03-15 12:51:27 +00:00
Aleksey Kladov
f7156cb0ae
Simplify source maps for fields
2021-03-15 15:38:50 +03:00
Florian Diebold
af466f8542
Make Ty wrap TyKind in an Arc
...
... like it will be in Chalk. We still keep `interned_mut` and
`into_inner` methods that will probably not exist with Chalk.
This worsens performance slightly (5ginstr inference on RA), but doesn't
include other simplifications we can do yet.
2021-03-14 17:31:08 +01:00
Florian Diebold
3411fe3e84
Rename some fields to their Chalk names
2021-03-14 16:30:43 +01:00
Florian Diebold
3743ede404
Move type lowering methods to TyLoweringContext
2021-03-13 22:44:36 +01:00
Florian Diebold
c82d1823a1
Create TraitEnvironment through a query
2021-03-13 20:38:45 +01:00
Florian Diebold
1bf6b7360c
Use chalk_ir::PlaceholderIndex
2021-03-13 19:47:34 +01:00
Florian Diebold
19664e276a
Use chalk_ir::AssocTypeId
2021-03-13 17:56:48 +01:00
Florian Diebold
6c32bbf3ca
Separate Ty
and TyKind
like in Chalk
...
Currently `Ty` just wraps `TyKind`, but this allows us to change most
places to already use `intern` / `interned`.
2021-03-13 16:17:15 +01:00
Lukas Wirth
7072f59fc6
Use chalk_ir::Mutability
2021-03-01 19:57:36 +01:00