[arithmetic_side_effects] Cache symbols
An internal-only modification to speed up the processing of symbols because "intern" isn't very cheap, even more when you are doing the same thing for every method expression.
changelog: none
Don't transmute `&List<GenericArg>` <-> `&List<Ty>`
In #93505 we allowed safely transmuting between `&List<GenericArg<'_>>` and `&List<Ty<'_>>`. This was possible because `GenericArg` is a tagged pointer and the tag for types is `0b00`, such that a `GenericArg` with a type inside has the same layout as `Ty`.
While this was meant as an optimization, it doesn't look like it was actually any perf or max-rss win (see https://github.com/rust-lang/rust/pull/94799#issuecomment-1064340003, https://github.com/rust-lang/rust/pull/94841, https://github.com/rust-lang/rust/pull/110496#issuecomment-1513799140).
Additionally the way it was done is quite fragile — `unsafe` code was not properly documented or contained in a module, types were not marked as `repr(C)` (making the transmutes possibly unsound). All of this makes the code maintenance harder and blocks other possible optimizations (as an example I've found out about these `transmutes` when my change caused them to sigsegv compiler).
Thus, I think we can safely (pun intended) remove those transmutes, making maintenance easier, optimizations possible, code less cursed, etc.
r? `@compiler-errors`
Suppress the triggering of some lints in derived structures
Fixes#10185Fixes#10417
For `integer_arithmetic`, `arithmetic_side_effects` and `shadow_reuse`.
* ~~Not sure how to test these use-cases so feel free to point any method or any related PR.~~
---
changelog: FP: [`integer_arithmetic`], [`arithmetic_side_effects`]: No longer lint inside proc macros
[#10203](https://github.com/rust-lang/rust-clippy/pull/10203)
<!-- changelog_checked -->
Add size-parameter to unecessary_box_returns
Fixes#10641
This adds a configuration-knob to the `unecessary_box_returns`-lint which allows _not_ linting a `fn() -> Box<T>` if `T` is "large". The default byte size above which we no longer lint is 128 bytes (due to https://github.com/rust-lang/rust-clippy/issues/4652#issue-505670554, also used in #9373). The overall rational is given in #10641.
---
changelog: Enhancement: [`unnecessary_box_returns`]: Added new lint configuration `unnecessary-box-size` to set the maximum size of `T` in `Box<T>` to be linted
[#10651](https://github.com/rust-lang/rust-clippy/pull/10651)
<!-- changelog_checked -->
Suggest `std::mem::size_of_val` instead of `std::mem::size_of_value`
This fixes the incorrect suggestion to use `std::mem::size_of_value`. It should be [`std::mem::size_of_val`](https://doc.rust-lang.org/std/mem/fn.size_of_val.html).
changelog: [`manual_slice_size_calculation`]: suggest `std::mem::size_of_val` rather than `std::mem::size_of_value`
Clippy Book Chapter Updates Reborn: Macro Expansions
This PR adds a new chapter to the book: "Macro Expansions". There weren't big changes apart from grammar, re-phrasing and stylistic choices.
## Notes
- **Does not require any other chapter** to be merged before this
- To talk about the whole project, please use the tracking issue for the project #10597 (It also contains a timeline, discussions and more information)
changelog: Add a new "Macro Expansions" chapter to the book
r? `@flip1995`
Book: Improve type checking and lint passes chapters
- Adds the lint passes chapter to the index.
- Moves additional reading material for beginners to the front page of the development section.
- Clarify some details in `hir::Ty` vs `ty::Ty`.
`@blyxyas` I started reviewing the chapters that were already merged. Great work. I liked the additional reading chapter so much, that I moved it front and center. Other than that I only had some minor corrections to make. Please review.
r? `@llogiq`
changelog: none
Adds the lint passes chapter to the index.
Moves additional reading material for beginners to the front page of the
development section.
Clarify some details in hir::Ty vs ty::Ty.
This allows allocating `Expr`s into a dropless arena, which is useful
for using length prefixed thing slices in HIR, since these can only be
allocated in the dropless arena and not in a typed arena. This is
something I'm working on.
Clippy Book Chapter Updates Reborn: Lint Passes
This PR adds a new chapter to the book: "Lint passes". No major changes apart from some re-phrasing, fixing typos... etc.
## Notes
- Requires #10595 to be merged before this one (Or else, a link will be broken).
- To talk about the whole project, please use the tracking issue for the project #10597 (It also contains a timeline, discussions and more information)
changelog: Add a new "Lint passes" chapter to the book
r? `@flip1995`
resolve: Pre-compute non-reexport module children
Instead of repeating the same logic by walking HIR during metadata encoding.
The only difference is that we are no longer encoding `macro_rules` items, but we never currently need them as a part of this list. They can be encoded separately if this need ever arises.
`module_reexports` is also un-querified, because I don't see any reasons to make it a query, only overhead.