Skip to content

Commit

Permalink
Auto merge of #117758 - Urgau:lint_pointer_trait_comparisons, r=david…
Browse files Browse the repository at this point in the history
…twco

Add lint against ambiguous wide pointer comparisons

This PR is the resolution of rust-lang/rust#106447 decided in rust-lang/rust#117717 by T-lang.

## `ambiguous_wide_pointer_comparisons`

*warn-by-default*

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

### Example

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

let _ = a == b;
```

### Explanation

The comparison includes metadata which may not be expected.

-------

This PR also drops `clippy::vtable_address_comparisons` which is superseded by this one.

~~One thing: is the current naming right? `invalid` seems a bit too much.~~

Fixes rust-lang/rust#117717
  • Loading branch information
bors committed Dec 11, 2023
2 parents f1a5783 + 366e6e5 commit df0fd1f
Showing 0 changed files with 0 additions and 0 deletions.

0 comments on commit df0fd1f

Please sign in to comment.