Skip to content

Clippy hangs on .unwrap().unwrap() as usize on nightly #12506

Closed
@stevenengler

Description

@stevenengler

Summary

When running cargo clippy on a library with the following code using rust nightly, it hangs and never completes. The clippy process CPU usage is at 100% of a core while it's running.

If anyone has a better title, please update it since I'm not sure exactly what's causing the bug.

Reproducer

fn _foo() -> usize {
    let bar: Result<Option<i64>, u32> = Ok(Some(10));
    bar.unwrap().unwrap() as usize
}

It hangs with the output:

    Checking clippy-bug v0.1.0 (/tmp/clippy-bug)
    Building [                             ] 0/1: clippy-bug

(I've waited 5 minutes, so I'm assuming it would hang forever.)

Version

rustc 1.79.0-nightly (eb45c8444 2024-03-17)
binary: rustc
commit-hash: eb45c844407968ea54df0d9870ebce9e3235b706
commit-date: 2024-03-17
host: x86_64-unknown-linux-gnu
release: 1.79.0-nightly
LLVM version: 18.1.2

Additional Labels

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: Clippy is not doing the correct thing

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions