aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_ty/src
Commit message (Collapse)AuthorAgeFilesLines
* Fix completion with a partially unknown typeFlorian Diebold2020-03-101-3/+25
| | | | | | | | | | | | | | To test whether the receiver type matches for the impl, we unify the given self type (in this case `HashSet<{unknown}>`) with the self type of the impl (`HashSet<?0>`), but if the given self type contains Unknowns, they won't be unified with the variables in those places. So we got a receiver type that was different from the expected one, and concluded the impl doesn't match. The fix is slightly hacky; if after the unification, our variables are still there, we make them fall back to Unknown. This does make some sense though, since we don't want to 'leak' the variables. Fixes #3547.
* Use `Index` for CrateGraphAleksey Kladov2020-03-091-1/+1
|
* Less abstract CrateData apiKirill Bulatov2020-03-091-1/+1
|
* Prevent include! macro include itselfEdwin Cheng2020-03-071-0/+18
|
* Use a not so dummy implementation of env macroEdwin Cheng2020-03-071-0/+27
|
* Normalize waiting queries namesAleksey Kladov2020-03-063-10/+10
|
* Don't reuse the Chalk solverFlorian Diebold2020-03-062-92/+28
| | | | | This slows down analysis-stats a bit (~5% in my measurement), but improves incremental checking a lot because we can reuse trait solve results.
* Resolve `Self::AssocTy` in implsFlorian Diebold2020-03-063-38/+93
| | | | | | | | | | To do this we need to carry around the original resolution a bit, because `Self` gets resolved to the actual type immediately, but you're not allowed to write the equivalent type in a projection. (I tried just comparing the projection base type with the impl self type, but that seemed too dirty.) This is basically how rustc does it as well. Fixes #3249.
* Allow specifying additional info on call to profileAleksey Kladov2020-03-062-2/+14
|
* Less confusing profile namesAleksey Kladov2020-03-062-2/+2
|
* Merge #3494bors[bot]2020-03-061-0/+45
|\ | | | | | | | | | | | | | | | | | | | | | | 3494: Implement include macro r=matklad a=edwin0cheng This PR implement builtin `include` macro. * It does not support include as expression yet. * It doesn't consider `env!("OUT_DIR")` yet. Co-authored-by: Edwin Cheng <[email protected]>
| * Implment include macroEdwin Cheng2020-03-061-0/+45
| |
* | Support aliases and Self in struct literalsFlorian Diebold2020-03-062-1/+68
| | | | | | | | Fixes #3306.
* | Source map returns a resultAleksey Kladov2020-03-062-8/+13
|/ | | | cc #2236
* Fix panic on eager expansionEdwin Cheng2020-03-031-0/+21
|
* Add testEdwin Cheng2020-03-031-0/+19
|
* 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
|
*-. Merge #3397 #3398bors[bot]2020-03-021-6/+2
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 3397: Minimal viable meta r=matklad a=matklad bors r+ 🤖 3398: Reformat? r=matklad a=matklad bors r+ 🤖 Co-authored-by: Aleksey Kladov <[email protected]>
| | * Reformat?Aleksey Kladov2020-03-021-6/+2
| |/
* | Merge #3385bors[bot]2020-03-024-6/+45
|\ \ | |/ |/| | | | | | | | | | | | | | | | | 3385: Fix #3373 r=matklad a=flodiebold Basically, we need to allow variables in the caller self type to unify with the impl's declared self type. That requires some more contortions in the variable handling. I'm looking forward to (hopefully) handling this in a cleaner way when we switch to Chalk's types and unification code. Co-authored-by: Florian Diebold <[email protected]>
| * Fix #3373Florian Diebold2020-03-014-6/+45
| | | | | | | | | | | | | | Basically, we need to allow variables in the caller self type to unify with the impl's declared self type. That requires some more contortions in the variable handling. I'm looking forward to (hopefully) handling this in a cleaner way when we switch to Chalk's types and unification code.
* | handle array pattern matching type inferenceJosh Mcguigan2020-03-012-10/+55
| |
* | remove match statement, handle suffixJosh Mcguigan2020-03-012-14/+11
| |
* | handle arbitrary length slicesJosh Mcguigan2020-03-012-12/+29
| |
* | match single prefix sliceJosh Mcguigan2020-03-012-1/+48
|/
* Do autoderef for indexingFlorian Diebold2020-02-294-7/+74
|
* Do array unsizing for method receiversFlorian Diebold2020-02-292-2/+37
| | | | | | | It turns out rustc actually only unsizes array method receivers, so we don't need to do any trait solving for this (at least for now). Fixes #2670.
* Rename ast::ImplBlock -> ast::ImplDefAleksey Kladov2020-02-296-29/+28
|
* Fix a common false-positive type mismatchFlorian Diebold2020-02-293-9/+71
| | | | | | | | | E.g. for `&{ some_string() }` in a context where a `&str` is expected, we reported a mismatch inside the block. The problem is that we're passing an expectation of `str` down, but the expectation is more of a hint in this case. There's a long comment in rustc about this, which I just copied. Also, fix reported location for type mismatches in macros.
* Basic injectionsAleksey Kladov2020-02-271-2/+2
|
* Bump chalk and replace TypeFamily with InternerLaurențiu Nicola2020-02-242-56/+65
|
* Shorten some codeFlorian Diebold2020-02-221-4/+1
|
* Rework find_super_trait_path to protect against cyclesFlorian Diebold2020-02-225-23/+74
|
* Fix shift_bound_varsFlorian Diebold2020-02-221-3/+3
| | | | It should only shift free vars (maybe the name isn't the best...)
* Fix wrong handling of bare `dyn Trait` exposed by canonicalizer fixFlorian Diebold2020-02-221-1/+3
| | | | | The self type in the `dyn Trait` trait ref should always be ^0, but we didn't put that in there in the bare case.
* Add &dyn Trait -> &dyn SuperTrait coercion, and fix &T -> &dyn TraitFlorian Diebold2020-02-224-44/+132
|
* Fix handling of binders in canonicalizationFlorian Diebold2020-02-221-64/+35
| | | | I'm looking forward to getting rid of this in favor of Chalk's implementation.
* Implement dyn Trait unsizing as wellFlorian Diebold2020-02-225-9/+136
|
* Implement unsize coercion using proper trait solvingFlorian Diebold2020-02-225-187/+170
|
* Fix handling of const patternsFlorian Diebold2020-02-212-2/+48
| | | | | | | | | E.g. in `match x { None => ... }`, `None` is a path pattern (resolving to the option variant), not a binding. To determine this, we need to try to resolve the name during lowering. This isn't too hard since we already need to resolve names for macro expansion anyway (though maybe a bit hacky). Fixes #1618.
* Normalize associated types in types coming from ChalkFlorian Diebold2020-02-212-1/+46
| | | | Fixes #3232.
* Merge #3215bors[bot]2020-02-192-6/+34
|\ | | | | | | | | | | | | | | | | | | 3215: Exclude methods from non-parameter types introduced by generic constraints r=flodiebold a=lnicola Fixes #3184. r? @flodiebold Co-authored-by: Laurențiu Nicola <[email protected]>
| * Exclude methods from non-parameter types introduced by generic constraintsLaurențiu Nicola2020-02-192-6/+34
| |
* | Fill missing fields of enum variantsAleksey Kladov2020-02-191-7/+11
|/
* More manual clippy fixesKirill Bulatov2020-02-1812-54/+38
|
* Run cargo +nightly fix --clippy -Z unstable-optionsKirill Bulatov2020-02-1810-76/+66
|
* Merge #3169bors[bot]2020-02-171-4/+5
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 3169: Show record field names in Enum completion r=flodiebold a=adamrk Adresses https://github.com/rust-analyzer/rust-analyzer/issues/2947. Previously the details shown when autocompleting an Enum variant would look like the variant was a tuple even if it was a record: ![2020-02-16-15:59:32_crop](https://user-images.githubusercontent.com/16367467/74607233-64f21980-50d7-11ea-99db-e973e29c71d7.png) This change will show the names of the fields for a record and use curly braces instead of parentheses: ![2020-02-16-15:33:00_crop](https://user-images.githubusercontent.com/16367467/74607251-8ce17d00-50d7-11ea-9d4d-38d198a4aec0.png) This required exposing the type `adt::StructKind` from `ra_hir` and adding a function ``` kind(self, db: &impl HirDatabase) -> StructKind ``` in the `impl` of `EnumVariant`. There was also a previously existing function `is_unit(self, db: &impl HirDatabase) -> bool` for `EnumVariant` which I removed because it seemed redundant after adding `kind`. Co-authored-by: adamrk <[email protected]>
| * use 'if let' instead of match on kind in lower.rsadamrk2020-02-171-6/+4
| |