aboutsummaryrefslogtreecommitdiff
path: root/crates
Commit message (Collapse)AuthorAgeFilesLines
* Fix hir for ast::UnionDefAleksey Kladov2019-11-2522-86/+121
|
* Introduce dedicated AST node for unionAleksey Kladov2019-11-257-15/+63
| | | | | | | | | | Although structs and unions have the same syntax and differ only in the keyword, re-using the single syntax node for both of them leads to confusion in practice, and propagates further down the hir in an upleasent way. Moreover, static and consts also share syntax, but we use different nodes for them.
* Merge #2388bors[bot]2019-11-252-2/+8
|\ | | | | | | | | | | | | | | 2388: Show missing struct fields in the error message r=matklad a=Frizi This provides the most interesting information about the "missing structure fields" error directly to the user. Co-authored-by: Frizi <[email protected]>
| * Show missing struct fields in the error messageFrizi2019-11-242-2/+8
| |
* | Use ids for CallableAleksey Kladov2019-11-254-34/+50
| |
* | Use more IDsAleksey Kladov2019-11-251-17/+18
| |
* | Use GenericDefIdMoreAleksey Kladov2019-11-2510-56/+44
| |
* | Use GenericDefId moreAleksey Kladov2019-11-255-33/+20
| |
* | Remove Resolver from autoderefAleksey Kladov2019-11-257-49/+73
| | | | | | | | | | Resolver holds onto too much context, including local scopes. Let's try to pass in only what is necessary -- the trait environment.
* | Push resolver upAleksey Kladov2019-11-251-12/+15
| |
* | Merge #2362bors[bot]2019-11-252-0/+39
|\ \ | | | | | | | | | | | | | | | | | | | | | 2362: Expand compile_error! r=edwin0cheng a=kjeremy Does not validate that the input is a string literal. I thought that I could `match_ast!` against the `macro_args` but that did not work. Even if it had I am not sure which error would be appropriate. Co-authored-by: Jeremy Kolb <[email protected]>
| * | Expand compile_error!Jeremy Kolb2019-11-252-0/+39
| | |
* | | Merge #2392bors[bot]2019-11-251-5/+16
|\ \ \ | |/ / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2392: Fix panic during the expansion of `column!` r=edwin0cheng a=marcogroppo Fixes #2379. Well, this isn't the "proper" fix but it doesn't hurt, IMHO. The problem is that `to_col_number`, called by `column_expand`, receives a position number that isn't included in the text range of the file. My (very limited) understanding is that the text is the one of the original file, while `pos` is relative to something else, probably the text of the macro. Notice that in this case the `column!` expansion seems to be triggered by `assert_eq!`, so we're in the middle of another expansion. This PR simply avoids the panic by checking the length of the text. r? @edwin0cheng Co-authored-by: Marco Groppo <[email protected]>
| * | Fix panic during the expansion of `column!`Marco Groppo2019-11-241-5/+16
| | |
* | | Merge #2396bors[bot]2019-11-2410-42/+68
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2396: Switch to variant-granularity field type inference r=flodiebold a=matklad r? @flodiebold Previously, we had a `ty` query for each field. This PR switcthes to a query per struct, which returns an `ArenaMap` with `Ty`s. I don't know which approach is better. What is bugging me about the original approach is that, if we do all queries on the "leaf" defs, in practice we get a ton of queries which repeatedly reach into the parent definition to compute module, resolver, etc. This *seems* wasteful (but I don't think this is really what causes any perf problems for us). At the same time, I've been looking at Kotlin, and they seem to use the general pattern of analyzing the *parent* definition, and storing info about children into a `BindingContext`. I don't really which way is preferable. I think I want to try this approach, where query granularity generally mirrors the data granularity. The primary motivation for me here is probably just hope that we can avoid adding a ton of helpers to a `StructField`, and maybe in general avoid the need to switch to a global `StructField`, using `LocalStructFieldId` most of the time internally. For external API (ie, for `ra_ide_api`), I think we should continue with fine-grained `StructField::ty` approach, which internally fetches the table for the whole struct and indexes into it. In terms of actual memory savings, the results are as follows: ``` This PR: 142kb FieldTypesQuery (deps) 38kb FieldTypesQuery Status Quo: 208kb TypeForFieldQuery (deps) 18kb TypeForFieldQuery ``` Note how the table itself occupies more than twice as much space! I don't have an explanation for this: a plausible hypothesis is that single-field structs are very common and for them the table is a pessimisation. THere's noticiable wallclock time difference. Co-authored-by: Aleksey Kladov <[email protected]>
| * | | Switch to variant-granularity field type inferenceAleksey Kladov2019-11-2410-42/+68
| | | |
* | | | Implement HasModule for AdtIdAleksey Kladov2019-11-242-9/+13
|/ / /
* | | Simplify ADT fieldsAleksey Kladov2019-11-245-26/+29
| | |
* | | Remove impl_block moduleAleksey Kladov2019-11-244-55/+43
| | |
* | | hir_def is fully doc'ed!Aleksey Kladov2019-11-243-5/+8
| | |
* | | SimplifyAleksey Kladov2019-11-248-104/+30
| | |
* | | DocsAleksey Kladov2019-11-242-2/+4
| | |
* | | Don't redo field resolution in the IDEAleksey Kladov2019-11-246-22/+30
| |/ |/|
* | Merge #2387bors[bot]2019-11-2415-96/+74
|\ \ | | | | | | | | | | | | | | | | | | | | | 2387: Simplify r=matklad a=matklad Co-authored-by: Aleksey Kladov <[email protected]>
| * | SimplifyAleksey Kladov2019-11-248-33/+17
| | |
| * | Cleanup nameresAleksey Kladov2019-11-245-35/+19
| | |
| * | Use Trace in raw_itemsAleksey Kladov2019-11-243-29/+39
| |/
* | Merge #2381bors[bot]2019-11-243-1/+30
|\ \ | |/ |/| | | | | | | | | | | | | 2381: Add proc-macro crate type handling r=JasperDeSutter a=JasperDeSutter Resolves the libproc_macro crate in crates that are the proc-macro type. This doesn't seem the ideal implementation though, since the compiler still requires you to write `extern crate proc_macro;` (even in 2018 edition). Co-authored-by: JasperDeSutter <[email protected]>
| * add proc-macro crate type handlingJasperDeSutter2019-11-243-1/+30
| |
* | Some docsAleksey Kladov2019-11-244-11/+18
| |
* | CleanupAleksey Kladov2019-11-247-20/+15
| |
* | Reduce visibilityAleksey Kladov2019-11-242-8/+11
| |
* | Merge #2383bors[bot]2019-11-242-0/+10
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2383: Add alloc to the crate graph r=matklad a=marcogroppo `alloc` has been added to the crate graph. Completions work, but they are available even when the user has **not** declared an `extern crate alloc`. Is this the correct approach? Fixes #2376. Co-authored-by: Marco Groppo <[email protected]>
| * | Add alloc to the sysrootMarco Groppo2019-11-242-0/+10
| |/
* | Nicer API for attrsAleksey Kladov2019-11-244-32/+38
| |
* | Slightly reduce code duplicationAleksey Kladov2019-11-243-33/+30
| |
* | SimplifyAleksey Kladov2019-11-242-19/+5
| |
* | SimplifyAleksey Kladov2019-11-242-16/+3
| |
* | Switch to StaticLoc for staticsAleksey Kladov2019-11-2413-28/+65
| |
* | Remove ids moduleAleksey Kladov2019-11-246-41/+33
| |
* | Pull macro upAleksey Kladov2019-11-243-28/+16
| |
* | Cleanup importsAleksey Kladov2019-11-248-27/+20
| |
* | Push poison_macros downAleksey Kladov2019-11-242-25/+28
| |
* | Reduce visbilityAleksey Kladov2019-11-241-10/+10
|/
* Merge #2378bors[bot]2019-11-241-3/+6
|\ | | | | | | | | | | | | | | 2378: Fix panic in batch analysis r=matklad a=matklad Co-authored-by: Aleksey Kladov <[email protected]>
| * Fix panic in batch analysisAleksey Kladov2019-11-241-3/+6
| | | | | | | | Closes #2272
* | Merge #2365bors[bot]2019-11-241-9/+31
|\ \ | | | | | | | | | | | | | | | | | | | | | 2365: Make expand-macro more flexible r=matklad a=edwin0cheng Due to lack of implementation or other types of errors, some macros do not expand correctly in the current situation. The PR attempts to make `expand-macro` more flexible in error situations by ignoring internal failed macro expansion. Co-authored-by: Edwin Cheng <[email protected]>
| * | Improve fail case in expand_macroEdwin Cheng2019-11-231-9/+31
| | |
* | | Merge #2343bors[bot]2019-11-247-35/+155
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2343: implement assist invert_if r=matklad a=bravomikekilo fix [issue 2219 invert if condition](https://github.com/rust-analyzer/rust-analyzer/issues/2219) I put the assist cursor range to `if` of the if expression, because both condition and body will be replaced. Is there any way to replace them without cover the cursor position? @matklad Co-authored-by: bravomikekilo <[email protected]>
| * | | do refact and fix some issuebravomikekilo2019-11-246-58/+70
| | | |