aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_ty/src/infer
Commit message (Collapse)AuthorAgeFilesLines
* Rename ra_syntax -> syntaxAleksey Kladov2020-08-121-1/+1
|
* Align CallableDefId naming with other idsAleksey Kladov2020-07-161-3/+3
|
* Thread varargs through r-aJonas Schievink2020-07-141-1/+1
|
* infer: Add type inference support for Union typesOtavio Salvador2020-07-111-2/+9
| | | | | | | | This adds the type inference to Union types and add a small test case for it, ensuring it keeps working in future. Fixes: #5277 Signed-off-by: Otavio Salvador <[email protected]>
* Clippy perf warningskjeremy2020-07-061-4/+2
| | | | Removes redundant clones
* Implement Chalk variable kindsFlorian Diebold2020-07-011-15/+40
| | | | | | | | | This means we need to keep track of the kinds (general/int/float) of variables in `Canonical`, which requires some more ceremony. (It also exposes some places where we're not really dealing with canonicalization correctly -- another thing to be cleaned up when we switch to using Chalk's types directly.) Should fix the last remaining issue of #2534.
* Simlify with matches!()Veetaha2020-06-281-5/+1
|
* Rename Expr::UnsafeBlock to Expr::UnsafePaul Daniel Faria2020-06-271-1/+1
|
* Track unsafe blocks, don't trigger missing unsafe diagnostic when unsafe ↵Paul Daniel Faria2020-06-271-0/+1
| | | | exprs within unsafe block
* Infer type for slice wildcard patternsadamrk2020-06-251-2/+7
|
* Fix string literal inference in matchLaurențiu Nicola2020-06-241-13/+20
|
* Push obligation instead of matching on solutionadamrk2020-06-201-41/+36
|
* Get Output assoc type by nameadamrk2020-06-201-13/+3
|
* Fixes to callable_sig_from_fn_traitadamrk2020-06-201-65/+65
|
* Make get_fn_trait a method of FnTraitadamrk2020-06-201-2/+2
|
* Switch back callable_sig for known fn typesadamrk2020-06-202-4/+4
|
* Infer FnSig from Fn traitsadamrk2020-06-192-16/+92
|
* Fix substs in resolve_value_path for ImplSelfVincent Rouillé2020-06-191-1/+1
| | | | Fixes #4953.
* Clean up handling of int/float literal typesFlorian Diebold2020-06-061-16/+12
| | | | | | 'Unknown' int/float types actually never exist as such, they get replaced by type variables immediately. So the whole `Uncertain<IntTy>` thing was unnecessary and just led to a bunch of match branches that were never hit.
* Fix type parameter defaultsFlorian Diebold2020-06-051-1/+2
| | | | | They should not be applied in expression or pattern contexts, unless there are other explicitly given type args.
* correctly infer labelled breaksrobojumper2020-05-311-16/+29
|
* Merge #4653bors[bot]2020-05-301-5/+11
|\ | | | | | | | | | | | | | | 4653: Fix match ergonomics in closure parameters r=matklad a=flodiebold Fixes #4476. Co-authored-by: Florian Diebold <[email protected]>
| * Fix match ergonomics in closure parametersFlorian Diebold2020-05-291-5/+11
| | | | | | | | Fixes #4476.
* | Merge #4651bors[bot]2020-05-291-3/+1
|\ \ | |/ |/| | | | | | | | | | | | | | | | | 4651: Use first match branch in case of type mismatch, not last r=kjeremy a=flodiebold The comment says this was intentional, but I do agree with #4304 that it makes more sense the other way around (for if/else as well). Fixes #4304. Co-authored-by: Florian Diebold <[email protected]>
| * Use first match branch in case of type mismatch, not lastFlorian Diebold2020-05-291-3/+1
| | | | | | | | | | | | | | The comment says this was intentional, but I do agree with #4304 that it makes more sense the other way around (for if/else as well). Fixes #4304.
* | Support raw_ref_op's raw reference operatorrobojumper2020-05-281-14/+23
|/
* Switch to new magic marksAleksey Kladov2020-05-203-9/+9
|
* Apply suggestion of @flodiebold: Get rid of multiple unwrapsRoland Ruckerbauer2020-05-191-12/+10
|
* loop return value inference: coerce_merge branchesRoland Ruckerbauer2020-05-191-15/+23
|
* Infer return type of loops with value breaks.Roland Ruckerbauer2020-05-181-6/+15
|
* Handle `Self` in values and patternsFlorian Diebold2020-05-151-1/+34
| | | | | | | | | I.e. - `Self(x)` or `Self` in tuple/unit struct impls - `Self::Variant(x)` or `Self::Variant` in enum impls - the same in patterns Fixes #4454.
* Handle coercing function types to function pointers in matchFlorian Diebold2020-05-081-11/+23
| | | | | | | | | | | | E.g. in ```rust match x { 1 => function1, 2 => function2, } ``` we need to try coercing both to pointers. Turns out this is a special case in rustc as well (see the link in the comment).
* Add diagnostic for break outside of loopFlorian Diebold2020-05-081-0/+4
|
* Handle break somewhat betterFlorian Diebold2020-05-081-2/+27
| | | | | Still no break-with-value or labels, but at least we know that `loop { break; }` doesn't diverge.
* Implement better handling of divergenceFlorian Diebold2020-05-081-14/+39
| | | | | | | | Divergence here means that for some reason, the end of a block will not be reached. We tried to model this just using the never type, but that doesn't work fully (e.g. in `let x = { loop {}; "foo" };` x should still have type `&str`); so this introduces a `diverges` flag that the type checker keeps track of, like rustc does.
* Fix type of byte literalsFlorian Diebold2020-05-081-2/+2
| | | | They're `&[u8; N]`, not `&[u8]` (see #4374).
* Revert "Merge #4233"Aleksey Kladov2020-05-021-0/+5
| | | | | This reverts commit a5f2b16366f027ad60c58266a66eb7fbdcbda9f9, reversing changes made to c96b2180c1c4206a0a98c280b4d30897eb116336.
* Kill more zombiesAleksey Kladov2020-04-301-5/+0
|
* Rename StructField -> FieldAleksey Kladov2020-04-252-7/+5
|
* Fix goto definition for record patternsAleksey Kladov2020-04-181-0/+6
|
* Fix type equality for dyn TraitFlorian Diebold2020-04-172-5/+41
| | | | | | | Fixes a lot of false type mismatches. (And as always when touching the unification code, I have to say I'm looking forward to replacing it by Chalk's...)
* Switch Chalk to recursive solverFlorian Diebold2020-04-161-0/+1
| | | | + various fixes related to that.
* handle tuple patterns with ellipsisJosh Mcguigan2020-04-131-3/+3
|
* add record pat missing field diagnosticJosh Mcguigan2020-04-101-1/+1
|
* missing match arms diagnosticJosh Mcguigan2020-04-072-3/+15
|
* Upgrade Chalk againFlorian Diebold2020-04-051-11/+17
| | | | | | | The big change here is counting binders, not variables (https://github.com/rust-lang/chalk/pull/360). We have to adapt to the same scheme for our `Ty::Bound`. It's mostly fine though, even makes some things more clear.
* 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]>