aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_ty/src/infer
Commit message (Collapse)AuthorAgeFilesLines
* Add inference for literal and range patternsFlorian Diebold2020-04-011-2/+9
|
* Use `dyn Trait` for working with databseAleksey Kladov2020-03-165-37/+35
| | | | | | | It improves compile time in `--release` mode quite a bit, it doesn't really slow things down and, conceptually, it seems closer to what we want the physical architecture to look like (we don't want to monomorphise EVERYTHING in a single leaf crate).
* Resolve `Self::AssocTy` in implsFlorian Diebold2020-03-061-2/+2
| | | | | | | | | | To do this we need to carry around the original resolution a bit, because `Self` gets resolved to the actual type immediately, but you're not allowed to write the equivalent type in a projection. (I tried just comparing the projection base type with the impl self type, but that seemed too dirty.) This is basically how rustc does it as well. Fixes #3249.
*-. Merge #3397 #3398bors[bot]2020-03-021-6/+2
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 3397: Minimal viable meta r=matklad a=matklad bors r+ 🤖 3398: Reformat? r=matklad a=matklad bors r+ 🤖 Co-authored-by: Aleksey Kladov <[email protected]>
| | * Reformat?Aleksey Kladov2020-03-021-6/+2
| |/
* | Merge #3385bors[bot]2020-03-021-3/+12
|\ \ | |/ |/| | | | | | | | | | | | | | | | | 3385: Fix #3373 r=matklad a=flodiebold Basically, we need to allow variables in the caller self type to unify with the impl's declared self type. That requires some more contortions in the variable handling. I'm looking forward to (hopefully) handling this in a cleaner way when we switch to Chalk's types and unification code. Co-authored-by: Florian Diebold <[email protected]>
| * Fix #3373Florian Diebold2020-03-011-3/+12
| | | | | | | | | | | | | | Basically, we need to allow variables in the caller self type to unify with the impl's declared self type. That requires some more contortions in the variable handling. I'm looking forward to (hopefully) handling this in a cleaner way when we switch to Chalk's types and unification code.
* | handle array pattern matching type inferenceJosh Mcguigan2020-03-011-10/+14
| |
* | remove match statement, handle suffixJosh Mcguigan2020-03-011-12/+9
| |
* | handle arbitrary length slicesJosh Mcguigan2020-03-011-3/+5
| |
* | match single prefix sliceJosh Mcguigan2020-03-011-1/+15
|/
* Do autoderef for indexingFlorian Diebold2020-02-291-5/+21
|
* Fix a common false-positive type mismatchFlorian Diebold2020-02-291-4/+4
| | | | | | | | | E.g. for `&{ some_string() }` in a context where a `&str` is expected, we reported a mismatch inside the block. The problem is that we're passing an expectation of `str` down, but the expectation is more of a hint in this case. There's a long comment in rustc about this, which I just copied. Also, fix reported location for type mismatches in macros.
* Fix handling of binders in canonicalizationFlorian Diebold2020-02-221-64/+35
| | | | I'm looking forward to getting rid of this in favor of Chalk's implementation.
* Implement unsize coercion using proper trait solvingFlorian Diebold2020-02-221-179/+26
|
* Fix handling of const patternsFlorian Diebold2020-02-211-1/+3
| | | | | | | | | E.g. in `match x { None => ... }`, `None` is a path pattern (resolving to the option variant), not a binding. To determine this, we need to try to resolve the name during lowering. This isn't too hard since we already need to resolve names for macro expansion anyway (though maybe a bit hacky). Fixes #1618.
* Normalize associated types in types coming from ChalkFlorian Diebold2020-02-211-1/+4
| | | | Fixes #3232.
* More manual clippy fixesKirill Bulatov2020-02-183-18/+10
|
* Run cargo +nightly fix --clippy -Z unstable-optionsKirill Bulatov2020-02-184-42/+35
|
* Fix coercion of &T to itselfFlorian Diebold2020-02-161-0/+2
| | | | | The autoderef coercion logic did not handle matching placeholders. This led to some type mismatches.
* Don't let unknown match arms fall back to !Florian Diebold2020-02-111-1/+5
|
* Add or- and parenthesized-patternsMatthew Jasper2020-02-092-3/+13
|
* Fix some TODOsFlorian Diebold2020-02-071-1/+0
|
* Deal better with implicit type parameters and argument listsFlorian Diebold2020-02-071-3/+5
|
* FormattingFlorian Diebold2020-02-073-12/+5
|
* Clean up RPIT a bitFlorian Diebold2020-02-071-1/+0
|
* Use variables in predicates as wellFlorian Diebold2020-02-071-2/+2
|
* Comment fixes / todosFlorian Diebold2020-02-071-0/+1
|
* Change Ty::Param to contain param IDFlorian Diebold2020-02-073-15/+13
|
* Fix another testFlorian Diebold2020-02-071-5/+1
|
* Lower impl trait to variables, move away from using placeholders where they ↵Florian Diebold2020-02-072-41/+20
| | | | don't belong
* wip lower impl trait to type argsFlorian Diebold2020-02-071-2/+2
|
* Add impl trait lowering modeFlorian Diebold2020-02-071-5/+24
|
* Introduce TyLoweringContextFlorian Diebold2020-02-071-14/+11
|
* Fix inference for shift operatorsFlorian Diebold2020-01-171-2/+2
| | | | Fixes #2602.
* Push resolver further upAleksey Kladov2020-01-142-8/+20
|
* Coerce closures to fn pointersFlorian Diebold2019-12-201-0/+4
| | | | E.g. `let x: fn(A) -> B = |x| { y };`
* Fix coercion of last expression in function bodyFlorian Diebold2019-12-201-1/+1
|
* Handle closure return typesFlorian Diebold2019-12-201-3/+14
| | | | Fixes #2547.
* Merge #2592bors[bot]2019-12-201-4/+8
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2592: Add std::ops::Index support for infering r=edwin0cheng a=edwin0cheng see also #2534 Seem like this can't fix #2534 for this case: ```rust fn foo3(bar: [usize; 2]) { let baz = bar[1]; // <--- baz is still unknown ? println!("{}", baz); } ``` Co-authored-by: Edwin Cheng <[email protected]>
| * Add std::ops::Index support for inferingEdwin Cheng2019-12-191-4/+8
| |
* | Introduce `ContainerId`Aleksey Kladov2019-12-201-1/+1
| |
* | Rename ContainerId -> AssocContainerIdAleksey Kladov2019-12-202-6/+6
| |
* | Add body as a possible container for itemsAleksey Kladov2019-12-191-1/+1
| |
* | Forbid <T>::foo syntax in mod pathsAleksey Kladov2019-12-181-2/+2
|/
* Handle impl Trait more correctlyFlorian Diebold2019-12-151-0/+1
| | | | | | | When calling a function, argument-position impl Trait is transparent; same for return-position impl Trait when inside the function. So in these cases, we need to represent that type not by `Ty::Opaque`, but by a type variable that can be unified with whatever flows into there.
* Use different types for path with and without genericsAleksey Kladov2019-12-141-12/+13
|
* Rename N! to name!Florian Diebold2019-12-131-2/+2
|
* Add macros for known names and pathsFlorian Diebold2019-12-131-2/+2
|
* Correctly infer - and ! using std::ops::{Neg,Not}Emil Lauridsen2019-12-131-21/+26
|