Closed
Description
Summary
Clippy takes a very large amount of time and RAM to analyze the following code. The time is spent in a single invocation of <rustc_mir_dataflow::framework::engine::Engine<clippy_utils::mir::possible_borrower::PossibleBorrowerAnalysis>>::iterate_to_fixpoint
:
[...]
#6 0x00005567f6f1a249 in <rustc_mir_dataflow::framework::engine::Engine<clippy_utils::mir::possible_borrower::PossibleBorrowerAnalysis>>::iterate_to_fixpoint ()
#7 0x00005567f6f79839 in <clippy_utils::mir::possible_borrower::PossibleBorrowerMap>::new ()
#8 0x00005567f6e4d222 in <clippy_lints::redundant_clone::RedundantClone as rustc_lint::passes::LateLintPass>::check_fn ()
[...]
The bug happens with nightly-2022-12-30, while nightly-2022-12-29 is fine (clippy finishes near-instantly).
Reproducer
I tried this code:
fn meow(_s: impl AsRef<str>) {
}
macro_rules! quad {
($x:stmt) => {
$x
$x
$x
$x
};
}
fn main() {
let i = 0;
quad!(quad!(quad!(quad!(quad!(meow(format!("abc{i}")))))));
}
(adjust amount of quad!
to taste; the above will reliably OOM my machine)
I expected to see this happen:
Clippy finishes near-instantly.
Instead, this happened:
Clippy crashes with OOM after a while.
Version
rustc 1.68.0-nightly (ad8ae0504 2022-12-29)
binary: rustc
commit-hash: ad8ae0504c54bc2bd8306abfcfe8546c1bb16a49
commit-date: 2022-12-29
host: x86_64-unknown-linux-gnu
release: 1.68.0-nightly
LLVM version: 15.0.6
Additional Labels
No response