diff options
author | 2019-01-15 22:42:50 -0800 | |
---|---|---|
committer | 2019-02-16 00:22:22 +0100 | |
commit | 2f89688ca974944781878a74873801597c0b1f11 (patch) | |
tree | e837ee30f5ccdfaa62c83791fd4544f6f861b2f3 /macros/src/codegen.rs | |
parent | fdba26525c4a190d0275dd3b5f3a154fa189a799 (diff) | |
download | rtic-2f89688ca974944781878a74873801597c0b1f11.tar.gz rtic-2f89688ca974944781878a74873801597c0b1f11.tar.zst rtic-2f89688ca974944781878a74873801597c0b1f11.zip |
Make builds reproducible
This is done by using `BTreeMap`s and `BTreeSet`s to get deterministic
ordering.
Also updated the CI job to check reproducibility of all examples.
Diffstat (limited to 'macros/src/codegen.rs')
-rw-r--r-- | macros/src/codegen.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/macros/src/codegen.rs b/macros/src/codegen.rs index af3def64..a96eaef9 100644 --- a/macros/src/codegen.rs +++ b/macros/src/codegen.rs @@ -2,7 +2,7 @@ use proc_macro::TokenStream; use std::{ - collections::HashMap, + collections::{BTreeMap, HashMap}, sync::atomic::{AtomicUsize, Ordering}, time::{SystemTime, UNIX_EPOCH}, }; @@ -20,13 +20,13 @@ use crate::{ // NOTE to avoid polluting the user namespaces we map some identifiers to pseudo-hygienic names. // In some instances we also use the pseudo-hygienic names for safety, for example the user should // not modify the priority field of resources. -type Aliases = HashMap<Ident, Ident>; +type Aliases = BTreeMap<Ident, Ident>; struct Context { // Alias #[cfg(feature = "timer-queue")] baseline: Ident, - dispatchers: HashMap<u8, Dispatcher>, + dispatchers: BTreeMap<u8, Dispatcher>, // Alias (`fn`) idle: Ident, // Alias (`fn`) @@ -41,7 +41,7 @@ struct Context { schedule_enum: Ident, // Task -> Alias (`fn`) schedule_fn: Aliases, - tasks: HashMap<Ident, Task>, + tasks: BTreeMap<Ident, Task>, // Alias (`struct` / `static mut`) timer_queue: Ident, } @@ -66,7 +66,7 @@ impl Default for Context { Context { #[cfg(feature = "timer-queue")] baseline: mk_ident(None), - dispatchers: HashMap::new(), + dispatchers: BTreeMap::new(), idle: mk_ident(Some("idle")), init: mk_ident(Some("init")), priority: mk_ident(None), @@ -74,7 +74,7 @@ impl Default for Context { resources: HashMap::new(), schedule_enum: mk_ident(None), schedule_fn: Aliases::new(), - tasks: HashMap::new(), + tasks: BTreeMap::new(), timer_queue: mk_ident(None), } } @@ -2034,7 +2034,7 @@ fn mk_ident(name: Option<&str>) -> Ident { } // `once = true` means that these locals will be called from a function that will run *once* -fn mk_locals(locals: &HashMap<Ident, Static>, once: bool) -> proc_macro2::TokenStream { +fn mk_locals(locals: &BTreeMap<Ident, Static>, once: bool) -> proc_macro2::TokenStream { let lt = if once { Some(quote!('static)) } else { None }; let locals = locals |