Skip to content

mutable_key_type false positive for raw pointers #6745

Closed
@YaLTeR

Description

@YaLTeR

Lint name: mutable_key_type

I tried this code:

use std::collections::HashSet;

fn main() {
   let s: HashSet<*mut ()> = HashSet::new(); 
}

I expected to see this happen: lint not triggered because raw pointers are compared and hashed by pointer value rather than by pointed-to value

Instead, this happened: lint triggered

https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=601da4e6cf6eb0b2c178c32fcab35390

Meta

  • cargo clippy -V: clippy 0.1.52 (d1206f9 2021-02-15)
  • rustc -Vv:
    rustc 1.52.0-nightly (d1206f950 2021-02-15)
    binary: rustc
    commit-hash: d1206f950ffb76c76e1b74a19ae33c2b7d949454
    commit-date: 2021-02-15
    host: x86_64-unknown-linux-gnu
    release: 1.52.0-nightly
    LLVM version: 11.0.1
    

Metadata

Metadata

Assignees

Labels

C-bugCategory: Clippy is not doing the correct thingI-false-positiveIssue: The lint was triggered on code it shouldn't havegood first issueThese issues are a good way to get started with Clippy

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions