-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingI-ICEIssue: Clippy panicked, giving an Internal Compilation Error (ICE) ❄️Issue: Clippy panicked, giving an Internal Compilation Error (ICE) ❄️
Description
Summary
Using recursive type with conditions leads to a stack overflow.
To reproduce :
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) {
if self.is_zero() {
} else if false {
}
}
}
Removing the else if condition make the bug disappear.
Version
rustc 1.89.0-nightly (ce7e97f73 2025-05-11)
binary: rustc
commit-hash: ce7e97f7371af47e0786f74aa169f6ac9473ff4e
commit-date: 2025-05-11
host: x86_64-unknown-linux-gnu
release: 1.89.0-nightly
LLVM version: 20.1.4
Error output
thread 'rustc' has overflowed its stack
fatal runtime error: stack overflow, aborting
warning: `formalith` (bin "formalith") generated 3 warnings
error: could not compile `formalith` (bin "formalith"); 3 warnings emitted
Caused by:
process didn't exit successfully: `/home/julien/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/clippy-driver /home/julien/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/rustc --crate-name formalith --edition=2024 src/main.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=159 --crate-type bin --emit=dep-info,metadata -C embed-bitcode=no -C debuginfo=2 --check-cfg 'cfg(docsrs,test)' --check-cfg 'cfg(feature, values())' -C metadata=a142a0962d0a3e76 -C extra-filename=-a5c1622c0424deeb --out-dir /home/julien/code/test_rust/target/debug/deps -C incremental=/home/julien/code/test_rust/target/debug/incremental -L dependency=/home/julien/code/test_rust/target/debug/deps` (signal: 6, SIGABRT: process abort signal)
Metadata
Metadata
Assignees
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingI-ICEIssue: Clippy panicked, giving an Internal Compilation Error (ICE) ❄️Issue: Clippy panicked, giving an Internal Compilation Error (ICE) ❄️