aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_ty/src/traits
Commit message (Collapse)AuthorAgeFilesLines
* 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.
* Fix Chalk panicFlorian Diebold2020-04-061-1/+6
| | | | | 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.
* Upgrade Chalk againFlorian Diebold2020-04-052-30/+53
| | | | | | | 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.
* Upgrade ChalkFlorian Diebold2020-04-051-24/+99
|
* Use `dyn Trait` for working with databseAleksey Kladov2020-03-162-77/+70
| | | | | | | 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).
* Drop larlpop-intern depLaurențiu Nicola2020-03-031-2/+2
|
* Update chalk for Ty internersLaurențiu Nicola2020-03-021-8/+11
|
* Update chalk for RawId removalLaurențiu Nicola2020-03-021-13/+7
|
* Rename ast::ImplBlock -> ast::ImplDefAleksey Kladov2020-02-292-5/+5
|
* Bump chalk and replace TypeFamily with InternerLaurențiu Nicola2020-02-241-49/+58
|
* Shorten some codeFlorian Diebold2020-02-221-4/+1
|
* Rework find_super_trait_path to protect against cyclesFlorian Diebold2020-02-221-4/+2
|
* Add &dyn Trait -> &dyn SuperTrait coercion, and fix &T -> &dyn TraitFlorian Diebold2020-02-221-30/+65
|
* Implement dyn Trait unsizing as wellFlorian Diebold2020-02-222-8/+108
|
* Implement unsize coercion using proper trait solvingFlorian Diebold2020-02-221-1/+60
|
* More manual clippy fixesKirill Bulatov2020-02-182-4/+3
|
* Run cargo +nightly fix --clippy -Z unstable-optionsKirill Bulatov2020-02-182-8/+8
|
* Rename Ty::Param => Ty::PlaceholderFlorian Diebold2020-02-141-2/+2
| | | | This aligns more with Chalk.
* FormattingFlorian Diebold2020-02-071-3/+8
|
* Use variables in predicates as wellFlorian Diebold2020-02-071-3/+3
|
* Change Ty::Param to contain param IDFlorian Diebold2020-02-071-12/+12
|
* Upgrade ChalkFlorian Diebold2020-01-271-55/+53
|
* Filter out error predicates in type bounds as wellFlorian Diebold2019-12-221-2/+12
|
* Introduce our own Chalk TypeFamily, instead of using ChalkIrFlorian Diebold2019-12-222-83/+122
| | | | | | It's not very different, except we can directly use Salsa IDs instead of casting them. This means we need to refactor the handling of errors to get rid of UNKNOWN_TRAIT though.
* Refactor Chalk integration some moreFlorian Diebold2019-12-221-72/+76
|
* Update Chalk, clean up Chalk integration a bitFlorian Diebold2019-12-221-93/+87
|
* Use generic ItemLoc for implsAleksey Kladov2019-12-201-1/+1
|