Commit graph

16149 commits

Author SHA1 Message Date
Jonas Schievink
f774a56af2 Use exhaustive matches in shrink_to_fit impls 2021-04-04 02:56:11 +02:00
bors[bot]
234ddf34c7
Merge #8320
8320: Make `ast_to_token_tree` infallible r=jonas-schievink a=jonas-schievink

It could never return `None`, so reflect that in the return type

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-04-03 23:47:10 +00:00
Jonas Schievink
3abcdc03ba Make ast_to_token_tree infallible
It could never return `None`, so reflect that in the return type
2021-04-04 01:46:45 +02:00
bors[bot]
bcf600fc88
Merge #8319
8319: Glob-reexport hir_def database types r=jonas-schievink a=jonas-schievink

Avoids having to constantly adjust this list

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-04-03 23:30:41 +00:00
Jonas Schievink
613f9ea41e Glob-reexport hir_def database types 2021-04-04 01:29:59 +02:00
bors[bot]
a3dc04905b
Merge #8318
8318: Use shrink_to_fit to reduce DefMap sizes r=jonas-schievink a=jonas-schievink

Especially `block_def_map` can overallocate when there's not a lot of items in the `DefMap`. This saves around 10 MB during analysis-stats. Not too much, but a cheap win.

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-04-03 21:47:39 +00:00
Jonas Schievink
d1bce6070d Use shrink_to_fit to reduce DefMap sizes 2021-04-03 23:45:27 +02:00
bors[bot]
b78f1a0a4d
Merge #8315
8315: Try to reduce ItemTree size further r=jonas-schievink a=jonas-schievink

This was mostly a failed experiment, but still seems like the right thing to do. Memory reduction is mostly negligible.

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-04-03 19:01:03 +00:00
Jonas Schievink
ee4b5a34d8 Use bitflags to compress function properties
Very minor savings, only 1 MB or so
2021-04-03 20:58:42 +02:00
Jonas Schievink
f7e6b186e1 Intern ModPath in Import
Minor savings only
2021-04-03 20:57:25 +02:00
bors[bot]
e2213a503e
Merge #8312
8312: cargo update r=kjeremy a=kjeremy



Co-authored-by: Jeremy Kolb <kjeremy@gmail.com>
2021-04-03 16:18:44 +00:00
Jeremy Kolb
c7a664c2ea cargo update 2021-04-03 12:18:00 -04:00
bors[bot]
2f87ee7f3f
Merge #8310
8310: Rename Ty::interned to Ty::kind r=flodiebold a=flodiebold

... since that's the actual method on Chalk side that matches the signature.

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2021-04-03 11:09:43 +00:00
Florian Diebold
c551604b5a Rename Ty::interned to Ty::kind
... since that's the actual method on Chalk side that matches the signature.
2021-04-03 13:08:29 +02:00
bors[bot]
8289b96216
Merge #8309
8309: Introduce `GenericArg` like in Chalk r=flodiebold a=flodiebold

Plus some more adaptations to Substitution.

Lots of `assert_ty_ref` that we should revisit when introducing lifetime/const parameters.

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2021-04-03 09:19:55 +00:00
Florian Diebold
e480d81988 Introduce GenericArg like in Chalk
Plus some more adaptations to Substitution.

Lots of `assert_ty_ref` that we should revisit when introducing
lifetime/const parameters.
2021-04-03 11:17:13 +02:00
bors[bot]
327f3a0a30
Merge #8307
8307: Allow include! an empty content file r=edwin0cheng a=edwin0cheng

fixes #8306

bors r+

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2021-04-03 04:55:39 +00:00
Edwin Cheng
20d55ce44d Allow include! an empty content file 2021-04-03 12:50:55 +08:00
bors[bot]
b5804296dd
Merge #8305
8305: Fix joinLines panic if run on the empty last line r=edwin0cheng a=edwin0cheng

fixes #8299

bors r+

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2021-04-03 03:21:45 +00:00
Edwin Cheng
b636080f67 Fix joinLines panic if run on the empty last line 2021-04-03 11:20:16 +08:00
bors[bot]
bf695c487a
Merge #8304
8304: Support the new `panic!()` macro r=jonas-schievink a=jonas-schievink

Includes a minor fixup to macro 2.0 parsing.

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-04-03 01:14:56 +00:00
Jonas Schievink
5742cdf3f1 Support #[rustc_builtin_macro = "builtin_name"] 2021-04-03 03:13:04 +02:00
Jonas Schievink
6198eb74b2 Implement edition-dependent builtin panic! macro 2021-04-03 03:12:55 +02:00
Jonas Schievink
eaffdae300 Allow , to delimit macro 2.0 rules 2021-04-03 03:08:31 +02:00
bors[bot]
eb264fb819
Merge #8303
8303: Allow interning strings r=jonas-schievink a=jonas-schievink

We don't use it yet, that's a bit more complicated.

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-04-03 00:09:41 +00:00
Jonas Schievink
85757be59a Allow interning strings 2021-04-03 01:00:45 +02:00
bors[bot]
8e3e13f3a4
Merge #8298
8298: Stop using an upgradeable read lock in interning r=jonas-schievink a=jonas-schievink

Only one upgradeable read lock can be handed out at the same time, and
we never acquire a non-upgradeable read lock, so this has no benefit
over just using a write lock in the first place.

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-04-02 18:47:25 +00:00
Jonas Schievink
e73d26fa62 Stop using an upgradeable read lock in interning
Only one upgradeable read lock can be handed out at the same time, and
we never acquire a non-upgradeable read lock, so this has no benefit
over just using a write lock in the first place.
2021-04-02 20:46:37 +02:00
bors[bot]
0129628a0f
Merge #8297
8297: Only populate prelude for crate-level DefMaps r=jonas-schievink a=jonas-schievink

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

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-04-02 17:00:57 +00:00
Jonas Schievink
7ceaba21df Only populate prelude for crate-level DefMaps 2021-04-02 19:00:26 +02:00
bors[bot]
f4d56989b6
Merge #8284
8284: Reduce memory usage by using global `Arc`-based interning r=jonas-schievink a=jonas-schievink

This saves around 50 mb when running `analysis-stats` on r-a itself. Not a lot, but this infra can be easily reused to intern more stuff.

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-04-02 16:43:16 +00:00
bors[bot]
9bcdbefc7b
Merge #8291
8291: Put the revision in the startup message r=jonas-schievink a=lf-



Co-authored-by: Jade <software@lfcode.ca>
2021-04-02 16:35:22 +00:00
Jonas Schievink
6e227b80a7 Remove ?Sized on PartialEq/Eq impls 2021-04-02 18:26:34 +02:00
Jonas Schievink
76452956e4 Split Intern::drop into hot and cold path 2021-04-02 18:11:08 +02:00
bors[bot]
d619070b83
Merge #8287
8287: Don't allocate in `associated_type_shorthand_candidates` r=Veykril a=Veykril



Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-04-02 14:41:24 +00:00
Lukas Wirth
c24753ae5d Don't allocate in associated_type_shorthand_candidates 2021-04-02 16:40:31 +02:00
bors[bot]
2c5f905c67
Merge #8294
8294: minor: add profile call for resolve_obligations r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-04-02 12:30:02 +00:00
Aleksey Kladov
387d7c7d96 minor: add profile call for resolve_obligations 2021-04-02 15:28:51 +03:00
bors[bot]
71ef64b673
Merge #8293
8293: internal: document style for helper functions and variables r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-04-02 12:00:30 +00:00
Aleksey Kladov
636c3c49d2 internal: document style for helper functions and variables 2021-04-02 14:52:00 +03:00
bors[bot]
00ce7ae524
Merge #8285
8285: Don't recheck obligations if we have learned nothing new r=matklad a=flodiebold

This is just the most trivial check: If no inference variables have been updated, and there are no new obligations, we can just skip trying to solve them again. We could be smarter about it, but this already helps quite a bit, and I don't want to touch this too much before we replace the inference table by Chalk's.

Fixes #8263 (well, improves it quite a bit).

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2021-04-02 11:25:40 +00:00
bors[bot]
a0b3eb7135
Merge #8292
8292: internal: document Cargo.lock maintenance process r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-04-02 11:00:39 +00:00
Aleksey Kladov
27b779d1fd internal: document Cargo.lock maintenance process 2021-04-02 13:59:36 +03:00
Jade
feae14be11 Put the revision in the logged startup message 2021-04-02 02:53:56 -07:00
bors[bot]
ea8feca31a
Merge #8265
8265: Improve rustc diagnostic mapping r=jonas-schievink a=jonas-schievink

Try to mirror rustc diagnostics more closely by:

* Emitting hint-level diagnostics at *all* macro invocation sites that caused the diagnostic
  * Previously we emitted a copy of the diagnostic (not at hint level) at the last macro invocation site only
* Emitting the original diagnostic inside the macro, if it was caused by a macro
* Always including related information pointing to the invocation site or the macro, respectively (the old code contained a bug that would sometimes omit it)

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


![screenshot-2021-03-30-19:34:56](https://user-images.githubusercontent.com/1786438/113031484-1266a600-918f-11eb-9164-fed01c8ba37e.png)
![screenshot-2021-03-30-19:35:10](https://user-images.githubusercontent.com/1786438/113031486-12ff3c80-918f-11eb-8f15-9d7f23b69653.png)


Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
2021-04-01 21:22:11 +00:00
bors[bot]
5ef0c7a213
Merge #8283
8283: Resolve associated types r=flodiebold a=Veykril

Prior we were only resolving paths until the first type was found, then discarding the result if the path wasn't fully consumed. That of course causes associated types to not resolve. Fixes #5003

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-04-01 21:11:06 +00:00
bors[bot]
1c936dcbe1
Merge #8286
8286: Include remaining memory in memory usage stats r=jonas-schievink a=jonas-schievink

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-04-01 21:01:39 +00:00
Jonas Schievink
0a8274dd46 Include remaining memory in memory usage stats 2021-04-01 23:01:07 +02:00
Jonas Schievink
afd83e0686 Remove unnecessary region, relax Sized bounds 2021-04-01 22:24:40 +02:00
Lukas Wirth
9fe10a9606 Resolve associated types with type anchors 2021-04-01 21:52:07 +02:00