aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_ty/src/tests
Commit message (Collapse)AuthorAgeFilesLines
*-. Merge #3966 #3968bors[bot]2020-04-151-0/+27
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 3966: Add support for bounds on associated types in trait definitions r=matklad a=flodiebold E.g. ```rust trait Trait { type Item: SomeOtherTrait; } ``` Note that these don't simply desugar to where clauses; as I understand it, where clauses have to be proved by the *user* of the trait, but these bounds are proved by the *implementor*. (Also, where clauses on associated types are unstable.) (Another one from my recursive solver branch...) 3968: Remove format from syntax_bridge hot path r=matklad a=edwin0cheng Although only around 1% speed up by running: ``` Measure-Command {start-process .\target\release\rust-analyzer "analysis-stats -q ." -NoNewWindow -wait} ``` Co-authored-by: Florian Diebold <[email protected]> Co-authored-by: Edwin Cheng <[email protected]>
| * | Add support for bounds on associated types in trait definitionsFlorian Diebold2020-04-131-0/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | E.g. ``` trait Trait { type Item: SomeOtherTrait; } ``` Note that these don't simply desugar to where clauses; as I understand it, where clauses have to be proved by the *user* of the trait, but these bounds are proved by the *implementor*. (Also, where clauses on associated types are unstable.)
| | |
| \ \
*-. \ \ Merge #3964 #3965 #3967bors[bot]2020-04-152-3/+73
|\ \ \ \ | |_|/ / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 3964: Nicer Chalk debug logs r=matklad a=flodiebold I'm looking at a lot of Chalk debug logs at the moment, so here's a few changes to make them slightly nicer... 3965: Implement inline associated type bounds r=matklad a=flodiebold Like `Iterator<Item: SomeTrait>`. This is an unstable feature, but it's used in the standard library e.g. in the definition of Flatten, so we can't get away with not implementing it :) (This is cherry-picked from my recursive solver branch, where it works better, but I did manage to write a test that works with the current Chalk solver as well...) 3967: Handle `Self::Type` in trait definitions when referring to own associated type r=matklad a=flodiebold It was implemented for other generic parameters for the trait, but not for `Self`. (Last one off my recursive solver branch :smile: ) Co-authored-by: Florian Diebold <[email protected]>
| | * | Handle `Self::Type` in trait definitions when referring to own associated typeFlorian Diebold2020-04-132-3/+26
| |/ / |/| | | | | | | | It was implemented for other generic parameters for the trait, but not for `Self`.
| * | Implement inline associated type boundsFlorian Diebold2020-04-131-0/+47
|/ / | | | | | | | | | | | | Like `Iterator<Item: SomeTrait>`. This is an unstable feature, but it's used in the standard library e.g. in the definition of Flatten, so we can't get away with not implementing it :)
* / Align grammar for record patterns and literalsAleksey Kladov2020-04-111-1/+2
|/ | | | | | The grammar now looks like this [name_ref :] pat
* Add failing testAleksey Kladov2020-04-101-2/+29
|
* Fix Chalk panicFlorian Diebold2020-04-061-0/+25
| | | | | Fixes #3865. Basically I forgot to shift 'back' when we got `dyn Trait`s back from Chalk, so after going through Chalk a few times, the panic happened.
* Hide unit fn return typesLaurențiu Nicola2020-04-054-14/+14
|
* Fix inference of function pointer return typesLaurențiu Nicola2020-04-051-0/+26
|
* Macro patterns are not confused with expressions.Aleksey Kladov2020-04-031-2/+29
| | | | | | | | | | | We treat macro calls as expressions (there's appropriate Into impl), which causes problem if there's expresison and non-expression macro in the same node (like in the match arm). We fix this problem by nesting macor patterns into another node (the same way we nest path into PathExpr or PathPat). Ideally, we probably should add a similar nesting for macro expressions, but that needs some careful thinking about macros in blocks: `{ am_i_expression!() }`.
* Add inference for literal and range patternsFlorian Diebold2020-04-014-1/+95
|
* Remove collect proc_macro definitionsEdwin Cheng2020-03-251-6/+2
|
* Fix trailling whitespaceEdwin Cheng2020-03-251-1/+1
|
* Add basic custom derive loweringEdwin Cheng2020-03-251-0/+23
|
* Move test to hir_tyEdwin Cheng2020-03-211-0/+31
|
* Make MBE expansion more resilient (WIP)Florian Diebold2020-03-161-4/+4
|
* Support local macro_rulesEdwin Cheng2020-03-141-0/+20
|
* Add and fix testsEdwin Cheng2020-03-101-0/+20
|
* Prevent include! macro include itselfEdwin Cheng2020-03-071-0/+18
|
* Use a not so dummy implementation of env macroEdwin Cheng2020-03-071-0/+27
|
* Resolve `Self::AssocTy` in implsFlorian Diebold2020-03-061-0/+41
| | | | | | | | | | 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 #3494bors[bot]2020-03-061-0/+45
|\ | | | | | | | | | | | | | | | | | | | | | | 3494: Implement include macro r=matklad a=edwin0cheng This PR implement builtin `include` macro. * It does not support include as expression yet. * It doesn't consider `env!("OUT_DIR")` yet. Co-authored-by: Edwin Cheng <[email protected]>
| * Implment include macroEdwin Cheng2020-03-061-0/+45
| |
* | Support aliases and Self in struct literalsFlorian Diebold2020-03-061-0/+41
|/ | | | Fixes #3306.
* Fix panic on eager expansionEdwin Cheng2020-03-031-0/+21
|
* Add testEdwin Cheng2020-03-031-0/+19
|
* Merge #3385bors[bot]2020-03-021-0/+19
|\ | | | | | | | | | | | | | | | | | | | | 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-0/+19
| | | | | | | | | | | | | | 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-0/+41
| |
* | remove match statement, handle suffixJosh Mcguigan2020-03-011-2/+2
| |
* | handle arbitrary length slicesJosh Mcguigan2020-03-011-9/+24
| |
* | match single prefix sliceJosh Mcguigan2020-03-011-0/+33
|/
* Do autoderef for indexingFlorian Diebold2020-02-291-0/+28
|
* Do array unsizing for method receiversFlorian Diebold2020-02-291-0/+18
| | | | | | | It turns out rustc actually only unsizes array method receivers, so we don't need to do any trait solving for this (at least for now). Fixes #2670.
* Rename ast::ImplBlock -> ast::ImplDefAleksey Kladov2020-02-291-6/+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 handling of const patternsFlorian Diebold2020-02-211-1/+45
| | | | | | | | | 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-0/+42
| | | | Fixes #3232.
* Exclude methods from non-parameter types introduced by generic constraintsLaurențiu Nicola2020-02-191-0/+23
|
* 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.
* Merge #3147bors[bot]2020-02-141-0/+32
|\ | | | | | | | | | | | | | | 3147: Check that impl self type matches up with expected self type in path mode r=matklad a=flodiebold Fixes #3144. Co-authored-by: Florian Diebold <[email protected]>
| * Check that impl self type matches up with expected self type in path modeFlorian Diebold2020-02-141-0/+32
| | | | | | | | Fixes #3144.
* | Make Self implement the trait inside trait default methodsFlorian Diebold2020-02-141-0/+48
|/
* Don't let unknown match arms fall back to !Florian Diebold2020-02-111-0/+17
|
* Add two more testsFlorian Diebold2020-02-071-0/+51
|