Commit graph

16316 commits

Author SHA1 Message Date
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]
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
bors[bot]
062c8eb7ca
Merge #8401
8401: Update crates r=kjeremy a=kjeremy



Co-authored-by: kjeremy <kjeremy@gmail.com>
2021-04-07 15:41:25 +00:00
kjeremy
761a81822a Update crates 2021-04-07 11:39:33 -04: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
bors[bot]
45510ae23d
Merge #8396
8396: Uncouple Ty::builtin_deref and Ty::def_crates from Ty r=Veykril a=Veykril

bors r+
CC #8313

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-04-07 11:18:20 +00: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
bors[bot]
ad50f5007f
Merge #8392
8392: Add space after lifetime in expand macro r=edwin0cheng a=sharksforarms

When a lifetime is followed by an ident, this lead to invalid syntax. This adds a whitespace between the lifetime and the identifier.

Noticed this here: https://github.com/simrat39/rust-tools.nvim/issues/2#issuecomment-814551847

Co-authored-by: Emmanuel Thompson <eet6646@gmail.com>
2021-04-07 03:54:28 +00:00
Emmanuel Thompson
35bec31bca Add space after lifetime
In macro expansion, this lead to invalid syntax
2021-04-06 23:22:44 -04:00
bors[bot]
cf41e1410a
Merge #8390
8390: Support trait impls in unnamed consts r=jonas-schievink a=jonas-schievink

Fixes https://github.com/rust-analyzer/rust-analyzer/issues/7550

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-04-07 01:35:00 +00: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
bors[bot]
3e7ac2b830
Merge #8389
8389: Do not import on the fly during fields of record literal syntax r=SomeoneToIgnore a=memoryruins

When only fields are relevant during record literal syntax (`Foo { field_$0 }`), RA already avoids completions of in-scope items, but with `rust-analyzer.completion.enableAutoimportCompletions` enabled, more than field names were eagerly suggested. This PR adds a case to `import_on_the_fly` to avoid the extra completions in this context.

Closes #8300

Co-authored-by: memoryruins <memoryruinsmusic@gmail.com>
2021-04-06 23:47:39 +00: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
bors[bot]
fcb22a674d
Merge #8387
8387: Remove `SolutionVariables`, add ConstrainedSubst analogous to Chalk r=flodiebold a=flodiebold

... just missing the constraints.

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2021-04-06 21:49:10 +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
bors[bot]
1643d1534b
Merge #8385
8385: Align `InferenceVar` to Chalk r=flodiebold a=flodiebold



Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2021-04-06 19:11:41 +00: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
bors[bot]
5df65e5066
Merge #8383
8383: Update Zulip URL r=lnicola a=lnicola

bors r+

changelog skip

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-04-06 18:49:42 +00:00
Laurențiu Nicola
693c516ff2 Update Zulip URL 2021-04-06 21:49:15 +03:00
Kirill Bulatov
e785672f15 Adjust fixture docs a bit 2021-04-06 21:42:27 +03:00
Kirill Bulatov
b5f3815aee Small grammar fixes 2021-04-06 21:42:27 +03:00
Kirill Bulatov
d5bedf8d6d Update Zulip link and macro privacy statement 2021-04-06 21:42:27 +03:00
bors[bot]
428cf21143
Merge #8379
8379: internal: document broken windows r=jonas-schievink a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-04-06 18:29:46 +00:00
bors[bot]
bf11781ec9
Merge #8381
8381: Lower attributes on tuple fields r=jonas-schievink a=jonas-schievink

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-04-06 18:20:38 +00:00
Jonas Schievink
0d4c931416 Lower attributes on tuple fields 2021-04-06 20:19:53 +02:00
bors[bot]
52c0ecb982
Merge #8380
8380: infer: remove `record_pat_field_resolutions` field r=jonas-schievink a=jonas-schievink

Same as https://github.com/rust-analyzer/rust-analyzer/pull/8376, this
can be computed from other data

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-04-06 17:44:58 +00: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
Aleksey Kladov
658776d4ed internal: document broken windows 2021-04-06 20:11:42 +03: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
bors[bot]
7dd7017547
Merge #8376
8376: infer: remove `record_field_resolutions` field r=flodiebold a=jonas-schievink

It stores no useful data, since we can derive all fields from
`variant_resolutions`

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-04-06 16:02:39 +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
bors[bot]
8e768a5a1f
Merge #8374
8374: Intern TypeRefs stored in Body r=jonas-schievink a=jonas-schievink

Minor improvement to memory usage (1 MB or so)

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-04-06 14:08:20 +00: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