blob: 3ff88c5b35d4e6e44902b8c5f28a8d40f27a9d7a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
Type inference
# Type equality procedure
## Requirements
- Called to indicate that two types (passed as `const ::HIR::TypeRef&` from the HIR) must be the same
- Must handle cases where either of the passed typerefs point to aliased inferrence vars
## Rough procedure
- Locate real type pointed to by both arguments
- If neither have concrete information, alias the right to the left
- If both are concrete, ensure that both are equal (recursing for infer)
- If only one is concrete, alias the infer to it
# Code Elements
## Function/Method references
Needs to be able to point to functions in:
- Root namespace (with parameters)
- Trait (with two sets of parameters)
- Type impl block (with two sets of parameters)
- NOTE: Don't need to worry about trait impl blocks?
- What about handling an associated type return (fully known)
Maybe can use separate types for each usecase?
# Hard Questions
## libgit2 inferrence quirk
Query on rust type inferrence rules (as designed/intended, not as implemented)
Can the presence of a trait impl influence type inferrence for the Self type?
- `*mut _ : Convert<*mut T>`, if there's only one type that implements that
trait, is it valid to infer `_` based on that impl?
<!-- vim: ft=markdown
-->
|