Commit graph

16241 commits

Author SHA1 Message Date
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
Florian Diebold
0e8c4503bf Don't recheck obligations if we have learned nothing new
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).
2021-04-01 21:45:44 +02:00
Lukas Wirth
444f6caaba Resolve associated types 2021-04-01 21:31:25 +02:00
Jonas Schievink
39d992ef55 Intern Attr, MacroCall and Path components 2021-04-01 20:35:21 +02:00
Jonas Schievink
b00266b79f Global TypeRef/TraitRef interning 2021-04-01 19:46:43 +02:00
Jonas Schievink
608a4653a3 Check for and skip dummy macro files 2021-04-01 15:51:34 +02:00
Jonas Schievink
066330e953 Adjust message when pointing at location in macro 2021-04-01 14:44:20 +02:00
bors[bot]
25201b2dad
Merge #8274
8274: Adding a few more gifs and screenshots for features in manual r=Veykril a=MozarellaMan

Related  #8267,#6539. Gifs are [here](https://github.com/rust-analyzer/rust-analyzer/issues/6539#issuecomment-809574840)

Finishing up the last PR,  for the last two features that didn't have a visual example. 

For syntax highlighting, I wasn't able to find a theme that displayed the difference between an enum and struct, but I only tried a few apart from the default so there could be one out there! 

e.g., with the default light theme, `Ord` and `Ordering` in `use std::cmp::{Ord, Ordering}` had the same highlight colour. So I just went with displaying `mut` items being underlined.


Co-authored-by: Ayomide Bamidele <48062697+MozarellaMan@users.noreply.github.com>
2021-04-01 00:01:40 +00:00
bors[bot]
3dbd8b5e7c
Merge #8276
8276: Fix block inner item defined in macro r=jonas-schievink a=edwin0cheng

Fixes  #8229

r? @jonas-schievink 

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2021-03-31 19:56:01 +00:00
Edwin Cheng
6a3f2ce76c Fix block inner item defined in macro 2021-04-01 03:45:21 +08:00
Ayomide Bamidele
7bea1d8bfe Additional syntax highlighting screenshot in manual 2021-03-31 18:45:15 +01:00
Jonas Schievink
7c87e49638 Search for a suitable primary location 2021-03-31 17:50:19 +02:00
Ayomide Bamidele
4296cc3318 Gif of "let = " typing assist 2021-03-31 16:39:04 +01:00
Ayomide Bamidele
d82176c146 Gifs and screenshots for features in manual (syntax highlighting and typing) 2021-03-31 16:20:54 +01:00