Commit Graph

16246 Commits

Author SHA1 Message Date
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]
4bc8a01830
Merge #8360
8360: Fix shifting of binders in FnPointer r=flodiebold a=flodiebold

 - don't shift in/out for Chalk mapping (we want to have the same binders now)
 - do shift in when creating the signature for a closure (though it shouldn't matter much)
 - do shift in when lowering a `fn()` type
 - correctly deal with the implied binder in TypeWalk

Tested with the binders validator on various repos, so I'm pretty sure this doesn't mess things up 😬 

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2021-04-05 21:03:01 +00:00
Florian Diebold
1ae967bf8e Fix shifting of binders in FnPointer
- don't shift in/out for Chalk mapping (we want to have the same
   binders now)
 - do shift in when creating the signature for a closure (though it
   shouldn't matter much)
 - do shift in when lowering a `fn()` type
 - correctly deal with the implied binder in TypeWalk
2021-04-05 23:00:50 +02:00
bors[bot]
7ce0e9c9ca
Merge #8358
8358: Align FnPointer with Chalk r=flodiebold a=flodiebold

CC #8313

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2021-04-05 20:25:13 +00:00
Florian Diebold
edc59d897d Align FnPointer with Chalk 2021-04-05 22:23:30 +02:00
bors[bot]
f25c1e7c6a
Merge #8356
8356: Align more methods to Chalk r=flodiebold a=flodiebold

Related to #8313.

Move some inherent methods that don't exist in Chalk to an extension trait, remove some others.

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2021-04-05 19:59:25 +00:00
Florian Diebold
b67148daea Substitution::prefix -> subst_prefix
I probably want to get rid of this function completely later.
2021-04-05 21:58:53 +02:00
Florian Diebold
2a83645e1b Get rid of Substitution::suffix 2021-04-05 21:58:03 +02:00
Florian Diebold
b443e5304e Remove some unused methods, move some to types.rs 2021-04-05 21:58:03 +02:00
Florian Diebold
738174671a Binders::wrap_empty -> wrap_empty_binders 2021-04-05 21:58:03 +02:00
Florian Diebold
2f5a77658b Substitution::single -> from1 2021-04-05 21:58:03 +02:00
Florian Diebold
788533d380 Move ProjectionTy methods to extension trait 2021-04-05 21:58:01 +02:00
bors[bot]
8c96a7d81e
Merge #8353
8353: Replace hir_ty::Lifetime with chalk equivalent r=flodiebold a=Veykril

Our `Lifetime` isn't really used yet so this is a rather simple change

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-04-05 19:34:50 +00:00
bors[bot]
72781085bb
Merge #8352
8352: Remove dead legacy macro expansion code r=lnicola a=brandondong

I was investigating some unrelated macro issue when I noticed this dead code. This legacy macro expansion logic was changed in https://github.com/rust-analyzer/rust-analyzer/pull/8128.

Co-authored-by: Brandon <brandondong604@hotmail.com>
2021-04-05 19:00:27 +00:00
Brandon
4dbec2d545 Remove dead legacy macro expansion code 2021-04-05 11:47:06 -07:00
Lukas Wirth
d587ca2991 Replace unused hir_ty::Lifetime with chalk equivalents 2021-04-05 20:46:15 +02:00
bors[bot]
453f2360d3
Merge #8351
8351: Use more assoc. type aliases in the chalk interner r=flodiebold a=jonas-schievink

Makes it sligthly easier to swap out these types

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-04-05 18:38:32 +00:00
Jonas Schievink
f48dd154a5 Use more assoc. type aliases in the chalk interner
Makes it sligthly easier to swap out these types
2021-04-05 20:15:07 +02:00
bors[bot]
87e56eb94c
Merge #8350
8350: internal: prepare to store OpQueue results in the queue itself r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-04-05 17:49:48 +00:00
Aleksey Kladov
7099438e0c internal: prepare to store OpQueue results in the queue itself 2021-04-05 20:49:00 +03:00
bors[bot]
c91b537683
Merge #8348
8348: Make `Binders` more like Chalk r=flodiebold a=flodiebold

Working towards #8313.
 - hide `value`
 - use `VariableKinds`
 - adjust `subst` to be like Chalk's `substitute`
 - also clean up some other `TypeWalk` stuff to prepare for it being replaced by Chalk's `Fold`

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2021-04-05 17:25:19 +00:00
Florian Diebold
a316d58360 Rename shift_bound_vars{_out} to align with Chalk 2021-04-05 19:21:03 +02:00
Florian Diebold
fbab69cbff Get rid of subst_bound_vars uses 2021-04-05 19:21:03 +02:00
Florian Diebold
e28f0c98ba Get rid of some walk_mut uses 2021-04-05 19:21:03 +02:00
Florian Diebold
30a339e038 Add Interner parameter to Binders::substitute 2021-04-05 19:21:01 +02:00
Florian Diebold
05eba0db3d Binders::subst -> substitute 2021-04-05 19:20:28 +02:00
Florian Diebold
ad20f00844 Use VariableKinds in Binders 2021-04-05 19:19:18 +02:00
Florian Diebold
69714d36e6 Hide Binders internals more 2021-04-05 19:19:18 +02:00
bors[bot]
467a5c6cd1
Merge #8347
8347: Minor interning improvements r=jonas-schievink a=jonas-schievink

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-04-05 17:17:07 +00:00
bors[bot]
6e9798a992
Merge #8346
8346: Use arrayvec 0.7 to avoid perf regression in 0.6.1 r=lnicola a=kjeremy

See: https://github.com/bluss/arrayvec/issues/182

Co-authored-by: kjeremy <kjeremy@gmail.com>
2021-04-05 17:05:30 +00:00
kjeremy
b246f57fad Use arrayvec 0.7 to avoid perf regression in 0.6.1
See: https://github.com/bluss/arrayvec/issues/182
2021-04-05 12:58:35 -04:00
bors[bot]
013cc7dd8b
Merge #8344
8344: Pass interner to `ProjectionTy::self_type_parameter` and `TraitRef::self_type_parameter` r=flodiebold a=lnicola

CC #8313

changelog skip

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-04-05 15:47:09 +00:00
Jonas Schievink
b57462d60d Interned<T>: Only hash the pointer 2021-04-05 17:07:53 +02:00
Jonas Schievink
a0b50bcf1e Make impl_internable! macro public 2021-04-05 16:59:13 +02:00
Laurențiu Nicola
d7546d8c23 Pass interner to TraitRef::self_type_parameter 2021-04-05 17:38:37 +03:00
Laurențiu Nicola
aefcbf2758 Pass interner to ProjectionTy::self_type_parameter 2021-04-05 17:37:24 +03:00
bors[bot]
fab1c06646
Merge #8343
8343: internal: document hypothetical completion problem r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-04-05 13:28:32 +00:00
Aleksey Kladov
1f00191de2 internal: document hypothetical completion problem 2021-04-05 16:27:45 +03:00
bors[bot]
8a18f23df0
Merge #8342
8342: Rename `TyKind::Unknown` and `TyKind::ForeignType` (Chalk move) r=flodiebold a=lnicola

CC #8313

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-04-05 13:05:35 +00:00
Laurențiu Nicola
72c54c53cd Rename TyKind::ForeignType to Foreign 2021-04-05 15:39:06 +03:00
Laurențiu Nicola
65c2e51940 Rename TyKind::Unknown to Error 2021-04-05 15:39:06 +03:00
bors[bot]
c2be91dcd8
Merge #8245
8245: Properly resolve intra doc links in hover and goto_definition r=matklad a=Veykril

Unfortunately involves a bit of weird workarounds due to pulldown_cmark's incorrect lifetimes on `BrokenLinkCallback`... I should probably open an issue there asking for the fixes to be pushed to a release since they already exist in the repo for quite some time it seems.

Fixes #8258, Fixes #8238

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-04-05 12:30:20 +00:00
bors[bot]
d8ee25bb97
Merge #8339
8339: fix: extract variable works in guards r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-04-05 12:19:25 +00:00
Aleksey Kladov
30d6419bc9 fix: extract variable works in guards
closes #8336
2021-04-05 14:40:56 +03:00
bors[bot]
4a589b1c3a
Merge #8326
8326: Rewrite reorder fields assist to use mutable syntax trees r=matklad a=Veykril

This also instead uses `Either` to use the typed `RecordPat` and `RecordExpr` nodes, this unfortunately gives a bit of code duplication

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-04-05 11:23:12 +00:00
bors[bot]
9bf7ca59e9
Merge #8337
8337: internal: explain "extract if condition" refactoring r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-04-05 10:04:28 +00:00
Aleksey Kladov
a01fd1af19 internal: explain "extract if condition" refactoring 2021-04-05 13:02:47 +03:00
bors[bot]
58924cfae1
Merge #8334
8334: Intern and shrink more data to reduce memory usage r=jonas-schievink a=jonas-schievink

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-04-05 02:29:09 +00:00
Jonas Schievink
6f1ee9a7f4 simplify visibility.rs 2021-04-05 04:27:57 +02:00