aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/ty/traits/chalk.rs
Commit message (Collapse)AuthorAgeFilesLines
* Fix Chalk environmentsFlorian Diebold2019-09-071-1/+2
| | | | | The clauses need to be wrapped in `FromEnv` clauses for elaboration (i.e. things like inferring `T: Clone` from `T: Copy`) to work correctly.
* Lower bounds on trait definition, and resolve assoc types from super traitsFlorian Diebold2019-09-071-1/+1
|
* Make type walking infrastructure a bit nicerFlorian Diebold2019-09-031-0/+1
| | | | | If/when we switch to using Chalk's Ty, we'll need to replace this by its `Fold` trait, but I didn't want to import the whole thing just yet.
* Add support for associated type bindings (`where Trait<Type = X>`)Florian Diebold2019-09-031-0/+7
|
* Add `impl Trait` and `dyn Trait` typesFlorian Diebold2019-08-221-1/+3
| | | | | | | - refactor bounds handling in the AST a bit - add HIR for bounds - add `Ty::Dyn` and `Ty::Opaque` variants and lower `dyn Trait` / `impl Trait` syntax to them
* Handle placeholder assoc types when Chalk produces themFlorian Diebold2019-08-121-3/+18
|
* Normalize associated types during inferenceFlorian Diebold2019-08-121-3/+4
|
* Add representations of associated typesFlorian Diebold2019-08-121-0/+23
| | | | | | | | | | | | This adds three different representations, copied from the Chalk model: - `Ty::Projection` is an associated type projection written somewhere in the code, like `<Foo as Trait>::Bar`. - `Ty::UnselectedProjection` is similar, but we don't know the trait yet (`Foo::Bar`). - The above representations are normalized to their actual types during type inference. When that isn't possible, for example for `T::Item` inside an `fn foo<T: Iterator>`, the type is normalized to an application type with `TypeCtor::AssociatedType`.
* Remove blacklist, instead mark `Sized` as non-enumerableFlorian Diebold2019-07-151-17/+3
| | | | | This seems to be enough to prevent hanging in rust-analyzer, Chalk and the rustc repo.
* Cargo update, including updating ChalkFlorian Diebold2019-07-141-0/+2
|
* Some renamings for clarityFlorian Diebold2019-07-141-2/+2
|
* Unify `normalize` and `implements` to simplify codeFlorian Diebold2019-07-081-1/+16
|
* Use environment for associated type normalization as wellFlorian Diebold2019-07-081-0/+15
|
* Start handling environment in trait resolutionFlorian Diebold2019-07-081-3/+16
| | | | | I.e. if we are inside a function with some where clauses, we assume these where clauses hold.
* Refactor a bit & introduce Environment structFlorian Diebold2019-07-081-1/+55
|
* Make EnumVariant a GenericDef and simplify some codeFlorian Diebold2019-07-061-5/+1
|
* allow rustfmt to reorder importsAleksey Kladov2019-07-041-7/+12
| | | | | | This wasn't a right decision in the first place, the feature flag was broken in the last rustfmt release, and syntax highlighting of imports is more important anyway
* cache chalk queriesAleksey Kladov2019-06-261-193/+219
| | | | | | | | | | | | | | | | | | | | | | | | | | | This gives a significant speedup, because chalk will call these functions several times even withing a single revision. The only significant one here is `impl_data`, but I figured it might be good to cache others just for consistency. The results I get are: Before: from scratch: 16.081457952s no change: 15.846493ms trivial change: 352.95592ms comment change: 361.998408ms const change: 457.629212ms After: from scratch: 14.910610278s no change: 14.934647ms trivial change: 85.633023ms comment change: 96.433023ms const change: 171.543296ms Seems like a nice win!
* Some more cleanupFlorian Diebold2019-06-151-4/+4
|
* Add basic infrastructure for assoc type projectionFlorian Diebold2019-06-151-8/+102
|
* Fix clippy::single_matchAlan Du2019-06-041-6/+3
|
* Blacklist some traits from being considered in where clausesFlorian Diebold2019-05-121-1/+28
| | | | | | | For Send/Sync/Sized, we don't handle auto traits correctly yet and because they have a lot of impls, they can easily lead to slowdowns. In the case of Fn/FnMut/FnOnce, we don't parse the special Fn notation correctly yet and don't handle closures yet, so we are very unlikely to find an impl.
* Handle auto traits & negative implsFlorian Diebold2019-05-111-5/+19
| | | | | We don't pass field types to Chalk yet though, so the auto trait inference won't be correct.
* Reduce Chalk max_size parameter, add test for slow caseFlorian Diebold2019-05-111-2/+5
|
* Handle Chalk conversion for FnDefFlorian Diebold2019-05-111-2/+25
|
* Handle resolution errors in where clausesFlorian Diebold2019-05-111-15/+41
| | | | | This is slightly hacky, but maybe more elegant than alternative solutions: We just use a hardcoded Chalk trait ID which we special-case to have no impls.
* Handle where clauses in trait solvingFlorian Diebold2019-05-111-13/+55
|
* Differentiate Tuple / FnPtr type constructors by cardinalityFlorian Diebold2019-05-041-1/+3
| | | | | This is necessary because Chalk (reasonably) expects each 'struct' to know how many type parameters it takes.
* Handle recursive types in canonicalizationFlorian Diebold2019-05-041-1/+1
|
* Remove ToChalk implementation for ApplicationTyFlorian Diebold2019-05-041-29/+16
|
* Update ChalkFlorian Diebold2019-05-041-4/+13
|
* Turn eprintln!s into debug!sFlorian Diebold2019-05-041-6/+9
|
* Handle Ty::Unknown in Chalk conversionFlorian Diebold2019-05-041-1/+5
| | | | Badly, but at least it doesn't crash.
* Canonicalize before doing method resolutionFlorian Diebold2019-05-041-6/+7
|
* Move Chalk conversion code to its own moduleFlorian Diebold2019-05-041-0/+327