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>
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>
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>
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.
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>
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>
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>
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>
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>
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>
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.
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>
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>
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>