Commit graph

368 commits

Author SHA1 Message Date
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
Lukas Wirth
d587ca2991 Replace unused hir_ty::Lifetime with chalk equivalents 2021-04-05 20:46:15 +02: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
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
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
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
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
Jonas Schievink
7c0c713a10 Intern GenericParams
Also share the same instance between `ItemTree` and `generic_params`
query.
2021-04-05 03:50:10 +02:00
Jonas Schievink
24e876b52e Intern more TypeRefs in generics
Saves ~3 MB
2021-04-05 02:03:37 +02:00
Florian Diebold
645a9c3a27 Move things from traits module to types as well 2021-04-04 20:27:40 +02:00
Florian Diebold
508a1ecad3 Move things in hir_ty into submodules
- all the types that will be replaced by Chalk go to `types`
 - `TypeWalk` impls go to `walk`
2021-04-04 20:22:00 +02:00
Florian Diebold
cde3857897 Add comment 2021-04-04 13:23:22 +02:00
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
Jonas Schievink
d8bf9bef80 Access a body's block def maps via a method 2021-04-04 03:03:18 +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
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
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]
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
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
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
Jonas Schievink
b00266b79f Global TypeRef/TraitRef interning 2021-04-01 19:46:43 +02:00
Edwin Cheng
6a3f2ce76c Fix block inner item defined in macro 2021-04-01 03:45:21 +08:00