Skip to content

Clippy crashes on simple method returning impl PartialOrd #10041

Closed
@djkoloski

Description

@djkoloski

Summary

This is probably caused by #9733 per a crash analysis:

...
#30580 0x0000555c0ff6ebc0 in clippy_utils::ty::contains_ty_adt_constructor_opaque ()
#30581 0x0000555c0ff6ebc0 in clippy_utils::ty::contains_ty_adt_constructor_opaque ()
#30582 0x0000555c0ff6ebc0 in clippy_utils::ty::contains_ty_adt_constructor_opaque ()
#30583 0x0000555c0ff6ebc0 in clippy_utils::ty::contains_ty_adt_constructor_opaque ()
#30584 0x0000555c0fcbb240 in <clippy_lints::methods::Methods as rustc_lint::passes::LateLintPass>::check_impl_item ()
#30585 0x00007fe4894426dd in rustc_hir::intravisit::walk_item::<rustc_lint::late::LateContextAndPass<rustc_lint::late::LateLintPassObjects>> ()
...

Reproducer

I tried this code:

pub struct Bomb;

impl Bomb {
    pub fn explode(&self) -> impl PartialOrd {
        0i32
    }
}

I expected to see this happen:

Clippy does not crash.

Instead, this happened:

Clippy crashes with a stack overflow exception.

Version

rustc 1.65.0 (897e37553 2022-11-02)
binary: rustc
commit-hash: 897e37553bba8b42751c67658967889d11ecd120
commit-date: 2022-11-02
host: x86_64-unknown-linux-gnu
release: 1.65.0
LLVM version: 15.0.0

Additional Labels

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: Clippy is not doing the correct thingI-ICEIssue: Clippy panicked, giving an Internal Compilation Error (ICE) ❄️

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions