aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_ty/src/infer.rs
Commit message (Collapse)AuthorAgeFilesLines
* Rename ra_syntax -> syntaxAleksey Kladov2020-08-121-1/+1
|
* Rename ra_prof -> profileAleksey Kladov2020-08-121-2/+1
|
* Rename ra_arenaAleksey Kladov2020-08-121-1/+1
|
* Add support for unions in inference and loweringPaul Daniel Faria2020-08-081-4/+7
|
* Cleanup hir diagnostics APIAleksey Kladov2020-07-141-5/+5
|
* Don't copy-paste `impl_froms` into every crateAleksey Kladov2020-07-131-4/+3
|
* Fix inference of indexing argument (partly)Florian Diebold2020-07-031-8/+12
| | | | | | | | We need to add the `T: Index<Arg>` obligation to be resolved later as well, otherwise we can't make inferences about `Arg` later based on the `Index` impls. This still doesn't fix indexing with integer variables though; there's a further problem with Chalk floundering because of the variable, I think.
* Make known paths use `core` instead of `std`Jonas Schievink2020-06-111-8/+8
|
* Clean up handling of int/float literal typesFlorian Diebold2020-06-061-10/+3
| | | | | | '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.
* Fix type parameter defaultsFlorian Diebold2020-06-051-2/+2
| | | | | They should not be applied in expression or pattern contexts, unless there are other explicitly given type args.
* Implement return position impl trait / opaque type supportFlorian Diebold2020-06-051-21/+2
| | | | | | | | | | | | | 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.
* correctly infer labelled breaksrobojumper2020-05-311-0/+11
|
* Infer return type of loops with value breaks.Roland Ruckerbauer2020-05-181-0/+1
|
* Handle `Self` in values and patternsFlorian Diebold2020-05-151-13/+66
| | | | | | | | | I.e. - `Self(x)` or `Self` in tuple/unit struct impls - `Self::Variant(x)` or `Self::Variant` in enum impls - the same in patterns Fixes #4454.
* Highlight mutable statics as mutableMatthew Jasper2020-05-101-2/+6
|
* Add diagnostic for break outside of loopFlorian Diebold2020-05-081-1/+12
|
* Handle break somewhat betterFlorian Diebold2020-05-081-0/+7
| | | | | Still no break-with-value or labels, but at least we know that `loop { break; }` doesn't diverge.
* Implement better handling of divergenceFlorian Diebold2020-05-081-0/+40
| | | | | | | | Divergence here means that for some reason, the end of a block will not be reached. We tried to model this just using the never type, but that doesn't work fully (e.g. in `let x = { loop {}; "foo" };` x should still have type `&str`); so this introduces a `diverges` flag that the type checker keeps track of, like rustc does.
* Fix panic in NoSuchField diagnosticAleksey Kladov2020-04-251-3/+2
|
* Rename StructField -> FieldAleksey Kladov2020-04-251-8/+8
|
* Fix goto definition for record patternsAleksey Kladov2020-04-181-0/+4
|
* Simplify Diagnostic structureAleksey Kladov2020-04-171-8/+1
| | | | | | It's not entirely clear what subnode ranges should mean in the presence of macros, so let's leave them out for now. We are not using them heavily anyway.
* Don't expose impl details of SyntaxPtrAleksey Kladov2020-04-171-2/+9
|
* Use `dyn Trait` for working with databseAleksey Kladov2020-03-161-19/+19
| | | | | | | 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).
* Normalize waiting queries namesAleksey Kladov2020-03-061-2/+2
|
* Less confusing profile namesAleksey Kladov2020-03-061-1/+1
|
* Support aliases and Self in struct literalsFlorian Diebold2020-03-061-1/+27
| | | | Fixes #3306.
* Do autoderef for indexingFlorian Diebold2020-02-291-2/+6
|
* Fix a common false-positive type mismatchFlorian Diebold2020-02-291-5/+36
| | | | | | | | | 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.
* Implement unsize coercion using proper trait solvingFlorian Diebold2020-02-221-7/+0
|
* Run cargo +nightly fix --clippy -Z unstable-optionsKirill Bulatov2020-02-181-6/+5
|
* FormattingFlorian Diebold2020-02-071-3/+6
|
* Clean up RPIT a bitFlorian Diebold2020-02-071-26/+2
|
* Fix APIT some moreFlorian Diebold2020-02-071-2/+5
|
* WIP use params for APITFlorian Diebold2020-02-071-1/+1
|
* Lower impl trait to variables, move away from using placeholders where they ↵Florian Diebold2020-02-071-13/+5
| | | | don't belong
* Add impl trait lowering modeFlorian Diebold2020-02-071-8/+25
|
* Introduce TyLoweringContextFlorian Diebold2020-02-071-9/+8
|
* Split `infer` query into two for better profilingMichal Terepeta2020-01-031-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is the same change as we did with `crate_def_map` and it does seem that we mostly spend time in salsa, without recomputing much on rust-analyzer side. Example output: ``` 233ms - handle_inlay_hints 163ms - get_inlay_hints 163ms - SourceAnalyzer::new 67ms - def_with_body_from_child_node 67ms - analyze_container 67ms - analyze_container 67ms - Module::from_definition 67ms - Module::from_file 67ms - crate_def_map 0ms - parse_macro_query (6 calls) 0ms - raw_items_query (1 calls) 66ms - ??? 0ms - crate_def_map (1 calls) 0ms - crate_def_map (1 calls) 96ms - infer 2ms - trait_solve_query (2 calls) 94ms - ??? 0ms - body_with_source_map_query (1 calls) 0ms - crate_def_map (1 calls) [...] ``` Signed-off-by: Michal Terepeta <[email protected]>
* Resolve traits in infer using lang item infrastructureEmil Lauridsen2019-12-291-10/+13
|
* Check if parameters is emptyEdwin Cheng2019-12-241-4/+6
|
* Add FIXMEEdwin Cheng2019-12-241-1/+5
|
* Implement infer await from async funcEdwin Cheng2019-12-241-2/+15
|
* Fix coercion of last expression in function bodyFlorian Diebold2019-12-201-1/+1
|
* Handle closure return typesFlorian Diebold2019-12-201-1/+6
| | | | Fixes #2547.
* Use fill instread of for loopEdwin Cheng2019-12-191-5/+3
|
* Use build_for_defEdwin Cheng2019-12-191-1/+1
|
* Add std::ops::Index support for inferingEdwin Cheng2019-12-191-1/+21
|
* Add test markFlorian Diebold2019-12-151-0/+2
|
* Handle impl Trait more correctlyFlorian Diebold2019-12-151-1/+24
| | | | | | | When calling a function, argument-position impl Trait is transparent; same for return-position impl Trait when inside the function. So in these cases, we need to represent that type not by `Ty::Opaque`, but by a type variable that can be unified with whatever flows into there.