Commit graph

10724 commits

Author SHA1 Message Date
Florian Diebold
ebdfc932e7 Replace Substitution::type_params 2021-04-04 13:16:39 +02:00
Florian Diebold
a4d7bdf1c8 Replace Substitution::bound_vars and ::type_params_for_generics 2021-04-04 13:16:39 +02:00
Florian Diebold
715c178f0b Move TyBuilder to its own module 2021-04-04 13:16:39 +02:00
Florian Diebold
584d1c9e5b Replace last uses of SubstsBuilder by TyBuilder 2021-04-04 13:16:39 +02:00
Florian Diebold
505ca65216 Remove CallableSig::from_substs 2021-04-04 13:16:39 +02:00
Florian Diebold
ac8fee006a Use TyBuilder in another place 2021-04-04 13:16:38 +02:00
Florian Diebold
eaa03ef446 Some more TyBuilder use 2021-04-04 13:16:38 +02:00
Florian Diebold
5d2b488aeb Replace remaining uses of Substitution::build_for_def 2021-04-04 13:16:38 +02:00
Florian Diebold
77333a571f More TyBuilder use 2021-04-04 13:16:38 +02:00
Florian Diebold
66fec39aa0 More TyBuilder use 2021-04-04 13:16:38 +02:00
Florian Diebold
cd227f581e Add and start using TraitRef and ProjectionTy builders 2021-04-04 13:16:38 +02:00
Florian Diebold
2ead65190e Move Ty::builtin to TyBuilder 2021-04-04 13:16:38 +02:00
Florian Diebold
620769f322 Add TyBuilder::adt 2021-04-04 13:16:38 +02:00
Florian Diebold
e6f007d9a8 Move Ty::fn_ptr to TyBuilder 2021-04-04 13:16:38 +02:00
Florian Diebold
b0fe3d929f Add TyBuilder::unit() and TyExt::is_unit() 2021-04-04 13:16:38 +02:00
Florian Diebold
b15152c430 Add TyBuilder 2021-04-04 13:16:38 +02:00
bors[bot]
c9bcbf9a43
Merge #8324
8324: Add `Body::shrink_to_fit` r=jonas-schievink a=jonas-schievink

Saves ~15 MB

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-04-04 01:27:14 +00:00
Jonas Schievink
1da6d0bed9 Add Body::shrink_to_fit 2021-04-04 03:26:16 +02:00
Jonas Schievink
9b13e1bb91 Only remember blocks that have a DefMap 2021-04-04 03:16:26 +02:00
bors[bot]
4c8ee9a531
Merge #8322
8322: Access a body's block def maps via a method r=jonas-schievink a=jonas-schievink

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-04-04 01:04:44 +00:00
Jonas Schievink
d8bf9bef80 Access a body's block def maps via a method 2021-04-04 03:03:18 +02:00
Jonas Schievink
f774a56af2 Use exhaustive matches in shrink_to_fit impls 2021-04-04 02:56:11 +02: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
Jonas Schievink
613f9ea41e Glob-reexport hir_def database types 2021-04-04 01:29:59 +02:00
Jonas Schievink
d1bce6070d Use shrink_to_fit to reduce DefMap sizes 2021-04-03 23:45:27 +02: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
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
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
Edwin Cheng
20d55ce44d Allow include! an empty content file 2021-04-03 12:50:55 +08:00
Edwin Cheng
b636080f67 Fix joinLines panic if run on the empty last line 2021-04-03 11:20:16 +08: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
Jonas Schievink
85757be59a Allow interning strings 2021-04-03 01:00:45 +02: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
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
Aleksey Kladov
387d7c7d96 minor: add profile call for resolve_obligations 2021-04-02 15:28:51 +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
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
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