]>
git.lizzy.rs Git - rust.git/log
Florian Diebold [Mon, 5 Apr 2021 20:32:58 +0000 (22:32 +0200)]
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
Florian Diebold [Mon, 5 Apr 2021 20:23:16 +0000 (22:23 +0200)]
Align FnPointer with Chalk
bors[bot] [Mon, 5 Apr 2021 19:59:25 +0000 (19:59 +0000)]
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>
Florian Diebold [Mon, 5 Apr 2021 19:56:40 +0000 (21:56 +0200)]
Substitution::prefix -> subst_prefix
I probably want to get rid of this function completely later.
Florian Diebold [Mon, 5 Apr 2021 19:49:27 +0000 (21:49 +0200)]
Get rid of Substitution::suffix
Florian Diebold [Mon, 5 Apr 2021 19:29:20 +0000 (21:29 +0200)]
Remove some unused methods, move some to types.rs
Florian Diebold [Mon, 5 Apr 2021 19:25:40 +0000 (21:25 +0200)]
Binders::wrap_empty -> wrap_empty_binders
Florian Diebold [Mon, 5 Apr 2021 19:17:35 +0000 (21:17 +0200)]
Substitution::single -> from1
Florian Diebold [Mon, 5 Apr 2021 19:14:49 +0000 (21:14 +0200)]
Move ProjectionTy methods to extension trait
bors[bot] [Mon, 5 Apr 2021 19:34:50 +0000 (19:34 +0000)]
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>
bors[bot] [Mon, 5 Apr 2021 19:00:27 +0000 (19:00 +0000)]
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>
Brandon [Mon, 5 Apr 2021 18:47:06 +0000 (11:47 -0700)]
Remove dead legacy macro expansion code
Lukas Wirth [Mon, 5 Apr 2021 18:46:15 +0000 (20:46 +0200)]
Replace unused hir_ty::Lifetime with chalk equivalents
bors[bot] [Mon, 5 Apr 2021 18:38:32 +0000 (18:38 +0000)]
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>
Jonas Schievink [Mon, 5 Apr 2021 18:15:07 +0000 (20:15 +0200)]
Use more assoc. type aliases in the chalk interner
Makes it sligthly easier to swap out these types
bors[bot] [Mon, 5 Apr 2021 17:49:48 +0000 (17:49 +0000)]
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>
Aleksey Kladov [Mon, 5 Apr 2021 17:49:00 +0000 (20:49 +0300)]
internal: prepare to store OpQueue results in the queue itself
bors[bot] [Mon, 5 Apr 2021 17:25:19 +0000 (17:25 +0000)]
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>
Florian Diebold [Mon, 5 Apr 2021 17:15:13 +0000 (19:15 +0200)]
Rename shift_bound_vars{_out} to align with Chalk
Florian Diebold [Mon, 5 Apr 2021 17:01:41 +0000 (19:01 +0200)]
Get rid of subst_bound_vars uses
Florian Diebold [Mon, 5 Apr 2021 16:54:31 +0000 (18:54 +0200)]
Get rid of some walk_mut uses
Florian Diebold [Mon, 5 Apr 2021 16:49:26 +0000 (18:49 +0200)]
Add Interner parameter to Binders::substitute
Florian Diebold [Mon, 5 Apr 2021 16:39:53 +0000 (18:39 +0200)]
Binders::subst -> substitute
Florian Diebold [Mon, 5 Apr 2021 15:45:18 +0000 (17:45 +0200)]
Use VariableKinds in Binders
Florian Diebold [Mon, 5 Apr 2021 15:13:50 +0000 (17:13 +0200)]
Hide Binders internals more
bors[bot] [Mon, 5 Apr 2021 17:17:07 +0000 (17:17 +0000)]
Merge #8347
8347: Minor interning improvements r=jonas-schievink a=jonas-schievink
bors r+
Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
bors[bot] [Mon, 5 Apr 2021 17:05:30 +0000 (17:05 +0000)]
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>
kjeremy [Mon, 5 Apr 2021 16:58:35 +0000 (12:58 -0400)]
Use arrayvec 0.7 to avoid perf regression in 0.6.1
See: https://github.com/bluss/arrayvec/issues/182
bors[bot] [Mon, 5 Apr 2021 15:47:09 +0000 (15:47 +0000)]
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>
Jonas Schievink [Mon, 5 Apr 2021 15:07:53 +0000 (17:07 +0200)]
`Interned<T>`: Only hash the pointer
Jonas Schievink [Mon, 5 Apr 2021 14:59:03 +0000 (16:59 +0200)]
Make `impl_internable!` macro public
Laurențiu Nicola [Mon, 5 Apr 2021 14:38:37 +0000 (17:38 +0300)]
Pass interner to TraitRef::self_type_parameter
Laurențiu Nicola [Mon, 5 Apr 2021 14:37:24 +0000 (17:37 +0300)]
Pass interner to ProjectionTy::self_type_parameter
bors[bot] [Mon, 5 Apr 2021 13:28:32 +0000 (13:28 +0000)]
Merge #8343
8343: internal: document hypothetical completion problem r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
Aleksey Kladov [Mon, 5 Apr 2021 13:27:45 +0000 (16:27 +0300)]
internal: document hypothetical completion problem
bors[bot] [Mon, 5 Apr 2021 13:05:35 +0000 (13:05 +0000)]
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>
Laurențiu Nicola [Mon, 5 Apr 2021 12:38:28 +0000 (15:38 +0300)]
Rename TyKind::ForeignType to Foreign
Laurențiu Nicola [Mon, 5 Apr 2021 12:37:11 +0000 (15:37 +0300)]
Rename TyKind::Unknown to Error
bors[bot] [Mon, 5 Apr 2021 12:30:20 +0000 (12:30 +0000)]
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>
bors[bot] [Mon, 5 Apr 2021 12:19:25 +0000 (12:19 +0000)]
Merge #8339
8339: fix: extract variable works in guards r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
Aleksey Kladov [Mon, 5 Apr 2021 11:36:27 +0000 (14:36 +0300)]
fix: extract variable works in guards
closes #8336
bors[bot] [Mon, 5 Apr 2021 11:23:12 +0000 (11:23 +0000)]
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>
bors[bot] [Mon, 5 Apr 2021 10:04:28 +0000 (10:04 +0000)]
Merge #8337
8337: internal: explain "extract if condition" refactoring r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
Aleksey Kladov [Mon, 5 Apr 2021 10:02:47 +0000 (13:02 +0300)]
internal: explain "extract if condition" refactoring
bors[bot] [Mon, 5 Apr 2021 02:29:09 +0000 (02:29 +0000)]
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>
Jonas Schievink [Mon, 5 Apr 2021 02:27:57 +0000 (04:27 +0200)]
simplify visibility.rs
Jonas Schievink [Mon, 5 Apr 2021 01:50:10 +0000 (03:50 +0200)]
Intern `GenericParams`
Also share the same instance between `ItemTree` and `generic_params`
query.
Jonas Schievink [Mon, 5 Apr 2021 01:32:43 +0000 (03:32 +0200)]
Add `GenericParams::shrink_to_fit`
Reduces memory usage by over 10 MB
Jonas Schievink [Mon, 5 Apr 2021 00:03:37 +0000 (02:03 +0200)]
Intern more `TypeRef`s in generics
Saves ~3 MB
bors[bot] [Sun, 4 Apr 2021 23:42:49 +0000 (23:42 +0000)]
Merge #8333
8333: analysis-stats: allow skipping type inference r=jonas-schievink a=jonas-schievink
This removes "noise" from memory profiles since it avoids lowering
function bodies and types
bors r+
Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
Jonas Schievink [Sun, 4 Apr 2021 23:42:19 +0000 (01:42 +0200)]
analysis-stats: allow skipping type inference
This removes "noise" from memory profiles since it avoids lowering
function bodies and types
bors[bot] [Sun, 4 Apr 2021 22:35:13 +0000 (22:35 +0000)]
Merge #8332
8332: Error when `rustfmt` component is unavailable r=jonas-schievink a=jonas-schievink
Fixes https://github.com/rust-analyzer/rust-analyzer/issues/8331
When the toolchain has no installable rustfmt component, running `rustfmt` complains with
```
error: the 'rustfmt' component which provides the command 'rustfmt' is not available for the 'nightly-2021-04-04-x86_64-unknown-linux-gnu' toolchain
```
Check for occurrence of "not available" in addition to the existing "not installed" to detect this case and report a user-visible error.
rustfmt and/or rustup should *really* be changed to not use the same exit status here
bors r+
Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
Jonas Schievink [Sun, 4 Apr 2021 22:33:11 +0000 (00:33 +0200)]
Error when `rustfmt` component is unavailable
bors[bot] [Sun, 4 Apr 2021 18:51:54 +0000 (18:51 +0000)]
Merge #8329
8329: docs: Fix moveItem method name r=lnicola a=simrat39
Co-authored-by: sim <simrats169169@gmail.com>
sim [Sun, 4 Apr 2021 18:49:32 +0000 (11:49 -0700)]
docs: Fix moveItem method name
bors[bot] [Sun, 4 Apr 2021 18:29:53 +0000 (18:29 +0000)]
Merge #8328
8328: Move things in hir_ty into submodules r=flodiebold a=flodiebold
- all the types that will be replaced by Chalk go to `types`
- `TypeWalk` impls go to `walk`
- also fix signature of `Substitution::interned`
Co-authored-by: Florian Diebold <flodiebold@gmail.com>
Florian Diebold [Sun, 4 Apr 2021 18:27:40 +0000 (20:27 +0200)]
Move things from `traits` module to `types` as well
Florian Diebold [Sun, 4 Apr 2021 18:22:00 +0000 (20:22 +0200)]
Move things in hir_ty into submodules
- all the types that will be replaced by Chalk go to `types`
- `TypeWalk` impls go to `walk`
bors[bot] [Sun, 4 Apr 2021 15:42:19 +0000 (15:42 +0000)]
Merge #8325
8325: Check if bitflags deps pulls its weight r=jonas-schievink a=matklad
Bitflags is generally a good dependency -- it's lightweight, well
maintained and embraced by the ecosystem.
I wonder, however, do we really need it? Doesn't feel like it adds much
to be honest.
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
bors[bot] [Sun, 4 Apr 2021 11:38:20 +0000 (11:38 +0000)]
Merge #8295
8295: Add `convert_into_to_from` assist r=Veykril a=obmarg
This adds a "Convert Into to From" assist, useful since clippy has
recently started adding lints on every `Into`.
It covers converting the signature, and converting any `self`/`Self`
references within the body.
It does assume that every instance of `Into` can be converted to a
`From`, which I _think_ is the case now. Let me know if there's
something I'm not thinking of and I can try and make it smarter.
Closes #8196
![CleanShot 2021-04-02 at 13 39 54](https://user-images.githubusercontent.com/556490/
113420108 -
9ce21c00 -93c0-11eb-8c49-
80b5fb189284 .gif)
I'm extremely new to this codebase so please let me know if anything needs
changed.
Co-authored-by: Graeme Coupar <grambo@grambo.me.uk>
bors[bot] [Sun, 4 Apr 2021 11:30:07 +0000 (11:30 +0000)]
Merge #8327
8327: Move `Ty` creation methods out of `Ty` (Chalk move preparation) r=flodiebold a=flodiebold
When we'll move to using `chalk_ir::Ty` (#8313), we won't be able to have our own inherent methods on `Ty` anymore, so we need to move the helpers elsewhere.
This adds a `TyBuilder` that allows easily constructing `Ty` and related types (`TraitRef`, `ProjectionTy`, `Substitution`). It also replaces `SubstsBuilder`. `TyBuilder` can construct different things based on its type parameter; e.g. if it has an `AdtId`, we're constructing an ADT type, but if it has a `TraitId`, we're constructing a `TraitRef`. The common thing for all of them is that we need to build a `Substitution`, so the API stays the same for all of them except at the beginning and end.
We also use `TyBuilder` to house various one-shot methods for constructing types, e.g. `TyBuilder::unit()`.
Co-authored-by: Florian Diebold <flodiebold@gmail.com>
Florian Diebold [Sun, 4 Apr 2021 11:23:22 +0000 (13:23 +0200)]
Add comment
Florian Diebold [Sun, 4 Apr 2021 11:16:16 +0000 (13:16 +0200)]
Replace Substitution::type_params
Florian Diebold [Sun, 4 Apr 2021 11:07:06 +0000 (13:07 +0200)]
Replace Substitution::bound_vars and ::type_params_for_generics
Florian Diebold [Sun, 4 Apr 2021 10:55:47 +0000 (12:55 +0200)]
Move TyBuilder to its own module
Florian Diebold [Sun, 4 Apr 2021 10:48:10 +0000 (12:48 +0200)]
Replace last uses of SubstsBuilder by TyBuilder
Florian Diebold [Sat, 3 Apr 2021 20:47:29 +0000 (22:47 +0200)]
Remove CallableSig::from_substs
Florian Diebold [Sat, 3 Apr 2021 20:45:31 +0000 (22:45 +0200)]
Use TyBuilder in another place
Florian Diebold [Sat, 3 Apr 2021 20:28:10 +0000 (22:28 +0200)]
Some more TyBuilder use
Florian Diebold [Sat, 3 Apr 2021 20:18:02 +0000 (22:18 +0200)]
Replace remaining uses of Substitution::build_for_def
Florian Diebold [Sat, 3 Apr 2021 19:59:13 +0000 (21:59 +0200)]
More TyBuilder use
Florian Diebold [Sat, 3 Apr 2021 19:56:18 +0000 (21:56 +0200)]
More TyBuilder use
Florian Diebold [Sat, 3 Apr 2021 19:50:52 +0000 (21:50 +0200)]
Add and start using TraitRef and ProjectionTy builders
Florian Diebold [Sat, 3 Apr 2021 19:32:22 +0000 (21:32 +0200)]
Move Ty::builtin to TyBuilder
Florian Diebold [Sat, 3 Apr 2021 19:29:49 +0000 (21:29 +0200)]
Add TyBuilder::adt
Florian Diebold [Sat, 3 Apr 2021 18:27:57 +0000 (20:27 +0200)]
Move Ty::fn_ptr to TyBuilder
Florian Diebold [Sat, 3 Apr 2021 18:22:59 +0000 (20:22 +0200)]
Add TyBuilder::unit() and TyExt::is_unit()
Florian Diebold [Sat, 3 Apr 2021 18:14:21 +0000 (20:14 +0200)]
Add TyBuilder
Aleksey Kladov [Sun, 4 Apr 2021 09:06:01 +0000 (12:06 +0300)]
Check if bitflags deps pulls its weight
Bitflags is generally a good dependency -- it's lightweight, well
maintained and embraced by the ecosystem.
I wonder, however, do we really need it? Doesn't feel like it adds much
to be honest.
bors[bot] [Sun, 4 Apr 2021 01:27:14 +0000 (01:27 +0000)]
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>
Jonas Schievink [Sun, 4 Apr 2021 01:26:16 +0000 (03:26 +0200)]
Add `Body::shrink_to_fit`
bors[bot] [Sun, 4 Apr 2021 01:18:13 +0000 (01:18 +0000)]
Merge #8323
8323: Only remember blocks that have a DefMap r=jonas-schievink a=jonas-schievink
bors r+
Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
Jonas Schievink [Sun, 4 Apr 2021 01:16:26 +0000 (03:16 +0200)]
Only remember blocks that have a DefMap
bors[bot] [Sun, 4 Apr 2021 01:04:44 +0000 (01:04 +0000)]
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>
Jonas Schievink [Sun, 4 Apr 2021 01:03:18 +0000 (03:03 +0200)]
Access a body's block def maps via a method
bors[bot] [Sun, 4 Apr 2021 00:56:46 +0000 (00:56 +0000)]
Merge #8321
8321: Use exhaustive matches in shrink_to_fit impls r=jonas-schievink a=jonas-schievink
bors r+
Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
Jonas Schievink [Sun, 4 Apr 2021 00:56:11 +0000 (02:56 +0200)]
Use exhaustive matches in shrink_to_fit impls
bors[bot] [Sat, 3 Apr 2021 23:47:10 +0000 (23:47 +0000)]
Merge #8320
8320: Make `ast_to_token_tree` infallible r=jonas-schievink a=jonas-schievink
It could never return `None`, so reflect that in the return type
bors r+
Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
Jonas Schievink [Sat, 3 Apr 2021 23:46:45 +0000 (01:46 +0200)]
Make `ast_to_token_tree` infallible
It could never return `None`, so reflect that in the return type
bors[bot] [Sat, 3 Apr 2021 23:30:41 +0000 (23:30 +0000)]
Merge #8319
8319: Glob-reexport hir_def database types r=jonas-schievink a=jonas-schievink
Avoids having to constantly adjust this list
bors r+
Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
Jonas Schievink [Sat, 3 Apr 2021 23:29:59 +0000 (01:29 +0200)]
Glob-reexport hir_def database types
bors[bot] [Sat, 3 Apr 2021 21:47:39 +0000 (21:47 +0000)]
Merge #8318
8318: Use shrink_to_fit to reduce DefMap sizes r=jonas-schievink a=jonas-schievink
Especially `block_def_map` can overallocate when there's not a lot of items in the `DefMap`. This saves around 10 MB during analysis-stats. Not too much, but a cheap win.
bors r+
Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
Jonas Schievink [Sat, 3 Apr 2021 21:45:27 +0000 (23:45 +0200)]
Use shrink_to_fit to reduce DefMap sizes
bors[bot] [Sat, 3 Apr 2021 19:01:03 +0000 (19:01 +0000)]
Merge #8315
8315: Try to reduce ItemTree size further r=jonas-schievink a=jonas-schievink
This was mostly a failed experiment, but still seems like the right thing to do. Memory reduction is mostly negligible.
bors r+
Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
Jonas Schievink [Sat, 3 Apr 2021 18:58:42 +0000 (20:58 +0200)]
Use bitflags to compress function properties
Very minor savings, only 1 MB or so
Jonas Schievink [Sat, 3 Apr 2021 18:56:53 +0000 (20:56 +0200)]
Intern `ModPath` in `Import`
Minor savings only
bors[bot] [Sat, 3 Apr 2021 16:18:44 +0000 (16:18 +0000)]
Merge #8312
8312: cargo update r=kjeremy a=kjeremy
Co-authored-by: Jeremy Kolb <kjeremy@gmail.com>
Jeremy Kolb [Sat, 3 Apr 2021 16:18:00 +0000 (12:18 -0400)]
cargo update
Lukas Wirth [Sat, 3 Apr 2021 15:22:16 +0000 (17:22 +0200)]
Rewrite reorder fields assist to use mutable syntax trees
Graeme Coupar [Fri, 2 Apr 2021 13:00:56 +0000 (14:00 +0100)]
Convert Into to From assist
This adds a "Convert Into to From" assist, useful since clippy has
recently started adding lints on every `Into`.
It covers converting the signature, and converting any `self`/`Self`
references within the body to the correct types.
It does assume that every instance of `Into` can be converted to a
`From`, which I _think_ is the case now. Let me know if there's
something I'm not thinking of and I can try and make it smarter.