Skip to content

Commit

Permalink
switch to hashbrown::HashSet - working with explicit type parameter i…
Browse files Browse the repository at this point in the history
…n hashbrown::HashSet::contains call
  • Loading branch information
brody4hire committed Jan 19, 2025
1 parent e2ae32c commit aabdd17
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
5 changes: 4 additions & 1 deletion naga/src/back/spv/writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,10 @@ impl Writer {
let selected = match self.capabilities_available {
None => first,
Some(ref available) => {
match capabilities.iter().find(|cap| available.contains(cap)) {
match capabilities
.iter()
.find(|cap| available.contains::<spirv::Capability>(cap))
{
Some(&cap) => cap,
None => {
return Err(Error::MissingCapabilities(what, capabilities.to_vec()))
Expand Down
5 changes: 3 additions & 2 deletions naga/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -287,9 +287,10 @@ pub const ABSTRACT_WIDTH: Bytes = 8;
/// To construct a new instance: `FastHashMap::default()`
pub type FastHashMap<K, T> =
hashbrown::HashMap<K, T, std::hash::BuildHasherDefault<rustc_hash::FxHasher>>;
// XXX XXX STILL USING HashSet from std::collections - USING hashbrown::HashSet for FastHashSet BREAKS spirv - XXX XXX NEEDS INVESTIGATION
/// Hash set that is faster but not resilient to DoS attacks.
pub type FastHashSet<K> = rustc_hash::FxHashSet<K>;
/// (Similar to rustc_hash::FxHashSet but using hashbrown::HashSet instead of std::collections::HashMap.)
pub type FastHashSet<K> =
hashbrown::HashSet<K, std::hash::BuildHasherDefault<rustc_hash::FxHasher>>;

/// Insertion-order-preserving hash set (`IndexSet<K>`), but with the same
/// hasher as `FastHashSet<K>` (faster but not resilient to DoS attacks).
Expand Down

0 comments on commit aabdd17

Please sign in to comment.