AMBIGUOUS_WIDE_POINTER_COMPARISONS in rustc_lint::types - Rust
Description: The `ambiguous_wide_pointer_comparisons` lint checks comparison of `*const/*mut ?Sized` as the operands.

Skip to main content

## AMBIGUOUS_WIDE_POINTER_COMPARISONS

# Static AMBIGUOUS_WIDE_POINTER_COMPARISONS

Source

    static AMBIGUOUS_WIDE_POINTER_COMPARISONS: &Lint

Expand description

The `ambiguous_wide_pointer_comparisons` lint checks comparison of `*const/*mut ?Sized` as the operands.

#### §Example

    let ab = (A, B);
    let a = &ab.0 as *const dyn T;
    let b = &ab.1 as *const dyn T;

    let _ = a == b;

{{produces}}

#### §Explanation

The comparison includes metadata which may not be expected.