Commit graph

11051 commits

Author SHA1 Message Date
Jonas Schievink
89f015ead9 Simplify multiline check 2021-04-12 21:41:44 +02:00
Jonas Schievink
dd1832c016 Indent block expressions on enter 2021-04-12 20:35:38 +02:00
Jakub Kądziołka
2f60cec3ac
Fix typo: liner -> linear
🙈
2021-04-12 20:20:25 +02:00
Aleksey Kladov
426d098bd6 internal: prepare for lazy diagnostics 2021-04-12 17:58:01 +03:00
Aleksey Kladov
29d5f29932 fix: don't spam repeated error messages when cargo check fails
Conceptually, using a *message* here is wrong, because this is a
"status", rather than "point in time" thing. But statuses are an LSP
extension, while messages are stable. As a compromise, send message only
for more critical `metadata` failures, and only once per state change.
2021-04-12 16:19:36 +03:00
Aleksey Kladov
186c5c47cb feat: avoid checking the whole project during initial loading 2021-04-12 15:29:31 +03:00
Brandon
09a78caca4 Add macro test 2021-04-11 11:12:02 -07:00
Florian Diebold
97d6e36dbe Remove assertion in impl collection
This condition should always be true for *valid* code, but of course
there might be invalid code or things that we can't currently resolve.

Fixes #8464.
2021-04-11 12:07:58 +02:00
jake
a624e2ea8d Adds impl Deref assist 2021-04-11 00:42:05 -07:00
bors[bot]
5b40342d2d
Merge #8465
8465: Include more info in assert r=jonas-schievink a=jonas-schievink

This helped find https://github.com/rust-analyzer/rust-analyzer/issues/8464

changelog skip

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-04-10 23:42:26 +00:00
Jonas Schievink
5f2efae3ba Include more info in assert 2021-04-11 01:41:40 +02:00
bors[bot]
eccd0efedb
Merge #8463
8463: Support macros in pattern position r=jonas-schievink a=jonas-schievink

This was fairly easy, because patterns are limited to bodies, so almost all changes were inside body lowering.

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-04-10 23:33:18 +00:00
Jonas Schievink
e2c1da36f5 Support macros in pattern position 2021-04-11 01:25:50 +02:00
bors[bot]
a8a25863f6
Merge #8436
8436: Fix extract function's mutability of variables outliving the body r=matklad a=brandondong

**Reproduction:**
```rust
fn main() {
    let mut k = 1;
    let mut j = 2;
    j += 1;
    k += j;
}
```
1. Select the first to third lines of the main function. Use the "Extract into function" code assist.
2. The output is the following which does not compile because the outlived variable `k` is declared as immutable:
```rust
fn main() {
    let (k, j) = fun_name();
    k += j;
}

fn fun_name() -> (i32, i32) {
    let mut k = 1;
    let mut j = 2;
    j += 1;
    (k, j)
}
```
3. We would instead expect the output to be:
```rust
fn main() {
    let (mut k, j) = fun_name();
    k += j;
}
```

**Fix:**
- Instead of declaring outlived variables as immutable unconditionally, check for any mutable usages outside of the extracted function.

Co-authored-by: Brandon <brandondong604@hotmail.com>
2021-04-10 21:35:05 +00:00
Jonas Schievink
44b04ebe43 Revert "Rewrite #[derive] removal to be based on AST"
This reverts commit 7e78aebc8f.
2021-04-10 20:30:28 +02:00
Jonas Schievink
050dc93e00 Revert "Use pub(crate)"
This reverts commit c51213c2e7.
2021-04-10 20:30:24 +02:00
Jonas Schievink
526dc4b5f5 Revert "Use name![derive]"
This reverts commit d6187de4cd.
2021-04-10 20:30:19 +02:00
Lukas Wirth
8113c3a914 Respect test style guidelines in tests::traits 2021-04-10 18:03:27 +02:00
bors[bot]
4bf32eea21
Merge #8457
8457: Implement more precise binary op return type heuristic r=flodiebold a=Veykril

Should fix #7150

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-04-10 15:53:06 +00:00
Lukas Wirth
a15b8136ee Add test for binary op return ty with adt 2021-04-10 17:52:24 +02:00
Lukas Wirth
d9554c258b Add manual ops::Add impls to test::traits::closure_2 2021-04-10 17:16:35 +02:00
Lukas Wirth
252eb78dc3 Implement more precise binary op return type prediction 2021-04-10 16:56:32 +02:00
bors[bot]
0fac165052
Merge #8410
8410: Use CompletionTextEdit::InsertAndReplace if supported by the client r=Veykril a=Veykril

Fixes #8404, Fixes #3130

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-04-10 13:07:46 +00:00
Aleksey Kladov
e012efca27 Let's try testing for "is not quadratic" condition 2021-04-10 12:43:07 +03:00
Jonas Schievink
30ce8b20ec Avoid an unnecessary collect 2021-04-09 22:52:13 +02:00
bors[bot]
343b14f7e0
Merge #8450
8450: Don't ignore unnamed consts when looking for definitions r=Veykril a=Veykril

Fixes #8448
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-04-09 15:16:36 +00:00
Lukas Wirth
ec2895e956 Insert unnamed consts to ChildBySource DynMap 2021-04-09 17:14:48 +02:00
Jonas Schievink
75614b126b Resolve prelude and crate root names in the root DefMap 2021-04-09 15:29:42 +02:00
bors[bot]
3b1692c3e8
Merge #8443 #8446
8443: Rewrite `#[derive]` removal code to be based on AST r=jonas-schievink a=jonas-schievink

We now remove any `#[derive]` before and including the one we want to expand, in the `macro_arg` query.

The same infra will be needed by attribute macros (except we only remove the attribute we're expanding, not any preceding ones).

Part of https://github.com/rust-analyzer/rust-analyzer/issues/8434 (doesn't implement the cfg-expansion yet, because that's more difficult)

8446: Undo path resolution hack for extern prelude r=jonas-schievink a=jonas-schievink

Reverts the change made in https://github.com/rust-analyzer/rust-analyzer/pull/7959

We don't populate the extern prelude for block DefMaps anymore,
so this is unnecessary

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-04-09 12:53:49 +00:00
Jonas Schievink
d6187de4cd Use name![derive] 2021-04-09 14:50:42 +02:00
Jonas Schievink
4ea5f690bc Undo path resolution hack for extern prelude
We don't populate the extern prelude for block DefMaps anymore,
so this is unnecessary
2021-04-09 14:46:52 +02:00
bors[bot]
972e1f4b8c
Merge #8445
8445: `hir_ty` cleanup r=flodiebold a=flodiebold

Move lots of things around within `hir_ty`. Most notably, all the Chalk-related stuff moves from within `traits/` to the top-level, since Chalk isn't purely a "traits thing" anymore.

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2021-04-09 12:43:48 +00:00
Florian Diebold
fbe98047d4 More cleanups / module docs 2021-04-09 14:40:58 +02:00
Florian Diebold
8a2c482082 More cleanups 2021-04-09 14:33:31 +02:00
Florian Diebold
2f02977e56 More moving stuff around 2021-04-09 14:28:04 +02:00
Jonas Schievink
c51213c2e7 Use pub(crate) 2021-04-09 14:24:31 +02:00
Jonas Schievink
ac980e96e5 Shrink unlinked-file diagnostic to 3 characters 2021-04-09 14:22:38 +02:00
Florian Diebold
9fba7cf827 Move some more stuff to better places 2021-04-09 14:18:58 +02:00
Florian Diebold
5ca481bbdc Move ToChalk -> mapping 2021-04-09 14:15:26 +02:00
Florian Diebold
743faa21e7 Reorganize hir_ty modules
Chalk isn't really a 'traits' thing anymore, so it doesn't make sense to
have all the Chalk-related stuff in submodules of `traits`.
2021-04-09 14:11:37 +02:00
Jonas Schievink
7e78aebc8f Rewrite #[derive] removal to be based on AST 2021-04-09 14:10:54 +02:00
Jonas Schievink
c0dd36fd42 Store #[derive] attribute ID along macro invoc 2021-04-09 13:38:01 +02:00
Jonas Schievink
546da15972 Rename Attrs index field to id 2021-04-09 13:36:22 +02:00
Jonas Schievink
3fcdd1bcdf Add AttrId to track attribute sources 2021-04-09 13:32:03 +02:00
bors[bot]
99ed68a109
Merge #8406
8406: Improve indexing of impls r=flodiebold a=flodiebold

Store impls for e.g. &Foo with the ones for Foo instead of the big "other" bucket. This can improve performance and simplifies the HIR impl search a bit.

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2021-04-09 10:45:34 +00:00
Florian Diebold
fdd721e9ef Improve indexing of impls
Store impls for e.g. &Foo with the ones for Foo instead of the big
"other" bucket. This can improve performance and simplifies the HIR impl
search a bit.
2021-04-09 11:21:31 +02:00
Florian Diebold
272a8dce4f Fix crash on syn involving lifetimes returned by Chalk
If we get lifetime variables back in autoderef, just immediately replace
them by static lifetimes for now. Method resolution doesn't really deal
correctly with new variables being introduced (this needs to be fixed
more properly).

This fixes `rust-analyzer analysis-stats --with-deps` crashing in the RA
repo.
2021-04-09 11:17:07 +02:00
Brandon
c989287a34 Fix extract function's mutability of variables outliving the body 2021-04-08 20:58:29 -07:00
bors[bot]
354151df35
Merge #8429
8429: 8425: Added documentation for on enter covering //! doc comments. r=jonas-schievink a=chetankhilosiya

Also added passing test case.

Co-authored-by: Chetan Khilosiya <chetan.khilosiya@gmail.com>
2021-04-08 23:33:36 +00:00
Jade
4529f1be81 decl_check: consider outer scopes' allows
Fix #8417. Also makes it less noisy about no_mangle annotated stuff the
user can do nothing about.

Note: this still is broken with bitfield! macros. A repro in an ignore
test is included here. I believe this bug is elsewhere, and I don't
think I can work around it here.
2021-04-08 14:43:19 -07:00
Florian Diebold
37ff15ad83 Cleanup 2021-04-08 22:49:10 +02:00
Florian Diebold
417473aa3d Intern Variances
This may be a slight performance improvement.
2021-04-08 22:48:47 +02:00
Florian Diebold
f778e50b71 Don't intern ProgramClause at all
This seems to work best performance/memory-wise.
2021-04-08 22:48:47 +02:00
Florian Diebold
566200342a Intern QuantifiedWhereClauses
Slight performance and memory usage improvement.
2021-04-08 22:48:47 +02:00
Florian Diebold
15b0b55b4e Intern ProgramClauses 2021-04-08 22:48:47 +02:00
Florian Diebold
317c4b972f Intern CanonicalVarKinds
Slight savings in performance and memory.
2021-04-08 22:48:47 +02:00
Florian Diebold
90656f8674 Intern consts & lifetimes
Slight memory usage reduction.
2021-04-08 22:48:47 +02:00
Florian Diebold
37cb6805af Intern types
Performance about the same, memory reduced by ~5%.
2021-04-08 22:48:47 +02:00
Florian Diebold
be03db0e3a Intern Substitutions
(Costs a bit of performance, reduces memory usage on RA by ~10%.)
2021-04-08 22:48:47 +02:00
Florian Diebold
a169fa6a83 Intern VariableKinds 2021-04-08 22:48:47 +02:00
Chetan Khilosiya
4a9dd149aa 8024: Added the trait modifier for assoc types. 2021-04-09 01:00:35 +05:30
Chetan Khilosiya
a8b5400cc6 8425: Added documentation for on enter covering //! doc comments.
Also added passing test case.
2021-04-09 00:31:07 +05:30
Jonas Schievink
86b7861612 Use named fields in MacroCallKind 2021-04-08 20:43:07 +02:00
Chetan Khilosiya
b232549653 8279: Fix the not operator use and test case fix. 2021-04-08 22:58:26 +05:30
Chetan Khilosiya
1735b3ef6a 8279: Added initial implementation for
Operator semantic highlighting.
2021-04-08 22:58:26 +05:30
Jonas Schievink
014774764a Track recursion limit when expanding custom derive 2021-04-08 18:49:30 +02:00
Brandon
24ab69c608 Add FIXME for macro case 2021-04-08 09:27:04 -07:00
bors[bot]
94d9fc2a28
Merge #8421
8421: Reduce allocations in "Expand macro" formatter r=edwin0cheng a=lnicola



Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-04-08 15:43:30 +00:00
bors[bot]
72ad5cbe16
Merge #8419 #8423
8419: Move hir_ty to Chalk IR r=flodiebold a=flodiebold

Closes #8313.

There's some further cleanups to do:
 - we're still using our `TypeWalk` in lots of places (not for mutating/folding though, just for walking)
 - we're still using our own canonicalization and unification and our `InferenceTable`
 - ~`ToChalk` still exists and gets called, it's just the identity in most cases now (I'll probably clean those up before merging this)~

8423: Bump lsp-types and syn r=kjeremy a=kjeremy

This lsp-types now supports a default InsertTextMode for completion and a per-completion item commit_characters

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
Co-authored-by: kjeremy <kjeremy@gmail.com>
2021-04-08 15:00:53 +00:00
kjeremy
3634b2145c Bump lsp-types and syn
This lsp-types now supports a default InsertTextMode for completion and a per-completion item commit_characters
2021-04-08 10:57:47 -04:00
Laurențiu Nicola
48b946bde1 Reduce allocations in Expand macro 2021-04-08 17:37:43 +03:00
Lukas Wirth
8fa3011908 Use CompletionTextEdit::InsertAndReplace if supported by the client 2021-04-08 15:21:27 +02:00
Florian Diebold
d992736e79 Remove unused 2021-04-08 14:36:14 +02:00
Florian Diebold
8040f4a5e3 Replace make_binders by the now equivalent make_only_type_binders 2021-04-08 14:23:17 +02:00
Florian Diebold
8ce6fea325 Remove identity impls for ToChalk 2021-04-08 14:23:17 +02:00
Florian Diebold
a163554857 Fix Canonicalized::apply_solution
Now that we're using Chalk's `substitute` which actually knows about
lifetimes, the hack doesn't work anymore, but we can put in a proper
lifetime.
2021-04-08 14:23:17 +02:00
Florian Diebold
a838a60caa Fix missing match arms 2021-04-08 14:23:17 +02:00
Florian Diebold
f43edb2151 Fix remaining interned_mut call 2021-04-08 14:08:55 +02:00
Florian Diebold
0f058d61ce Replace remaining fold calls 2021-04-08 14:08:55 +02:00
Florian Diebold
caee3b6c2d Replace some fold calls 2021-04-08 14:08:55 +02:00
Florian Diebold
b25b147e86 Fix shifted_{in,out} calls 2021-04-08 14:08:55 +02:00
Florian Diebold
dc0b581736 Fix subst_prefix 2021-04-08 14:08:55 +02:00
Florian Diebold
5794a090bf Get rid of walk_mut [not compiling] 2021-04-08 14:08:55 +02:00
Florian Diebold
1332e72d09 Fix TyBuilder methods 2021-04-08 14:08:55 +02:00
Florian Diebold
b24e6f6030 Impl Fold for CallableSig 2021-04-08 14:08:55 +02:00
Florian Diebold
7e541e69b1 Add HasInterner bounds 2021-04-08 14:08:55 +02:00
Florian Diebold
926bfef0ef Allow unused 2021-04-08 14:08:55 +02:00
Florian Diebold
e5d294765a Remove obsolete Cast impls 2021-04-08 14:08:54 +02:00
Florian Diebold
429bbbd39a Make ToChalk implementations identity 2021-04-08 14:08:54 +02:00
Florian Diebold
77d974ae6b Replace all the types by their Chalk versions 2021-04-08 14:08:54 +02:00
bors[bot]
855a739ebf
Merge #8207
8207: Show dbg remove assist on empty contents r=edwin0cheng a=ivan770

Closes #8185

Co-authored-by: ivan770 <leshenko.ivan770@gmail.com>
Co-authored-by: ivan770 <ivan@ivan770.me>
2021-04-08 05:46:15 +00:00
Brandon
1ccfd0ceda Fix faulty assertion when extracting function with macro call 2021-04-07 21:43:38 -07:00
Lukas Wirth
4b555ab1d9 Emit folding ranges for multiline array literals 2021-04-08 00:12:11 +02:00
bors[bot]
3191a93185
Merge #8409
8409: Various remaining fixes for Chalk IR move r=flodiebold a=flodiebold

CC #8313

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2021-04-07 18:51:36 +00:00
Florian Diebold
dc116f7ce2 Fix return type of Substitution::interned 2021-04-07 20:50:26 +02:00
Florian Diebold
be0084a0bc InEnvironment::new takes a reference 2021-04-07 20:48:58 +02:00
Florian Diebold
d1b645d236 Make Canonical::new a free-standing function 2021-04-07 20:47:04 +02:00
Florian Diebold
9b4ecd3723 Fix return type of self_type_parameter 2021-04-07 20:41:52 +02:00
Florian Diebold
6777a4975d Move hir_trait_id to extension trait 2021-04-07 20:40:01 +02:00
Florian Diebold
86feac18e8 Change TraitRef::hir_fmt_ext to free-standing function 2021-04-07 20:34:58 +02:00
bors[bot]
6379839c82
Merge #8408
8408: Update `OUT_DIR` diagnostic to match setting r=jonas-schievink a=jonas-schievink

The setting was renamed, so the diagnostic should follow

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-04-07 18:27:03 +00:00
Jonas Schievink
053dac88ca Update OUT_DIR diagnostic to match setting 2021-04-07 20:19:28 +02:00
bors[bot]
834fda0d28
Merge #8388
8388: Autoclose blocks when typing `{` r=jonas-schievink a=jonas-schievink



Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-04-07 18:17:38 +00:00
Florian Diebold
4c35df47e8 Move equals_ctor to TyExt
I'd prefer getting rid of it, but it's used in the impl search and not
super easy to replace there (I think ideally the impl search would do
proper unification, but that's a bit more complicated).
2021-04-07 20:08:50 +02:00
bors[bot]
eb248d85a0
Merge #8402
8402: Remove Ty::substs{_mut} r=flodiebold a=flodiebold

Almost all uses actually only care about ADT substs, so it's better to be explicit. The methods were a bad abstraction anyway since they already didn't include the inner types of e.g. `TyKind::Ref` anymore.

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2021-04-07 15:58:22 +00:00
Florian Diebold
92dcc53f94 Remove Ty::substs{_mut}
Almost all uses actually only care about ADT substs, so it's better to
be explicit. The methods were a bad abstraction anyway since they
already didn't include the inner types of e.g. `TyKind::Ref` anymore.
2021-04-07 17:56:53 +02:00
kjeremy
761a81822a Update crates 2021-04-07 11:39:33 -04:00
Jonas Schievink
d789cf8f31 Document } insertion 2021-04-07 17:19:42 +02:00
Jonas Schievink
39d59fb06f Make better use of stdx::always 2021-04-07 16:44:25 +02:00
Jonas Schievink
3f599ae4ed Rewrite, reparse modified file 2021-04-07 16:38:04 +02:00
Jonas Schievink
17a1011a12 simplify 2021-04-07 16:38:04 +02:00
Jonas Schievink
d75cacc601 Use stdx::always 2021-04-07 16:38:04 +02:00
Jonas Schievink
61e292fab1 Complete braces more aggressively 2021-04-07 16:38:04 +02:00
Jonas Schievink
36cd724b7b Autoclose blocks when typing { 2021-04-07 16:38:04 +02:00
bors[bot]
8e900cb4a1
Merge #8397
8397: Return proper error code when server is loading r=matklad a=ceronman

When requests are made to rust-analyzer and the server is still loading, a response error is returned with the code `ContentModified` and text `"Rust Analyzer is still loading..."`. This error code doesn't seem to be the more appropriate for this situation. Using `ServerNotInitialized` seems better.

As this is such a small change, I have not created an issue for it.

Co-authored-by: Manuel Ceron <manuel.ceron@jetbrains.com>
2021-04-07 12:37:10 +00:00
Manuel Ceron
dbd760010e Return a better error message for when we are waiting for cargo. 2021-04-07 14:33:41 +02:00
Lukas Wirth
c3c8e8225f Free Ty::def_crates 2021-04-07 13:09:31 +02:00
Lukas Wirth
e3a5c15d18 Move Ty::builtin_deref 2021-04-07 13:06:48 +02:00
bors[bot]
a8f1e41f0f
Merge #8394
8394: Infer variants through type aliased enums r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-04-07 09:35:40 +00:00
Lukas Wirth
41563fd612 Infer variants through type aliased enums 2021-04-07 11:31:50 +02:00
Emmanuel Thompson
35bec31bca Add space after lifetime
In macro expansion, this lead to invalid syntax
2021-04-06 23:22:44 -04:00
Jonas Schievink
7c1c0e6fea Collect trait impls inside unnamed consts 2021-04-07 03:33:22 +02:00
Jonas Schievink
f04f38d3d7 nameres: collect unnamed consts 2021-04-07 03:12:40 +02:00
memoryruins
e1e6e3b925 Fix typo 2021-04-06 19:38:59 -04:00
memoryruins
c201cce527 Do not import on the fly during fields of record literal syntax 2021-04-06 18:40:06 -04:00
bors[bot]
a35f7cb635
Merge #8382
8382: Make Fixture docs more accessible and fix small doc issues r=SomeoneToIgnore a=SomeoneToIgnore

Follow up of https://github.com/rust-analyzer/rust-analyzer/pull/8302#discussion_r607054896

Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
2021-04-06 22:23:41 +00:00
Florian Diebold
b03969cda9 Remove SolutionVariables, add ConstrainedSubst analogous to Chalk
... just missing the constraints.
2021-04-06 23:46:32 +02:00
bors[bot]
31d2b3b9cb
Merge #8386
8386: Avoid O(n²) when constructing AttrSourceMap r=jonas-schievink a=jonas-schievink

Brings https://github.com/rust-analyzer/rust-analyzer/issues/8377 down to 2.52s on my machine. Not quite back to where it was before, so I'll leave that issue open for now.

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-04-06 20:26:52 +00:00
Jonas Schievink
035d84558c Avoid O(n²) when constructing AttrSourceMap 2021-04-06 22:25:44 +02:00
Florian Diebold
768ee3e47a Align InferenceVar to Chalk 2021-04-06 21:10:22 +02:00
Florian Diebold
d280538174 Clean up Chalk mapping a bit 2021-04-06 21:10:22 +02:00
Kirill Bulatov
e785672f15 Adjust fixture docs a bit 2021-04-06 21:42:27 +03:00
Jonas Schievink
0d4c931416 Lower attributes on tuple fields 2021-04-06 20:19:53 +02:00
Jonas Schievink
230c763648 infer: remove record_pat_field_resolutions field
Same as https://github.com/rust-analyzer/rust-analyzer/pull/8376, this
can be computed from other data
2021-04-06 19:44:28 +02:00
bors[bot]
e6a1c9ca60
Merge #8371
8371: Don't use HirDisplayWrapper when displaying SourceCode r=matklad a=Veykril

The issue was basically that when displaying for `DisplayTarget::SourceCode` some `hir_fmt` functions would create `HirDisplayWrapper`s which would then `fmt` these triggering the Display panic since `fmt::Display` can't fail the same way as `HirDisplay`. Simple fix is to just use `hir_fmt` directly. Should probably write that down somewhere in source, looking for a good spot to put that right now.

Fixes #8077, Fixes #8370


Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-04-06 16:12:30 +00:00
Jonas Schievink
e9752308bb infer: remove record_field_resolutions field
It stores no useful data, since we can derive all fields from
`variant_resolutions`
2021-04-06 17:59:18 +02:00
bors[bot]
74711deb72
Merge #8375
8375: feat: show errors from `cargo metadata` and initial `cargo check` in the status bar r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-04-06 15:09:38 +00:00
Aleksey Kladov
de33702784 feat: show errors from cargo metadata and initial cargo check in the status bar
closes #3155
2021-04-06 18:08:05 +03:00
Jonas Schievink
a25fbdb30a Intern TypeRefs stored in Body
Minor improvement to memory usage (1 MB or so)
2021-04-06 16:07:45 +02:00
bors[bot]
7d39b13996
Merge #8364
8364: Memory usage improvements r=jonas-schievink a=alexmaco

These are mostly focused on splitting up enum variants with large size differences between variants by `Box`-ing things up.

In my testing this reduces the memory usage somewhere in the low percentages, even though the measurements are quite noisy.

Co-authored-by: Alexandru Macovei <alexnmaco@gmail.com>
2021-04-06 13:43:37 +00:00
bors[bot]
12e86433ab
Merge #8368
8368: Move Ty accessors to TyExt r=flodiebold a=Veykril

CC #8313

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-04-06 13:32:15 +00:00
Aleksey Kladov
9ec5e6e4fd Clearer naming 2021-04-06 16:22:26 +03:00
Alexandru Macovei
4e2a6ac7ea Avoid duplicating VfsPath in vfs::path_interner::PathInterner by using an IndexSet 2021-04-06 16:03:57 +03:00
Alexandru Macovei
32304d14a1 Use Box'es to reduce the size of hir_def::expr::Pat from 112 to 64 bytes on 64bit 2021-04-06 16:01:31 +03:00
Alexandru Macovei
fb1f544e24 Use Box'es to reduce size of hir_def::expr::Expr from 128 to 72 bytes (on 64bit systems)
Rationale: only a minority of variants used almost half the size.
By keeping large members (especially in Option) behind a box
the memory cost is only payed when the large variants are needed.

This reduces the size Vec<Expr> needs to allocate.
2021-04-06 16:01:31 +03:00
bors[bot]
4414071074
Merge #8355
8355: internal: do not drop errors from cargo metadata/check r=matklad a=matklad

Work towards #3155

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-04-06 12:50:25 +00:00
Aleksey Kladov
8fe20b19d4 More robust status notifications 2021-04-06 15:45:31 +03:00
Lukas Wirth
a43409fa43 Panic when creating a HirDisplayWrapper with DisplayTarget::SourceCode 2021-04-06 14:42:34 +02:00
Lukas Wirth
ffdb2da49d Don't use HirDisplayWrapper when displaying SourceCode 2021-04-06 14:21:35 +02:00
Lukas Wirth
bc993bbe85 Remove TyExt::dyn_trait_ref 2021-04-06 13:58:51 +02:00