diff --git a/nac3artiq/src/lib.rs b/nac3artiq/src/lib.rs index a9d8fa1d3..ca2f2f152 100644 --- a/nac3artiq/src/lib.rs +++ b/nac3artiq/src/lib.rs @@ -1085,7 +1085,7 @@ impl Nac3 { let working_directory = tempfile::Builder::new().prefix("nac3-").tempdir().unwrap(); fs::write(working_directory.path().join("kernel.ld"), include_bytes!("kernel.ld")).unwrap(); - let mut string_store: HashMap = Default::default(); + let mut string_store: HashMap = HashMap::default(); // Keep this list of exceptions in sync with `EXCEPTION_ID_LOOKUP` in `artiq::firmware::ksupport::eh_artiq` // The exceptions declared here must be defined in `artiq.coredevice.exceptions` @@ -1120,10 +1120,11 @@ impl Nac3 { let exn_name = if name.find(':').is_none() { format!("0:artiq.coredevice.exceptions.{name}") } else { - name.to_string() + (*name).to_string() }; - string_store.insert(exn_name, i as i32); + let id = i32::try_from(i).unwrap(); + string_store.insert(exn_name, id); } Ok(Nac3 { diff --git a/nac3artiq/src/symbol_resolver.rs b/nac3artiq/src/symbol_resolver.rs index fa57755dc..f4509fe1c 100644 --- a/nac3artiq/src/symbol_resolver.rs +++ b/nac3artiq/src/symbol_resolver.rs @@ -1536,7 +1536,7 @@ impl SymbolResolver for Resolver { if let Some(id) = string_store.get(s) { *id } else { - let id = string_store.len() as i32; + let id = i32::try_from(string_store.len()).unwrap(); string_store.insert(s.into(), id); id }