Commit Graph

16210 Commits

Author SHA1 Message Date
Jonas Schievink
a0b50bcf1e Make impl_internable! macro public 2021-04-05 16:59:13 +02:00
bors[bot]
fab1c06646
Merge #8343
8343: internal: document hypothetical completion problem r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-04-05 13:28:32 +00:00
Aleksey Kladov
1f00191de2 internal: document hypothetical completion problem 2021-04-05 16:27:45 +03:00
bors[bot]
8a18f23df0
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>
2021-04-05 13:05:35 +00: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
bors[bot]
c2be91dcd8
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>
2021-04-05 12:30:20 +00:00
bors[bot]
d8ee25bb97
Merge #8339
8339: fix: extract variable works in guards r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-04-05 12:19:25 +00:00
Aleksey Kladov
30d6419bc9 fix: extract variable works in guards
closes #8336
2021-04-05 14:40:56 +03:00
bors[bot]
4a589b1c3a
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>
2021-04-05 11:23:12 +00:00
bors[bot]
9bf7ca59e9
Merge #8337
8337: internal: explain "extract if condition" refactoring r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-04-05 10:04:28 +00:00
Aleksey Kladov
a01fd1af19 internal: explain "extract if condition" refactoring 2021-04-05 13:02:47 +03:00
bors[bot]
58924cfae1
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>
2021-04-05 02:29:09 +00:00
Jonas Schievink
6f1ee9a7f4 simplify visibility.rs 2021-04-05 04:27:57 +02: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
adcf18e27d Add GenericParams::shrink_to_fit
Reduces memory usage by over 10 MB
2021-04-05 03:32:43 +02:00
Jonas Schievink
24e876b52e Intern more TypeRefs in generics
Saves ~3 MB
2021-04-05 02:03:37 +02:00
bors[bot]
19e09a4a54
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>
2021-04-04 23:42:49 +00:00
Jonas Schievink
ab49f762a9 analysis-stats: allow skipping type inference
This removes "noise" from memory profiles since it avoids lowering
function bodies and types
2021-04-05 01:42:19 +02:00
bors[bot]
4be4d29853
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>
2021-04-04 22:35:13 +00:00
Jonas Schievink
d3b804d11d Error when rustfmt component is unavailable 2021-04-05 00:33:11 +02:00
bors[bot]
d3dfa18071
Merge #8329
8329: docs: Fix moveItem method name r=lnicola a=simrat39



Co-authored-by: sim <simrats169169@gmail.com>
2021-04-04 18:51:54 +00:00
sim
d542a2b463
docs: Fix moveItem method name 2021-04-04 11:49:32 -07:00
bors[bot]
35614c7623
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>
2021-04-04 18:29:53 +00: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
bors[bot]
0924888cce
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>
2021-04-04 15:42:19 +00:00
bors[bot]
bc8b278841
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>
2021-04-04 11:38:20 +00:00
bors[bot]
0829960320
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>
2021-04-04 11:30:07 +00: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
Aleksey Kladov
d1474ae518 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.
2021-04-04 12:06:01 +03:00
bors[bot]
c9bcbf9a43
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>
2021-04-04 01:27:14 +00:00
Jonas Schievink
1da6d0bed9 Add Body::shrink_to_fit 2021-04-04 03:26:16 +02:00
bors[bot]
3ea5ea1324
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>
2021-04-04 01:18:13 +00:00