diff --git a/sway-core/src/language/ty/module.rs b/sway-core/src/language/ty/module.rs index 740c7e14588..eae14ab59aa 100644 --- a/sway-core/src/language/ty/module.rs +++ b/sway-core/src/language/ty/module.rs @@ -20,6 +20,9 @@ pub struct TyModule { pub attributes: transform::AttributesMap, } +unsafe impl Send for TyModule {} +unsafe impl Sync for TyModule {} + impl TyModule { /// Iter on all constants in this module, which means, globals constants and /// local constants, but it does not enter into submodules. diff --git a/sway-core/src/semantic_analysis/namespace/trait_map.rs b/sway-core/src/semantic_analysis/namespace/trait_map.rs index 9cc2880a73b..592da404467 100644 --- a/sway-core/src/semantic_analysis/namespace/trait_map.rs +++ b/sway-core/src/semantic_analysis/namespace/trait_map.rs @@ -6,7 +6,6 @@ use std::{ sync::Arc, }; -use hashbrown::HashSet; use sway_error::{ error::CompileError, handler::{ErrorEmitted, Handler}, @@ -126,7 +125,7 @@ struct TraitEntry { } /// Map of trait name and type to [TraitItems]. -type TraitImpls = Vec; +type TraitImpls = im::Vector; /// Map holding trait implementations for types. /// @@ -135,7 +134,7 @@ type TraitImpls = Vec; #[derive(Clone, Debug, Default)] pub(crate) struct TraitMap { trait_impls: TraitImpls, - satisfied_cache: hashbrown::HashSet, + satisfied_cache: im::HashSet, } pub(crate) enum IsImplSelf { @@ -412,10 +411,11 @@ impl TraitMap { impl_span, }; let entry = TraitEntry { key, value }; - let trait_impls: TraitImpls = vec![entry]; + let mut trait_impls: TraitImpls = im::Vector::new(); + trait_impls.push_back(entry); let trait_map = TraitMap { trait_impls, - satisfied_cache: HashSet::default(), + satisfied_cache: im::HashSet::default(), }; self.extend(trait_map, engines); @@ -540,7 +540,7 @@ impl TraitMap { .as_ref() .map_or(false, |span| span == &trait_decl_span) { - trait_map.trait_impls.push(entry.clone()); + trait_map.trait_impls.push_back(entry.clone()); } } trait_map