aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_ty/src/traits
Commit message (Collapse)AuthorAgeFilesLines
* Specify default adt representation for chalk integrationWilco Kusee2020-07-191-1/+1
|
* Align CallableDefId naming with other idsAleksey Kladov2020-07-163-17/+17
|
* Rename CallableDefId -> InternedCallabelDefidAleksey Kladov2020-07-161-3/+3
|
* Remove TypeCtor interningFlorian Diebold2020-07-153-20/+19
| | | | Our TypeCtor and Chalk's TypeName match now!
* Use Chalk closure supportFlorian Diebold2020-07-153-294/+68
|
* Add FIXMEJonas Schievink2020-07-141-0/+1
|
* Thread varargs through r-aJonas Schievink2020-07-142-3/+6
|
* Merge #5331bors[bot]2020-07-121-2/+6
|\ | | | | | | | | | | | | | | | | | | 5331: Fix #4966 r=flodiebold a=flodiebold We add a level of binders when converting our function pointer to Chalk's; we need to remove it again on the way back. Fixes #4966. Co-authored-by: Florian Diebold <[email protected]>
| * Fix #4966Florian Diebold2020-07-121-2/+6
| | | | | | | | | | We add a level of binders when converting our function pointer to Chalk's; we need to remove it again on the way back.
* | Search more efficiently for int/float implsFlorian Diebold2020-07-121-12/+34
| |
* | Use Chalk built-in representation for array typesFlorian Diebold2020-07-121-7/+36
| |
* | Remove built-in Unsize implsFlorian Diebold2020-07-122-197/+5
| | | | | | | | They exist in Chalk now.
* | Enable Chalk tracing in hir_ty testsFlorian Diebold2020-07-122-7/+7
| |
* | Upgrade ChalkFlorian Diebold2020-07-124-10/+58
|/
* Switch to fully dynamically dispatched salsaAleksey Kladov2020-07-071-1/+1
| | | | This improves compile times quite a bit
* Merge #5149bors[bot]2020-07-011-13/+30
|\ | | | | | | | | | | | | | | | | | | 5149: Implement Chalk variable kinds r=flodiebold a=flodiebold 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. Co-authored-by: Florian Diebold <[email protected]>
| * Implement Chalk variable kindsFlorian Diebold2020-07-011-13/+30
| | | | | | | | | | | | | | | | | | 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.
* | Split `CrateImplDefs` in inherent and trait implsJonas Schievink2020-07-011-6/+4
|/ | | | | | This makes the intention of inherent vs. trait impls somewhat more clear and also fixes (?) an issue where trait impls with an unresolved trait were added as inherent impls instead (hence the test changes).
* Bump chalkLaurențiu Nicola2020-06-263-16/+80
|
* Merge #4947bors[bot]2020-06-201-8/+20
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 4947: Replace `impls_in_trait` query with smarter use of `CrateImplDefs` r=matklad a=jonas-schievink `impls_in_trait` was allocating a whopping ~400 MB of RAM when running analysis-stats on r-a itself. Remove it, instead adding a query that computes a summary `CrateImplDefs` map for all transitive dependencies. This can probably still be made more efficient, but this already reduces the peak memory usage by 25% without much performance impact on analysis-stats. **Before**: ``` Total: 34.962107188s, 2083mb allocated 2141mb resident 422mb ImplsForTraitQuery (deps) 250mb CrateDefMapQueryQuery 147mb MacroArgQuery 140mb TraitSolveQuery (deps) 68mb InferQueryQuery (deps) 62mb ImplDatumQuery (deps) ``` **After**: ``` Total: 35.261100358s, 1520mb allocated 1569mb resident 250mb CrateDefMapQueryQuery 147mb MacroArgQuery 144mb TraitSolveQuery (deps) 68mb InferQueryQuery (deps) 61mb ImplDatumQuery (deps) 45mb BodyQuery 45mb ImplDatumQuery ``` Co-authored-by: Jonas Schievink <[email protected]>
| * Replace `impls_in_trait` with `CrateImplDefs`Jonas Schievink2020-06-191-8/+20
| |
* | Make get_fn_trait a method of FnTraitadamrk2020-06-201-17/+7
| |
* | Infer FnSig from Fn traitsadamrk2020-06-191-1/+5
|/
* Clean up handling of int/float literal typesFlorian Diebold2020-06-061-13/+11
| | | | | | '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.
* Merge #4761bors[bot]2020-06-051-0/+5
|\ | | | | | | | | | | | | | | 4761: Upgrade Chalk to published version r=matklad a=flodiebold CC @pksunkara Co-authored-by: Florian Diebold <[email protected]>
| * Upgrade Chalk to published versionFlorian Diebold2020-06-051-0/+5
| |
* | Implement return position impl trait / opaque type supportFlorian Diebold2020-06-054-15/+89
|/ | | | | | | | | | | | | This is working, but I'm not that happy with how the lowering works. We might need an additional representation between `TypeRef` and `Ty` where names are resolved and `impl Trait` bounds are separated out, but things like inference variables don't exist and `impl Trait` is always represented the same way. Also note that this doesn't implement correct handling of RPIT *inside* the function (which involves turning the `impl Trait`s into variables and creating obligations for them). That intermediate representation might help there as well.
* Upgrade ChalkFlorian Diebold2020-05-273-52/+52
| | | | | Chalk newly added TypeName::Never and Array; I implemented the conversion for Never, but not Array since that expects a const argument.
* Fix some clippy perf warningsJeremy Kolb2020-05-251-2/+1
|
* Use Chalk's Ty::Function for function pointer typesFlorian Diebold2020-05-221-8/+19
| | | | | | Function pointers can be 'higher-ranked' over lifetimes, which is why they're not an application type in Chalk, but since we don't model lifetimes it doesn't matter for us yet.
* Use Chalk's built-in representation of function item typesFlorian Diebold2020-05-224-10/+75
|
* Provide missing Chalk debug methodsFlorian Diebold2020-05-222-0/+112
|
* Use TypeCtorId as AdtId directly, and rename the type alias StructId -> AdtIdFlorian Diebold2020-05-223-12/+12
|
* Split up chalk module a bitFlorian Diebold2020-05-223-958/+982
|
* Provide Chalk well-known traitsFlorian Diebold2020-05-221-6/+33
|
* Use Chalk's built-in representations of primitive typesFlorian Diebold2020-05-221-10/+160
| | | | For references, we make sure Chalk actually gets a lifetime here.
* Update ChalkFlorian Diebold2020-05-222-49/+78
| | | | | As always, this just makes compilation work, we don't use the newly available functionality yet.
* Chalk upgradeFlorian Diebold2020-05-161-19/+38
|
* Update Chalk, and cache Chalk env elaboration through a queryFlorian Diebold2020-04-202-25/+153
| | | | This should fix some of the worst performance problems.
* Fix another crash from wrong bindersFlorian Diebold2020-04-171-5/+5
| | | | | | | 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.
* Switch Chalk to recursive solverFlorian Diebold2020-04-161-4/+4
| | | | + various fixes related to that.
* Update ChalkFlorian Diebold2020-04-161-2/+3
|
*-. Merge #3966 #3968bors[bot]2020-04-151-5/+67
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-5/+67
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-151-10/+32
|\ \| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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]>
| * | | Nicer display of projections in Chalk logsFlorian Diebold2020-04-131-8/+10
| | | |
| * | | Nicer display of closures in Chalk logsFlorian Diebold2020-04-131-2/+22
| |/ /
* / / Upgrade ChalkFlorian Diebold2020-04-131-13/+66
|/ /
* / Look up impls by self typeFlorian Diebold2020-04-111-4/+7
|/ | | | | This speeds up inference in analysis-stats by ~30% (even more with the recursive solver).
* Implement Chalk's debug methods using TLSFlorian Diebold2020-04-102-42/+270
| | | | | | | | | | 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.