Skip to content

Return early if generator_drop.is_some() #5239

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions clippy_lints/src/redundant_clone.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for RedundantClone {
let mir = cx.tcx.optimized_mir(def_id);
let mir_read_only = mir.unwrap_read_only();

if mir.generator_drop.is_some() {
return;
}

let maybe_storage_live_result = MaybeStorageLive
.into_engine(cx.tcx, mir, def_id)
.iterate_to_fixpoint()
Expand Down
9 changes: 9 additions & 0 deletions tests/ui/crashes/ice-5238.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Regression test for #5238

#![feature(generators, generator_trait)]

fn main() {
let _ = || {
yield;
};
}