aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_ty/src
Commit message (Collapse)AuthorAgeFilesLines
* Merge #4023bors[bot]2020-04-184-27/+92
|\ | | | | | | | | | | | | | | 4023: Fix another crash from wrong binders r=matklad a=flodiebold Basically, if we had something like `dyn Trait<T>` (where `T` is a type parameter) in an impl we lowered that to `dyn Trait<^0.0>`, when it should be `dyn Trait<^1.0>` because the `dyn` introduces a new binder. With one type parameter, that's just wrong, with two, it'll lead to crashes. Co-authored-by: Florian Diebold <[email protected]>
| * Fix another crash from wrong bindersFlorian Diebold2020-04-174-27/+92
| | | | | | | | | | | | | | Basically, if we had something like `dyn Trait<T>` (where `T` is a type parameter) in an impl we lowered that to `dyn Trait<^0.0>`, when it should be `dyn Trait<^1.0>` because the `dyn` introduces a new binder. With one type parameter, that's just wrong, with two, it'll lead to crashes.
* | Fix type equality for dyn TraitFlorian Diebold2020-04-173-5/+65
| | | | | | | | | | | | | | 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...)
* | Add two more tests for associated typesFlorian Diebold2020-04-171-0/+174
| |
* | Merge #4012bors[bot]2020-04-171-0/+49
|\ \ | | | | | | | | | | | | | | | | | | | | | 4012: fix panic on ellipsis in pattern r=flodiebold a=JoshMcguigan fixes #3999 Co-authored-by: Josh Mcguigan <[email protected]>
| * | fix panic on ellipsis in patternJosh Mcguigan2020-04-171-0/+49
| |/
* | Simplify Diagnostic structureAleksey Kladov2020-04-173-42/+5
| | | | | | | | | | | | It's not entirely clear what subnode ranges should mean in the presence of macros, so let's leave them out for now. We are not using them heavily anyway.
* | Correctly highlight ranges of diagnostics from macrosAleksey Kladov2020-04-171-11/+11
| | | | | | | | closes #2799
* | Don't expose impl details of SyntaxPtrAleksey Kladov2020-04-173-6/+43
|/
* Merge #3979bors[bot]2020-04-163-3/+51
|\ | | | | | | | | | | | | | | 3979: fix missing match arm false positive for enum with no variants r=flodiebold a=JoshMcguigan fixes #3974 Co-authored-by: Josh Mcguigan <[email protected]>
| * fix false positive for enum with no variantsJosh Mcguigan2020-04-163-3/+51
| |
* | Test for non-working proc macro server assoc typesFlorian Diebold2020-04-161-0/+68
| |
* | Switch Chalk to recursive solverFlorian Diebold2020-04-165-40/+53
| | | | | | | | + various fixes related to that.
* | Update ChalkFlorian Diebold2020-04-161-2/+3
| |
| |
| \
*-. \ Merge #3966 #3968bors[bot]2020-04-153-7/+99
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-133-7/+99
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-154-21/+139
|\ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-133-5/+38
| | | |/ / / | | | | | | | | | | | | | | | | | | It was implemented for other generic parameters for the trait, but not for `Self`.
| | * / / / Implement inline associated type boundsFlorian Diebold2020-04-132-6/+69
| | |/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 :)
| * | | | Nicer display of projections in Chalk logsFlorian Diebold2020-04-131-8/+10
| | | | |
| * | | | Nicer display of closures in Chalk logsFlorian Diebold2020-04-131-2/+22
| |/ / /
* | | | Merge #3963bors[bot]2020-04-151-13/+66
|\ \ \ \ | |_|_|/ |/| | | | | | | | | | | | | | | | | | | | | | | 3963: Upgrade Chalk r=matklad a=flodiebold Co-authored-by: Florian Diebold <[email protected]>
| * | | Upgrade ChalkFlorian Diebold2020-04-131-13/+66
| |/ /
* / / handle tuple patterns with ellipsisJosh Mcguigan2020-04-132-50/+116
|/ /
* | Merge #3938bors[bot]2020-04-122-12/+253
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | 3938: fix missing match arm false positive r=flodiebold a=JoshMcguigan This fixes #3932 by skipping the missing match arm diagnostic in the case any of the match arms don't type check properly against the match expression. I think this is the appropriate behavior for this diagnostic, since `is_useful` relies on all match arms being well formed, and the case of a malformed match arm should probably be handled by a different diagnostic. Co-authored-by: Josh Mcguigan <[email protected]>
| * | missing match arm add test cases to demonstrate enum tuple struct with ↵Josh Mcguigan2020-04-121-0/+64
| | | | | | | | | | | | ellipsis behavior
| * | missing match arms add test cases to demonstrate behavior of tuple with patternJosh Mcguigan2020-04-121-0/+75
| | |
| * | missing match arm add test for partially diverging typeJosh Mcguigan2020-04-111-0/+21
| | |
| * | missing match arms add tests for match expression divergingJosh Mcguigan2020-04-111-0/+77
| | |
| * | fix match arm false positiveJosh Mcguigan2020-04-112-12/+16
| |/
* | Align grammar for record patterns and literalsAleksey Kladov2020-04-111-1/+2
| | | | | | | | | | | | The grammar now looks like this [name_ref :] pat
* | Merge #3951bors[bot]2020-04-112-33/+26
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | 3951: Simplify records grammar r=matklad a=matklad bors r+ 🤖 Co-authored-by: Aleksey Kladov <[email protected]>
| * | Remove dead codeAleksey Kladov2020-04-112-33/+26
| |/
* / Look up impls by self typeFlorian Diebold2020-04-114-14/+65
|/ | | | | This speeds up inference in analysis-stats by ~30% (even more with the recursive solver).
* Forward compatAleksey Kladov2020-04-103-9/+9
|
* Add failing testAleksey Kladov2020-04-101-2/+29
|
* Merge #3905bors[bot]2020-04-104-28/+149
|\ | | | | | | | | | | | | | | | | | | | | | | 3905: add ellipsis field to hir pat record r=matklad a=JoshMcguigan This PR corrects a `fixme`, adding an `ellipsis` field to the hir `Pat::Record` type. It will also be unlock some useful follow on work for #3894. Additionally it adds a diagnostic for missing fields in record patterns. ~~Marking as a draft because I don't have any tests, and a small amount of manual testing on my branch from #3894 suggests it might *not* be working. Any thoughts on how I can best test this, or else pointers on where I might be going wrong?~~ Co-authored-by: Josh Mcguigan <[email protected]>
| * add record pat missing field diagnosticJosh Mcguigan2020-04-104-28/+149
| |
* | Implement Chalk's debug methods using TLSFlorian Diebold2020-04-104-56/+295
|/ | | | | | | | | | Chalk now panics if we don't implement these methods and run with CHALK_DEBUG, so I thought I'd try to implement them 'properly'. Sadly, it seems impossible to do without transmuting lifetimes somewhere. The problem is that we need a `&dyn HirDatabase` to get names etc., which we can't just put into TLS. I thought I could just use `scoped-tls`, but that doesn't support references to unsized types. So I put the `&dyn` into another struct and put the reference to *that* into the TLS, but I have to transmute the lifetime to 'static for that to work.
* Simpler acessors for keywordsAleksey Kladov2020-04-091-2/+2
|
* Merge #3918bors[bot]2020-04-091-0/+60
|\ | | | | | | | | | | | | | | | | 3918: Add support for feature attributes in struct literal r=matklad a=bnjjj As promised here is the next PR to solve 2 different scenarios with feature flag on struct literal. close #3870 Co-authored-by: Benjamin Coenen <[email protected]>
| * feat: add support for feature attributes in struct literalBenjamin Coenen2020-04-091-3/+3
| |\ | | | | | | | | | Signed-off-by: Benjamin Coenen <[email protected]>
| * | feat: add support for feature attributes in struct literalBenjamin Coenen2020-04-091-0/+60
| | | | | | | | | | | | Signed-off-by: Benjamin Coenen <[email protected]>
* | | Add _token suffix to token accessorsAleksey Kladov2020-04-091-1/+1
| |/ |/| | | | | | | I think this makes is more clear which things are : AstNode and which are : AstToken
* | Provide more complete AST accessors to support usage in rustcLuca Barbieri2020-04-091-2/+2
|/
* feat: add attributes support on struct fields and method #3870Benjamin Coenen2020-04-093-83/+151
|\ | | | | | | Signed-off-by: Benjamin Coenen <[email protected]>
| * match checking add additional test for match checking tuple with missing patternJosh Mcguigan2020-04-081-0/+14
| |
| * fix panic in match checking when tuple enum missing patternJosh Mcguigan2020-04-081-15/+45
| |
| * Move computation of missing fields into hirAleksey Kladov2020-04-071-67/+91
| |
* | feat: add attributes support on struct fields and method #3870Benjamin Coenen2020-04-082-12/+6
| | | | | | | | Signed-off-by: Benjamin Coenen <[email protected]>