aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_ty/src/tests/coercion.rs
Commit message (Collapse)AuthorAgeFilesLines
* Support raw_ref_op's raw reference operatorrobojumper2020-05-281-6/+11
|
* Switch to new magic marksAleksey Kladov2020-05-201-3/+3
|
* Handle coercing function types to function pointers in matchFlorian Diebold2020-05-081-0/+42
| | | | | | | | | | | | 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).
* Implement better handling of divergenceFlorian Diebold2020-05-081-2/+2
| | | | | | | | 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.
* Convert tests to text-sizeAleksey Kladov2020-04-251-291/+291
|
* Hide unit fn return typesLaurențiu Nicola2020-04-051-4/+4
|
* Add inference for literal and range patternsFlorian Diebold2020-04-011-0/+6
|
* Fix a common false-positive type mismatchFlorian Diebold2020-02-291-0/+31
| | | | | | | | | 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.
* Rework find_super_trait_path to protect against cyclesFlorian Diebold2020-02-221-0/+38
|
* Add &dyn Trait -> &dyn SuperTrait coercion, and fix &T -> &dyn TraitFlorian Diebold2020-02-221-14/+26
|
* Implement dyn Trait unsizing as wellFlorian Diebold2020-02-221-1/+7
|
* Implement unsize coercion using proper trait solvingFlorian Diebold2020-02-221-0/+82
|
* Fix coercion of &T to itselfFlorian Diebold2020-02-161-0/+22
| | | | | The autoderef coercion logic did not handle matching placeholders. This led to some type mismatches.
* Fix printing of function typesFlorian Diebold2020-02-071-13/+13
|
* Standard formatting for array typesAleksey Kladov2020-01-281-48/+48
|
* Coerce closures to fn pointersFlorian Diebold2019-12-201-0/+39
| | | | E.g. `let x: fn(A) -> B = |x| { y };`
* Fix coercion of last expression in function bodyFlorian Diebold2019-12-201-0/+16
|
* Handle closure return typesFlorian Diebold2019-12-201-0/+31
| | | | Fixes #2547.
* Fix coercion from &Foo to an inference variable in a referenceFlorian Diebold2019-12-081-0/+37
| | | | We didn't try to unify within the reference, but we should.
* Don't unify within a referenceFlorian Diebold2019-12-061-0/+36
| | | | | | | If we are expecting a `&Foo` and get a `&something`, when checking the `something`, we are *expecting* a `Foo`, but we shouldn't try to unify whatever we get with that expectation, because it could actually be a `&Foo`, and `&&Foo` coerces to `&Foo`. So this fixes quite a few false type mismatches.
* Move TyAleksey Kladov2019-11-271-0/+369