diff options
| author | Samuel Tardieu <sam@rfc1149.net> | 2025-06-04 09:51:30 +0200 |
|---|---|---|
| committer | Samuel Tardieu <sam@rfc1149.net> | 2025-06-04 10:11:56 +0200 |
| commit | 1ae37ada0845bdaa13008c3957b98cc75f068fd4 (patch) | |
| tree | 983eaf321e383af4b744a588f50ee97b724afc56 /tests | |
| parent | 84ef7fb4144c7efbc541e47cb9fd11cd312674b3 (diff) | |
| download | rust-1ae37ada0845bdaa13008c3957b98cc75f068fd4.tar.gz rust-1ae37ada0845bdaa13008c3957b98cc75f068fd4.zip | |
Do not recurse indefinitely while checking for inner mutability
`clippy_utils::ty::InteriorMut::interior_mut_ty_chain` must stop recursing forever when types are chained indefinitely due to the use of associated types in generics. A false negative is acceptable, and documented here. Should this situation be later identified specifically, a conversion of `Option` to `Result` would allow separating the infinitely recursive case from a negative one.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/ui/crashes/ice-14935.rs | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/ui/crashes/ice-14935.rs b/tests/ui/crashes/ice-14935.rs new file mode 100644 index 00000000000..74cda9aae53 --- /dev/null +++ b/tests/ui/crashes/ice-14935.rs @@ -0,0 +1,27 @@ +//@check-pass +#![warn(clippy::mutable_key_type)] + +use std::marker::PhantomData; + +trait Group { + type ExposantSet: Group; +} + +struct Pow<T: Group> { + exposant: Box<Pow<T::ExposantSet>>, + _p: PhantomData<T>, +} + +impl<T: Group> Pow<T> { + fn is_zero(&self) -> bool { + false + } + fn normalize(&self) { + #[expect(clippy::if_same_then_else)] + if self.is_zero() { + } else if false { + } + } +} + +fn main() {} |
