aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--Cargo.toml2
-rw-r--r--macros/src/codegen.rs14
-rw-r--r--src/export.rs6
3 files changed, 11 insertions, 11 deletions
diff --git a/Cargo.toml b/Cargo.toml
index 12b39235..1d70823f 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -55,7 +55,7 @@ nightly = ["cortex-m-rtfm-macros/nightly", "heapless/const-fn"]
timer-queue = ["cortex-m-rtfm-macros/timer-queue"]
[target.x86_64-unknown-linux-gnu.dev-dependencies]
-compiletest_rs = "0.3.16"
+compiletest_rs = "0.3.21"
tempdir = "0.3.7"
[package.metadata.docs.rs]
diff --git a/macros/src/codegen.rs b/macros/src/codegen.rs
index 1d201c08..8a220fea 100644
--- a/macros/src/codegen.rs
+++ b/macros/src/codegen.rs
@@ -136,7 +136,7 @@ pub fn app(app: &App, analysis: &Analysis) -> TokenStream {
if res.expr.is_none() {
let alias = &ctxt.statics[name];
- Some(quote!(#alias.set(res.#name);))
+ Some(quote!(#alias.write(res.#name);))
} else {
None
}
@@ -338,7 +338,7 @@ fn init(ctxt: &mut Context, app: &App, analysis: &Analysis) -> (proc_macro2::Tok
let expr = &assign.right;
quote!(
#(#attrs)*
- unsafe { #alias.set(#expr); }
+ unsafe { #alias.write(#expr); }
)
} else {
let left = &assign.left;
@@ -1945,32 +1945,32 @@ fn pre_init(ctxt: &Context, app: &App, analysis: &Analysis) -> proc_macro2::Toke
// these are `MaybeUninit` arrays
for task in ctxt.tasks.values() {
let inputs = &task.inputs;
- exprs.push(quote!(#inputs.set(core::mem::uninitialized());))
+ exprs.push(quote!(#inputs.write(core::mem::uninitialized());))
}
#[cfg(feature = "timer-queue")]
for task in ctxt.tasks.values() {
let scheduleds = &task.scheduleds;
- exprs.push(quote!(#scheduleds.set(core::mem::uninitialized());))
+ exprs.push(quote!(#scheduleds.write(core::mem::uninitialized());))
}
// these are `MaybeUninit` `ReadyQueue`s
for dispatcher in ctxt.dispatchers.values() {
let rq = &dispatcher.ready_queue;
- exprs.push(quote!(#rq.set(rtfm::export::ReadyQueue::new_sc());))
+ exprs.push(quote!(#rq.write(rtfm::export::ReadyQueue::new_sc());))
}
// these are `MaybeUninit` `FreeQueue`s
for task in ctxt.tasks.values() {
let fq = &task.free_queue;
- exprs.push(quote!(#fq.set(rtfm::export::FreeQueue::new_sc());))
+ exprs.push(quote!(#fq.write(rtfm::export::FreeQueue::new_sc());))
}
}
// Initialize the timer queue
if !analysis.timer_queue.tasks.is_empty() {
let tq = &ctxt.timer_queue;
- exprs.push(quote!(#tq.set(rtfm::export::TimerQueue::new(p.SYST));));
+ exprs.push(quote!(#tq.write(rtfm::export::TimerQueue::new(p.SYST));));
}
// Populate the `FreeQueue`s
diff --git a/src/export.rs b/src/export.rs
index 495468e1..5550bdec 100644
--- a/src/export.rs
+++ b/src/export.rs
@@ -86,8 +86,8 @@ impl<T> MaybeUninit<T> {
self.inner.as_mut_ptr()
}
- pub fn set(&mut self, value: T) -> &mut T {
- self.inner.set(value)
+ pub fn write(&mut self, value: T) -> &mut T {
+ self.inner.write(value)
}
}
@@ -138,7 +138,7 @@ impl<T> MaybeUninit<T> {
}
}
- pub fn set(&mut self, val: T) {
+ pub fn write(&mut self, val: T) {
// NOTE(volatile) we have observed UB when this uses a plain `ptr::write`
unsafe { ptr::write_volatile(&mut self.value, Some(val)) }
}