Jonas Schievink
ea8555b155
Simplify eager macro representation
2021-05-19 20:19:08 +02:00
bors[bot]
a57bd59f35
Merge #8813
...
8813: Get some more array lengths! r=lf- a=lf-
This is built on #8799 and thus contains its changes. I'll rebase it onto master when that one gets merged. It adds support for r-a understanding the length of:
* `let a: [u8; 2] = ...`
* `let a = b"aaa"`
* `let a = [0u8; 4]`
I have added support for getting the values of byte strings, which was not previously there. I am least confident in the correctness of this part and it probably needs some more tests, as we currently have only one test that exercised that part (!).
Fixes #2922 .
Co-authored-by: Jade <software@lfcode.ca>
2021-05-16 01:53:12 +00:00
Jade
de0ed9860d
Address final feedback
...
* rename ConstExtension->ConstExt
* refactor a manual construction of a Const
2021-05-15 18:51:18 -07:00
Jade
78d6b88f21
Add more tests, refactor array lengths/consteval work
...
Fix #2922 : add unknown length as a condition for a type having unknown.
Incorporate reviews:
* Extract some of the const evaluation workings into functions
* Add fixmes on the hacks
* Add tests for impls on specific array lengths (these work!!! 😁 )
* Add tests for const generics (indeed we don't support it yet)
2021-05-14 01:39:28 -07:00
hi-rustin
b98c119ba6
Apply async semantic token modifier to async/await keywords
...
Only async semantic token modifier
2021-05-14 10:47:00 +08:00
Lukas Wirth
41f470fea8
Correctly support SelfType when searching for usages
2021-05-08 22:34:55 +02:00
Aleksey Kladov
53f7149d45
internal: expose cfg attrs from hir::Crate
2021-05-07 23:50:24 +03:00
bors[bot]
a8da2ca3a1
Merge #8745
...
8745: Support goto_type_definition for types r=matklad a=Veykril
I'm unsure if the approach of lowering an `ast::Type` to a `hir::Type` is a good idea, it seems fine to me at least.
Fixes #2882
Co-authored-by: Lukas Tobias Wirth <lukastw97@gmail.com>
2021-05-06 22:28:35 +00:00
Jonas Schievink
20ae41c1a1
Reuse database in LowerCtx
2021-05-06 23:23:50 +02:00
Jonas Schievink
976a3226fe
Don't store call-site text offsets in hygiene info
2021-05-06 19:59:54 +02:00
Lukas Tobias Wirth
d97a4b8e49
Support goto_type_definition for types
2021-05-06 17:05:49 +02:00
Lukas Tobias Wirth
3f796fea9f
simplify
2021-05-05 22:55:12 +02:00
Aleksey Kladov
1a01a5ae19
internal: fix naming polarity
...
Type Constructors have *parameters*, when they are substituted with type
*arguments*, we have a type.
2021-04-30 11:55:59 +03:00
Aleksey Kladov
cb3ef552e8
internal: normalize name
...
All def types in hir are unsubstituted
2021-04-30 11:52:31 +03:00
cynecx
28ef7c20d7
hir_ty: deal with TypeRef::Macro in HirFormatter
2021-04-17 16:24:56 +02:00
cynecx
cf3b4f1e20
hir_ty: Expand macros at type position
2021-04-17 16:24:56 +02:00
Kirill Bulatov
739edfd5cf
Exclude inherent traits from flyimports
2021-04-16 11:13:17 +03:00
Florian Diebold
fdd721e9ef
Improve indexing of impls
...
Store impls for e.g. &Foo with the ones for Foo instead of the big
"other" bucket. This can improve performance and simplifies the HIR impl
search a bit.
2021-04-09 11:21:31 +02:00
Florian Diebold
be03db0e3a
Intern Substitutions
...
(Costs a bit of performance, reduces memory usage on RA by ~10%.)
2021-04-08 22:48:47 +02:00
Florian Diebold
a838a60caa
Fix missing match arms
2021-04-08 14:23:17 +02:00
Florian Diebold
be0084a0bc
InEnvironment::new takes a reference
2021-04-07 20:48:58 +02:00
Florian Diebold
d1b645d236
Make Canonical::new a free-standing function
2021-04-07 20:47:04 +02:00
Florian Diebold
6777a4975d
Move hir_trait_id to extension trait
2021-04-07 20:40:01 +02:00
Florian Diebold
92dcc53f94
Remove Ty::substs{_mut}
...
Almost all uses actually only care about ADT substs, so it's better to
be explicit. The methods were a bad abstraction anyway since they
already didn't include the inner types of e.g. `TyKind::Ref` anymore.
2021-04-07 17:56:53 +02:00
Lukas Wirth
c3c8e8225f
Free Ty::def_crates
2021-04-07 13:09:31 +02:00
Florian Diebold
b03969cda9
Remove SolutionVariables
, add ConstrainedSubst analogous to Chalk
...
... just missing the constraints.
2021-04-06 23:46:32 +02:00
Jonas Schievink
230c763648
infer: remove record_pat_field_resolutions
field
...
Same as https://github.com/rust-analyzer/rust-analyzer/pull/8376 , this
can be computed from other data
2021-04-06 19:44:28 +02:00
Jonas Schievink
e9752308bb
infer: remove record_field_resolutions
field
...
It stores no useful data, since we can derive all fields from
`variant_resolutions`
2021-04-06 17:59:18 +02:00
Lukas Wirth
9b4699a9be
Move Ty accessors to TyExt
2021-04-06 13:58:48 +02:00
Lukas Wirth
9fbba7bc45
Add chalk_ir::Const to TyKind::Array
2021-04-06 11:45:41 +02:00
Lukas Wirth
96756f1b1d
Add Lifetime to TyKind::Ref
2021-04-06 10:45:30 +02: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
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
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
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
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
ebdfc932e7
Replace Substitution::type_params
2021-04-04 13:16:39 +02:00
Florian Diebold
5d2b488aeb
Replace remaining uses of Substitution::build_for_def
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
Jonas Schievink
613f9ea41e
Glob-reexport hir_def database types
2021-04-04 01:29:59 +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
Lukas Wirth
9fe10a9606
Resolve associated types with type anchors
2021-04-01 21:52:07 +02:00