]>
git.lizzy.rs Git - rust.git/log
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: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>
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.
bors[bot] [Sat, 3 Apr 2021 11:09:43 +0000 (11:09 +0000)]
Merge #8310
8310: Rename Ty::interned to Ty::kind r=flodiebold a=flodiebold
... since that's the actual method on Chalk side that matches the signature.
Co-authored-by: Florian Diebold <flodiebold@gmail.com>
Florian Diebold [Sat, 3 Apr 2021 11:08:29 +0000 (13:08 +0200)]
Rename Ty::interned to Ty::kind
... since that's the actual method on Chalk side that matches the signature.
bors[bot] [Sat, 3 Apr 2021 09:19:55 +0000 (09:19 +0000)]
Merge #8309
8309: Introduce `GenericArg` like in Chalk r=flodiebold a=flodiebold
Plus some more adaptations to Substitution.
Lots of `assert_ty_ref` that we should revisit when introducing lifetime/const parameters.
Co-authored-by: Florian Diebold <flodiebold@gmail.com>
Florian Diebold [Thu, 1 Apr 2021 19:04:02 +0000 (21:04 +0200)]
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.
bors[bot] [Sat, 3 Apr 2021 04:55:39 +0000 (04:55 +0000)]
Merge #8307
8307: Allow include! an empty content file r=edwin0cheng a=edwin0cheng
fixes #8306
bors r+
Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
Edwin Cheng [Sat, 3 Apr 2021 04:50:55 +0000 (12:50 +0800)]
Allow include! an empty content file
bors[bot] [Sat, 3 Apr 2021 03:21:45 +0000 (03:21 +0000)]
Merge #8305
8305: Fix joinLines panic if run on the empty last line r=edwin0cheng a=edwin0cheng
fixes #8299
bors r+
Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
Edwin Cheng [Sat, 3 Apr 2021 03:20:16 +0000 (11:20 +0800)]
Fix joinLines panic if run on the empty last line
bors[bot] [Sat, 3 Apr 2021 01:14:56 +0000 (01:14 +0000)]
Merge #8304
8304: Support the new `panic!()` macro r=jonas-schievink a=jonas-schievink
Includes a minor fixup to macro 2.0 parsing.
bors r+
Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
Jonas Schievink [Sat, 3 Apr 2021 01:13:04 +0000 (03:13 +0200)]
Support `#[rustc_builtin_macro = "builtin_name"]`
Jonas Schievink [Sat, 3 Apr 2021 01:12:55 +0000 (03:12 +0200)]
Implement edition-dependent builtin `panic!` macro
Jonas Schievink [Sat, 3 Apr 2021 01:08:31 +0000 (03:08 +0200)]
Allow `,` to delimit macro 2.0 rules
bors[bot] [Sat, 3 Apr 2021 00:09:41 +0000 (00:09 +0000)]
Merge #8303
8303: Allow interning strings r=jonas-schievink a=jonas-schievink
We don't use it yet, that's a bit more complicated.
bors r+
Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
Jonas Schievink [Fri, 2 Apr 2021 23:00:45 +0000 (01:00 +0200)]
Allow interning strings
bors[bot] [Fri, 2 Apr 2021 18:47:25 +0000 (18:47 +0000)]
Merge #8298
8298: Stop using an upgradeable read lock in interning r=jonas-schievink a=jonas-schievink
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.
bors r+
Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
Jonas Schievink [Fri, 2 Apr 2021 18:46:37 +0000 (20:46 +0200)]
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.
bors[bot] [Fri, 2 Apr 2021 17:00:57 +0000 (17:00 +0000)]
Merge #8297
8297: Only populate prelude for crate-level DefMaps r=jonas-schievink a=jonas-schievink
Fixes https://github.com/rust-analyzer/rust-analyzer/issues/8281
bors r+
Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
Jonas Schievink [Fri, 2 Apr 2021 17:00:26 +0000 (19:00 +0200)]
Only populate prelude for crate-level DefMaps
bors[bot] [Fri, 2 Apr 2021 16:43:16 +0000 (16:43 +0000)]
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>
bors[bot] [Fri, 2 Apr 2021 16:35:22 +0000 (16:35 +0000)]
Merge #8291
8291: Put the revision in the startup message r=jonas-schievink a=lf-
Co-authored-by: Jade <software@lfcode.ca>
Jonas Schievink [Fri, 2 Apr 2021 16:26:34 +0000 (18:26 +0200)]
Remove `?Sized` on `PartialEq`/`Eq` impls
Jonas Schievink [Fri, 2 Apr 2021 16:11:08 +0000 (18:11 +0200)]
Split `Intern::drop` into hot and cold path
bors[bot] [Fri, 2 Apr 2021 14:41:24 +0000 (14:41 +0000)]
Merge #8287
8287: Don't allocate in `associated_type_shorthand_candidates` r=Veykril a=Veykril
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
Lukas Wirth [Fri, 2 Apr 2021 00:09:12 +0000 (02:09 +0200)]
Don't allocate in `associated_type_shorthand_candidates`
bors[bot] [Fri, 2 Apr 2021 12:30:02 +0000 (12:30 +0000)]
Merge #8294
8294: minor: add profile call for resolve_obligations r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
Aleksey Kladov [Fri, 2 Apr 2021 12:28:51 +0000 (15:28 +0300)]
minor: add profile call for resolve_obligations