diff --git a/lib/api/src/store.rs b/lib/api/src/store.rs index 3dea7e620a0..1b11363050b 100644 --- a/lib/api/src/store.rs +++ b/lib/api/src/store.rs @@ -86,6 +86,11 @@ impl Store { &self.inner.engine } + /// Returns mutable reference to [`Engine`] + pub fn engine_mut(&mut self) -> &mut Engine { + &mut self.inner.engine + } + /// Checks whether two stores are identical. A store is considered /// equal to another store if both have the same engine. pub fn same(a: &Self, b: &Self) -> bool { diff --git a/lib/cli/src/commands/compile.rs b/lib/cli/src/commands/compile.rs index 9ee969574a6..a01cacae71b 100644 --- a/lib/cli/src/commands/compile.rs +++ b/lib/cli/src/commands/compile.rs @@ -57,9 +57,9 @@ impl Compile { Target::new(target_triple.clone(), features) }) .unwrap_or_default(); - let (store, compiler_type) = self.store.get_store_for_target(target.clone())?; + let (mut store, compiler_type) = self.store.get_store_for_target(target.clone())?; - let mut engine = store.engine().clone(); + let engine = store.engine_mut(); let hash_algorithm = self.hash_algorithm.unwrap_or_default().into(); engine.set_hash_algorithm(Some(hash_algorithm));