Don't panic on invalid shift while constfolding
Instead of panicking on invalid shifts while folding constants we simply give up. Fixes#9463
Notice the "attempt to shift right by `1316134912_u32`", which seems weird. AFAICS it comes from rustc itself.
changelog: none
Don't lint `large_stack_array` inside static items
We now check if the linted `Expr` is inside an `ItemKind::Static`, which can't take the suggested `Box<[...]`. I _think_ this is the correct fix for #9460
I removed `if_chain` while I was at it.
changelog: Don't lint `large_stack_array` inside static items
Use macro callsite when creating `Sugg` helper
Closes#9375
changelog: Improvement: [`collapsible_if`]: Suggestions now work with macros, by taking the call site into account.
[`assertions_on_result_states`]: Fix suggestion when `assert!` is not in a statement.
fix https://github.com/rust-lang/rust-clippy/issues/9450
changelog: [`assertions_on_result_states`]: Fix suggestion when `assert!` is not in a statement.
Replace u128 with u64 in large_enum_variant uitest
A u128 has [an 8 byte alignment on x86](https://github.com/rust-lang/rust/issues/54341), but a 16 byte alignment on aarch64 which changes the size of the enums due to extra padding. This means the test fails on aarch64
changelog: none
Fix `range_{plus,minus}_one` bad suggestions
Fixes#9431.
The current `range_plus_one` and `range_minus_one` suggestions are completely incorrect when macros are involved.
This commit resolves this by disabling the lints for any range expression that is expanded from a macro. The reasons for this are that it is very difficult to create a correct suggestion in this case and that false negatives are less important for pedantic lints.
changelog: Fix `range_{plus,minus}_one` bad suggestions
Fixes#9431.
The current `range_plus_one` and `range_minus_one` suggestions
are completely incorrect when macros are involved.
This commit resolves this by disabling the lints for any range
expression that is expanded from a macro. The reasons for this
are that it is very difficult to create a correct suggestion in
this case and that false negatives are less important for
pedantic lints.
Update cargo in lintcheck_crates.toml
0.49.0 depends on a version of socket2 that no longer builds due to
```
error[E0512]: cannot transmute between types of different sizes, or dependently-sized types
--> /home/alex/.cargo/registry/src/github.com-1ecc6299db9ec823/socket2-0.3.11/src/sockaddr.rs:156:9
|
156 | mem::transmute::<SocketAddrV4, sockaddr_in>(v4);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: source type: `SocketAddrV4` (48 bits)
= note: target type: `sockaddr_in` (128 bits)
```
changelog: none
Rollup of 7 pull requests
Successful merges:
- #98933 (Opaque types' generic params do not imply anything about their hidden type's lifetimes)
- #101041 (translations(rustc_session): migrates rustc_session to use SessionDiagnostic - Pt. 2)
- #101424 (Adjust and slightly generalize operator error suggestion)
- #101496 (Allow lower_lifetime_binder receive a closure)
- #101501 (Allow lint passes to be bound by `TyCtxt`)
- #101515 (Recover from typo where == is used in place of =)
- #101545 (Remove unnecessary `PartialOrd` and `Ord`)
Failed merges:
r? `@ghost`
`@rustbot` modify labels: rollup
Allow lint passes to be bound by `TyCtxt`
This will allow storing things like `Ty<'tcx>` inside late lint passes. It's already possible to store various id types so they're already implicitly bound to a specific `TyCtxt`.
r? rust-lang/compiler
rustc: Parameterize `ty::Visibility` over used ID
It allows using `LocalDefId` instead of `DefId` when possible, and also encode cheaper `Visibility<DefIndex>` into metadata.
This shrinks `hir::Ty` from 72 to 48 bytes.
`visit_lifetime` is added to the HIR stats collector because these types
are now stored in memory on their own, instead of being within other
types.