Skip to content

the method exists but the following trait bounds were not satisfied repeats the bounds multiple times #35677

Closed
@nagisa

Description

@nagisa
use std::collections::HashMap;
fn intersect_map<K, V>(this: &mut HashMap<K, V>, other: HashMap<K, V>) -> bool {
    this.drain()
}

reports

note: the method `drain` exists but the following trait bounds were not satisfied: `K : std::cmp::Eq`, `K : std::hash::Hash`, `K : std::cmp::Eq`, `K : std::hash::Hash`

Note how it reports about K missing necessary bounds twice.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsC-bugCategory: This is a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions