]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoFix shifting of binders in FnPointer
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

3 years agoAlign FnPointer with Chalk
Florian Diebold [Mon, 5 Apr 2021 20:23:16 +0000 (22:23 +0200)]
Align FnPointer with Chalk

3 years agoMerge #8356
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>
3 years agoSubstitution::prefix -> subst_prefix
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.

3 years agoGet rid of Substitution::suffix
Florian Diebold [Mon, 5 Apr 2021 19:49:27 +0000 (21:49 +0200)]
Get rid of Substitution::suffix

3 years agoRemove some unused methods, move some to types.rs
Florian Diebold [Mon, 5 Apr 2021 19:29:20 +0000 (21:29 +0200)]
Remove some unused methods, move some to types.rs

3 years agoBinders::wrap_empty -> wrap_empty_binders
Florian Diebold [Mon, 5 Apr 2021 19:25:40 +0000 (21:25 +0200)]
Binders::wrap_empty -> wrap_empty_binders

3 years agoSubstitution::single -> from1
Florian Diebold [Mon, 5 Apr 2021 19:17:35 +0000 (21:17 +0200)]
Substitution::single -> from1

3 years agoMove ProjectionTy methods to extension trait
Florian Diebold [Mon, 5 Apr 2021 19:14:49 +0000 (21:14 +0200)]
Move ProjectionTy methods to extension trait

3 years agoMerge #8353
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>
3 years agoMerge #8352
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>
3 years agoRemove dead legacy macro expansion code
Brandon [Mon, 5 Apr 2021 18:47:06 +0000 (11:47 -0700)]
Remove dead legacy macro expansion code

3 years agoReplace unused hir_ty::Lifetime with chalk equivalents
Lukas Wirth [Mon, 5 Apr 2021 18:46:15 +0000 (20:46 +0200)]
Replace unused hir_ty::Lifetime with chalk equivalents

3 years agoMerge #8351
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>
3 years agoUse more assoc. type aliases in the chalk interner
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

3 years agoMerge #8350
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>
3 years agointernal: prepare to store OpQueue results in the queue itself
Aleksey Kladov [Mon, 5 Apr 2021 17:49:00 +0000 (20:49 +0300)]
internal: prepare to store OpQueue results in the queue itself

3 years agoMerge #8348
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>
3 years agoRename shift_bound_vars{_out} to align with Chalk
Florian Diebold [Mon, 5 Apr 2021 17:15:13 +0000 (19:15 +0200)]
Rename shift_bound_vars{_out} to align with Chalk

3 years agoGet rid of subst_bound_vars uses
Florian Diebold [Mon, 5 Apr 2021 17:01:41 +0000 (19:01 +0200)]
Get rid of subst_bound_vars uses

3 years agoGet rid of some walk_mut uses
Florian Diebold [Mon, 5 Apr 2021 16:54:31 +0000 (18:54 +0200)]
Get rid of some walk_mut uses

3 years agoAdd Interner parameter to Binders::substitute
Florian Diebold [Mon, 5 Apr 2021 16:49:26 +0000 (18:49 +0200)]
Add Interner parameter to Binders::substitute

3 years agoBinders::subst -> substitute
Florian Diebold [Mon, 5 Apr 2021 16:39:53 +0000 (18:39 +0200)]
Binders::subst -> substitute

3 years agoUse VariableKinds in Binders
Florian Diebold [Mon, 5 Apr 2021 15:45:18 +0000 (17:45 +0200)]
Use VariableKinds in Binders

3 years agoHide Binders internals more
Florian Diebold [Mon, 5 Apr 2021 15:13:50 +0000 (17:13 +0200)]
Hide Binders internals more

3 years agoMerge #8347
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>
3 years agoMerge #8346
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>
3 years agoUse arrayvec 0.7 to avoid perf regression in 0.6.1
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

3 years agoMerge #8344
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>
3 years ago`Interned<T>`: Only hash the pointer
Jonas Schievink [Mon, 5 Apr 2021 15:07:53 +0000 (17:07 +0200)]
`Interned<T>`: Only hash the pointer

3 years agoMake `impl_internable!` macro public
Jonas Schievink [Mon, 5 Apr 2021 14:59:03 +0000 (16:59 +0200)]
Make `impl_internable!` macro public

3 years agoPass interner to TraitRef::self_type_parameter
Laurențiu Nicola [Mon, 5 Apr 2021 14:38:37 +0000 (17:38 +0300)]
Pass interner to TraitRef::self_type_parameter

3 years agoPass interner to ProjectionTy::self_type_parameter
Laurențiu Nicola [Mon, 5 Apr 2021 14:37:24 +0000 (17:37 +0300)]
Pass interner to ProjectionTy::self_type_parameter

3 years agoMerge #8343
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>
3 years agointernal: document hypothetical completion problem
Aleksey Kladov [Mon, 5 Apr 2021 13:27:45 +0000 (16:27 +0300)]
internal: document hypothetical completion problem

3 years agoMerge #8342
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>
3 years agoRename TyKind::ForeignType to Foreign
Laurențiu Nicola [Mon, 5 Apr 2021 12:38:28 +0000 (15:38 +0300)]
Rename TyKind::ForeignType to Foreign

3 years agoRename TyKind::Unknown to Error
Laurențiu Nicola [Mon, 5 Apr 2021 12:37:11 +0000 (15:37 +0300)]
Rename TyKind::Unknown to Error

3 years agoMerge #8245
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>
3 years agoMerge #8339
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>
3 years agofix: extract variable works in guards
Aleksey Kladov [Mon, 5 Apr 2021 11:36:27 +0000 (14:36 +0300)]
fix: extract variable works in guards

closes #8336

3 years agoMerge #8326
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>
3 years agoMerge #8337
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>
3 years agointernal: explain "extract if condition" refactoring
Aleksey Kladov [Mon, 5 Apr 2021 10:02:47 +0000 (13:02 +0300)]
internal: explain "extract if condition" refactoring

3 years agoMerge #8334
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>
3 years agosimplify visibility.rs
Jonas Schievink [Mon, 5 Apr 2021 02:27:57 +0000 (04:27 +0200)]
simplify visibility.rs

3 years agoIntern `GenericParams`
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.

3 years agoAdd `GenericParams::shrink_to_fit`
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

3 years agoIntern more `TypeRef`s in generics
Jonas Schievink [Mon, 5 Apr 2021 00:03:37 +0000 (02:03 +0200)]
Intern more `TypeRef`s in generics

Saves ~3 MB

3 years agoMerge #8333
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>
3 years agoanalysis-stats: allow skipping type inference
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

3 years agoMerge #8332
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>
3 years agoError when `rustfmt` component is unavailable
Jonas Schievink [Sun, 4 Apr 2021 22:33:11 +0000 (00:33 +0200)]
Error when `rustfmt` component is unavailable

3 years agoMerge #8329
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>
3 years agodocs: Fix moveItem method name
sim [Sun, 4 Apr 2021 18:49:32 +0000 (11:49 -0700)]
docs: Fix moveItem method name

3 years agoMerge #8328
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>
3 years agoMove things from `traits` module to `types` as well
Florian Diebold [Sun, 4 Apr 2021 18:27:40 +0000 (20:27 +0200)]
Move things from `traits` module to `types` as well

3 years agoMove things in hir_ty into submodules
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`

3 years agoMerge #8325
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>
3 years agoMerge #8295
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>
3 years agoMerge #8327
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>
3 years agoAdd comment
Florian Diebold [Sun, 4 Apr 2021 11:23:22 +0000 (13:23 +0200)]
Add comment

3 years agoReplace Substitution::type_params
Florian Diebold [Sun, 4 Apr 2021 11:16:16 +0000 (13:16 +0200)]
Replace Substitution::type_params

3 years agoReplace Substitution::bound_vars and ::type_params_for_generics
Florian Diebold [Sun, 4 Apr 2021 11:07:06 +0000 (13:07 +0200)]
Replace Substitution::bound_vars and ::type_params_for_generics

3 years agoMove TyBuilder to its own module
Florian Diebold [Sun, 4 Apr 2021 10:55:47 +0000 (12:55 +0200)]
Move TyBuilder to its own module

3 years agoReplace last uses of SubstsBuilder by TyBuilder
Florian Diebold [Sun, 4 Apr 2021 10:48:10 +0000 (12:48 +0200)]
Replace last uses of SubstsBuilder by TyBuilder

3 years agoRemove CallableSig::from_substs
Florian Diebold [Sat, 3 Apr 2021 20:47:29 +0000 (22:47 +0200)]
Remove CallableSig::from_substs

3 years agoUse TyBuilder in another place
Florian Diebold [Sat, 3 Apr 2021 20:45:31 +0000 (22:45 +0200)]
Use TyBuilder in another place

3 years agoSome more TyBuilder use
Florian Diebold [Sat, 3 Apr 2021 20:28:10 +0000 (22:28 +0200)]
Some more TyBuilder use

3 years agoReplace remaining uses of Substitution::build_for_def
Florian Diebold [Sat, 3 Apr 2021 20:18:02 +0000 (22:18 +0200)]
Replace remaining uses of Substitution::build_for_def

3 years agoMore TyBuilder use
Florian Diebold [Sat, 3 Apr 2021 19:59:13 +0000 (21:59 +0200)]
More TyBuilder use

3 years agoMore TyBuilder use
Florian Diebold [Sat, 3 Apr 2021 19:56:18 +0000 (21:56 +0200)]
More TyBuilder use

3 years agoAdd and start using TraitRef and ProjectionTy builders
Florian Diebold [Sat, 3 Apr 2021 19:50:52 +0000 (21:50 +0200)]
Add and start using TraitRef and ProjectionTy builders

3 years agoMove Ty::builtin to TyBuilder
Florian Diebold [Sat, 3 Apr 2021 19:32:22 +0000 (21:32 +0200)]
Move Ty::builtin to TyBuilder

3 years agoAdd TyBuilder::adt
Florian Diebold [Sat, 3 Apr 2021 19:29:49 +0000 (21:29 +0200)]
Add TyBuilder::adt

3 years agoMove Ty::fn_ptr to TyBuilder
Florian Diebold [Sat, 3 Apr 2021 18:27:57 +0000 (20:27 +0200)]
Move Ty::fn_ptr to TyBuilder

3 years agoAdd TyBuilder::unit() and TyExt::is_unit()
Florian Diebold [Sat, 3 Apr 2021 18:22:59 +0000 (20:22 +0200)]
Add TyBuilder::unit() and TyExt::is_unit()

3 years agoAdd TyBuilder
Florian Diebold [Sat, 3 Apr 2021 18:14:21 +0000 (20:14 +0200)]
Add TyBuilder

3 years agoCheck if bitflags deps pulls its weight
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.

3 years agoMerge #8324
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>
3 years agoAdd `Body::shrink_to_fit`
Jonas Schievink [Sun, 4 Apr 2021 01:26:16 +0000 (03:26 +0200)]
Add `Body::shrink_to_fit`

3 years agoMerge #8323
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>
3 years agoOnly remember blocks that have a DefMap
Jonas Schievink [Sun, 4 Apr 2021 01:16:26 +0000 (03:16 +0200)]
Only remember blocks that have a DefMap

3 years agoMerge #8322
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>
3 years agoAccess a body's block def maps via a method
Jonas Schievink [Sun, 4 Apr 2021 01:03:18 +0000 (03:03 +0200)]
Access a body's block def maps via a method

3 years agoMerge #8321
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>
3 years agoUse exhaustive matches in shrink_to_fit impls
Jonas Schievink [Sun, 4 Apr 2021 00:56:11 +0000 (02:56 +0200)]
Use exhaustive matches in shrink_to_fit impls

3 years agoMerge #8320
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>
3 years agoMake `ast_to_token_tree` infallible
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

3 years agoMerge #8319
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>
3 years agoGlob-reexport hir_def database types
Jonas Schievink [Sat, 3 Apr 2021 23:29:59 +0000 (01:29 +0200)]
Glob-reexport hir_def database types

3 years agoMerge #8318
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>
3 years agoUse shrink_to_fit to reduce DefMap sizes
Jonas Schievink [Sat, 3 Apr 2021 21:45:27 +0000 (23:45 +0200)]
Use shrink_to_fit to reduce DefMap sizes

3 years agoMerge #8315
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>
3 years agoUse bitflags to compress function properties
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

3 years agoIntern `ModPath` in `Import`
Jonas Schievink [Sat, 3 Apr 2021 18:56:53 +0000 (20:56 +0200)]
Intern `ModPath` in `Import`

Minor savings only

3 years agoMerge #8312
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>
3 years agocargo update
Jeremy Kolb [Sat, 3 Apr 2021 16:18:00 +0000 (12:18 -0400)]
cargo update

3 years agoRewrite reorder fields assist to use mutable syntax trees
Lukas Wirth [Sat, 3 Apr 2021 15:22:16 +0000 (17:22 +0200)]
Rewrite reorder fields assist to use mutable syntax trees

3 years agoConvert Into to From assist
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.