aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/ty/lower.rs
Commit message (Collapse)AuthorAgeFilesLines
* Add SubstsBuilderFlorian Diebold2019-09-261-7/+13
| | | | + further refactoring.
* Resolve trait associated itemsFlorian Diebold2019-09-251-1/+1
| | | | E.g. `Default::default` or `<Foo as Default>::default`.
* Handle associated type shorthand (`T::Item`)Florian Diebold2019-09-221-9/+88
| | | | | | | | | | | | This is only allowed for generic parameters (including `Self` in traits), and special care needs to be taken to not run into cycles while resolving it, because we use the where clauses of the generic parameter to find candidates for the trait containing the associated type, but the where clauses may themselves contain instances of short-hand associated types. In some cases this is even fine, e.g. we might have `T: Trait<U::Item>, U: Iterator`. If there is a cycle, we'll currently panic, which isn't great, but better than overflowing the stack...
* Remove assoc type selection code for now to fix crashesFlorian Diebold2019-09-171-19/+4
|
* Small review improvementsFlorian Diebold2019-09-171-5/+3
|
* Refactor some moreFlorian Diebold2019-09-171-10/+24
| | | | | | Type-relative paths (`<T>::foo`) also need to work in type context, for example `<T>::Item` is legal. So rather than returning the type ref from the resolver function, just check it before.
* Refactor associated item resolution moreFlorian Diebold2019-09-171-53/+66
| | | | | When resolving an associated item in value namespace, use the `Ty` lowering code for the segments before the last instead of replicating it.
* Resolve assoc types on type parametersFlorian Diebold2019-09-171-21/+58
| | | | | | E.g. `fn foo<T: Iterator>() -> T::Item`. It seems that rustc does this only for type parameters and only based on their bounds, so we also only consider traits from bounds.
* Support bare `Trait` without dynFlorian Diebold2019-09-141-2/+1
|
* Specify desirable namespace when calling resolveAleksey Kladov2019-09-131-55/+53
| | | | That way, we are able to get rid of a number of unreachable statements
* rename AdtDef -> AdtAleksey Kladov2019-09-121-13/+11
|
* generalize impl_froms to nested enumsAleksey Kladov2019-09-121-19/+9
|
* make various enums "inherit" from AdtDefAleksey Kladov2019-09-121-29/+29
|
* start cleaning up the resolutionAleksey Kladov2019-09-121-1/+1
| | | | | | | Nameres related types, like `PerNs<Resolution>`, can represent unreasonable situations, like a local in a type namespace. We should clean this up, by requiring that call-site specifies the kind of resolution it expects.
* cleanup hir db importsAleksey Kladov2019-09-081-2/+3
|
* Lower bounds on trait definition, and resolve assoc types from super traitsFlorian Diebold2019-09-071-12/+15
|
* 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-28/+57
|
* Add `impl Trait` and `dyn Trait` typesFlorian Diebold2019-08-221-11/+54
| | | | | | | - 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
* Normalize associated types during inferenceFlorian Diebold2019-08-121-5/+0
|
* Lower fully qualified associated type pathsFlorian Diebold2019-08-121-15/+73
| | | | I.e. `<T as Trait>::Foo`.
* Some renamings for clarityFlorian Diebold2019-07-141-2/+5
|
* Start handling environment in trait resolutionFlorian Diebold2019-07-081-0/+12
| | | | | I.e. if we are inside a function with some where clauses, we assume these where clauses hold.
* Make EnumVariant a GenericDef and simplify some codeFlorian Diebold2019-07-061-0/+10
|
* Add trait obligations for where clauses when calling functions/methodsFlorian Diebold2019-07-061-6/+4
| | | | | E.g. if we call `foo<T: Into<u32>>(x)`, that adds an obligation that `x: Into<u32>`, etc.
* allow rustfmt to reorder importsAleksey Kladov2019-07-041-11/+10
| | | | | | 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
* rename XSignature -> XDataAleksey Kladov2019-06-181-8/+7
|
* Add basic infrastructure for assoc type projectionFlorian Diebold2019-06-151-1/+1
|
* somewhat better nameAleksey Kladov2019-06-081-2/+2
|
* add tests for primitive typesAleksey Kladov2019-05-301-2/+1
|
* add built-in types to scopesAleksey Kladov2019-05-301-16/+0
|
* add ModuleDef::BuiltInTypeAleksey Kladov2019-05-301-5/+31
|
* add union to code_modelAleksey Kladov2019-05-231-2/+8
|
* remove minor code duplicationAleksey Kladov2019-05-201-18/+14
|
* Use normal iteration instead of walk_mutEdwin Cheng2019-05-201-8/+5
|
* Add infer for generic default typeEdwin Cheng2019-05-191-13/+46
|
* Handle where clauses in trait solvingFlorian Diebold2019-05-111-8/+45
|
* Differentiate Tuple / FnPtr type constructors by cardinalityFlorian Diebold2019-05-041-2/+5
| | | | | This is necessary because Chalk (reasonably) expects each 'struct' to know how many type parameters it takes.
* Chalk integrationFlorian Diebold2019-05-041-18/+12
| | | | | - add proper canonicalization logic - add conversions from/to Chalk IR
* Extract generic_params method to a HasGenericParams traitFlorian Diebold2019-04-141-2/+2
|
* Some cleanupFlorian Diebold2019-04-141-2/+5
|
* More trait infrastructureFlorian Diebold2019-04-141-1/+8
| | | | | | | | | | - make it possible to get parent trait from method - add 'obligation' machinery for checking that a type implements a trait (and inferring facts about type variables from that) - handle type parameters of traits (to a certain degree) - improve the hacky implements check to cover enough cases to exercise the handling of traits with type parameters - basic canonicalization (will probably also be done by Chalk)
* Get substs for trait refs in impl blocksFlorian Diebold2019-04-141-25/+70
|
* replace todo with fixmeAleksey Kladov2019-03-231-3/+3
|
* Refactor primitive types into more orthogonal representationyanchith2019-03-221-4/+4
|
* TypeName => TypeCtorFlorian Diebold2019-03-211-18/+18
|
* Remove the old variants replaced by Ty::ApplyFlorian Diebold2019-03-211-20/+18
|
* Represent FnPtr and Tuple using SubstsFlorian Diebold2019-03-211-2/+2
|
* make Name::new privateAleksey Kladov2019-03-201-2/+2
|
* Remove FnSig from FnDef typeFlorian Diebold2019-03-161-6/+12
| | | | | It doesn't need to be in there since it's just information from the def. Another step towards aligning Ty with Chalk's representation.