rust-clippy/tests
bors 0b441d5ac5 Auto merge of #12877 - y21:const_host_ice, r=dswij
Handle const effects inherited from parent correctly in `type_certainty`

This fixes a (debug) ICE in `type_certainty` that happened in the [k256 crate]. (I'm sure you can also specifically construct an edge test case that will run into type_certainty false positives visible outside of debug builds from this bug)

<details>
<summary>Minimal ICE repro</summary>

```rs
use std::ops::Add;
Add::add(1_i32, 1).add(i32::MIN);
```
</details>

The subtraction here overflowed:
436675b477/clippy_utils/src/ty/type_certainty/mod.rs (L209)

... when we have something like `Add::add` where `add` fn has 0 generic params but the `host_effect_index` is `Some(2)` (inherited from the parent generics, the const trait `Add`), and we end up executing `0 - 1`.

(Even if the own generics weren't empty and we didn't overflow, this would still be wrong because it would assume that a trait method with 1 generic parameter didn't have any generics).

So, *only* exclude the "host" generic parameter if it's actually bound by the own generics

changelog: none

[k256 crate]: https://github.com/RustCrypto/elliptic-curves/tree/master/k256
2024-06-07 09:33:48 +00:00
..
test_utils
ui Auto merge of #12877 - y21:const_host_ice, r=dswij 2024-06-07 09:33:48 +00:00
ui-cargo Merge commit '2efebd2f0c03dabbe5c3ad7b4ebfbd99238d1fb2' into clippy-subtree-update 2024-05-21 10:39:30 -07:00
ui-internal Merge remote-tracking branch 'upstream/master' into rustup 2024-05-30 09:44:14 +02:00
ui-toml Auto merge of #10632 - Alexendoo:needless-maybe-sized, r=Jarcho 2024-06-05 20:11:03 +00:00
workspace_test
check-fmt.rs
clippy.toml
compile-test.rs Merge commit '20b085d500dfba5afe0869707bf357af3afe20be' into clippy-subtree-update 2024-05-02 17:26:44 +02:00
dogfood.rs Stabilize LazyCell and LazyLock (lazy_cell) 2024-02-20 20:55:13 -07:00
headers.rs Merge commit 'a859e5cc1ce100df22346a1005da30532d04de59' into clippyup 2023-12-16 14:12:50 +01:00
integration.rs Tweak delayed bug mentions. 2024-02-12 18:39:20 +11:00
lint_message_convention.rs Stabilize LazyCell and LazyLock (lazy_cell) 2024-02-20 20:55:13 -07:00
missing-test-files.rs Merge commit '93f0a9a91f58c9b2153868f458402155fb6265bb' into clippy-subtree-update 2024-03-07 17:19:29 +01:00
versioncheck.rs Merge commit '09ac14c901abc43bd0d617ae4a44e8a4fed98d9c' into clippyup 2023-11-02 17:35:56 +01:00
workspace.rs Stabilize LazyCell and LazyLock (lazy_cell) 2024-02-20 20:55:13 -07:00