mirror of
https://github.com/rtic-rs/rtic.git
synced 2024-11-24 04:32:52 +01:00
Merge #171
171: [NFC] fix nightly ci r=japaric a=japaric Co-authored-by: Jorge Aparicio <jorge@japaric.io>
This commit is contained in:
commit
e1e4c98cb9
3 changed files with 23 additions and 23 deletions
|
@ -55,7 +55,7 @@ nightly = ["cortex-m-rtfm-macros/nightly", "heapless/const-fn"]
|
||||||
timer-queue = ["cortex-m-rtfm-macros/timer-queue"]
|
timer-queue = ["cortex-m-rtfm-macros/timer-queue"]
|
||||||
|
|
||||||
[target.x86_64-unknown-linux-gnu.dev-dependencies]
|
[target.x86_64-unknown-linux-gnu.dev-dependencies]
|
||||||
compiletest_rs = "0.3.16"
|
compiletest_rs = "0.3.21"
|
||||||
tempdir = "0.3.7"
|
tempdir = "0.3.7"
|
||||||
|
|
||||||
[package.metadata.docs.rs]
|
[package.metadata.docs.rs]
|
||||||
|
|
|
@ -136,7 +136,7 @@ pub fn app(app: &App, analysis: &Analysis) -> TokenStream {
|
||||||
if res.expr.is_none() {
|
if res.expr.is_none() {
|
||||||
let alias = &ctxt.statics[name];
|
let alias = &ctxt.statics[name];
|
||||||
|
|
||||||
Some(quote!(#alias.set(res.#name);))
|
Some(quote!(#alias.write(res.#name);))
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
@ -275,7 +275,7 @@ fn resources(ctxt: &mut Context, app: &App, analysis: &Analysis) -> proc_macro2:
|
||||||
#(#cfgs)*
|
#(#cfgs)*
|
||||||
#[doc = #symbol]
|
#[doc = #symbol]
|
||||||
static mut #alias: rtfm::export::MaybeUninit<#ty> =
|
static mut #alias: rtfm::export::MaybeUninit<#ty> =
|
||||||
rtfm::export::MaybeUninit::uninitialized();
|
rtfm::export::MaybeUninit::uninit();
|
||||||
)
|
)
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
@ -338,7 +338,7 @@ fn init(ctxt: &mut Context, app: &App, analysis: &Analysis) -> (proc_macro2::Tok
|
||||||
let expr = &assign.right;
|
let expr = &assign.right;
|
||||||
quote!(
|
quote!(
|
||||||
#(#attrs)*
|
#(#attrs)*
|
||||||
unsafe { #alias.set(#expr); }
|
unsafe { #alias.write(#expr); }
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
let left = &assign.left;
|
let left = &assign.left;
|
||||||
|
@ -1281,7 +1281,7 @@ fn tasks(ctxt: &mut Context, app: &App, analysis: &Analysis) -> proc_macro2::Tok
|
||||||
|
|
||||||
if cfg!(feature = "nightly") {
|
if cfg!(feature = "nightly") {
|
||||||
let inits =
|
let inits =
|
||||||
(0..capacity).map(|_| quote!(rtfm::export::MaybeUninit::uninitialized()));
|
(0..capacity).map(|_| quote!(rtfm::export::MaybeUninit::uninit()));
|
||||||
|
|
||||||
quote!(
|
quote!(
|
||||||
#[doc = #scheduleds_symbol]
|
#[doc = #scheduleds_symbol]
|
||||||
|
@ -1294,7 +1294,7 @@ fn tasks(ctxt: &mut Context, app: &App, analysis: &Analysis) -> proc_macro2::Tok
|
||||||
#[doc = #scheduleds_symbol]
|
#[doc = #scheduleds_symbol]
|
||||||
static mut #scheduleds_alias:
|
static mut #scheduleds_alias:
|
||||||
rtfm::export::MaybeUninit<[rtfm::Instant; #capacity_lit]> =
|
rtfm::export::MaybeUninit<[rtfm::Instant; #capacity_lit]> =
|
||||||
rtfm::export::MaybeUninit::uninitialized();
|
rtfm::export::MaybeUninit::uninit();
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1305,7 +1305,7 @@ fn tasks(ctxt: &mut Context, app: &App, analysis: &Analysis) -> proc_macro2::Tok
|
||||||
let inputs_symbol = format!("{}::INPUTS::{}", name, inputs_alias);
|
let inputs_symbol = format!("{}::INPUTS::{}", name, inputs_alias);
|
||||||
let free_symbol = format!("{}::FREE_QUEUE::{}", name, free_alias);
|
let free_symbol = format!("{}::FREE_QUEUE::{}", name, free_alias);
|
||||||
if cfg!(feature = "nightly") {
|
if cfg!(feature = "nightly") {
|
||||||
let inits = (0..capacity).map(|_| quote!(rtfm::export::MaybeUninit::uninitialized()));
|
let inits = (0..capacity).map(|_| quote!(rtfm::export::MaybeUninit::uninit()));
|
||||||
|
|
||||||
items.push(quote!(
|
items.push(quote!(
|
||||||
#[doc = #free_symbol]
|
#[doc = #free_symbol]
|
||||||
|
@ -1322,11 +1322,11 @@ fn tasks(ctxt: &mut Context, app: &App, analysis: &Analysis) -> proc_macro2::Tok
|
||||||
#[doc = #free_symbol]
|
#[doc = #free_symbol]
|
||||||
static mut #free_alias: rtfm::export::MaybeUninit<
|
static mut #free_alias: rtfm::export::MaybeUninit<
|
||||||
rtfm::export::FreeQueue<#capacity_ty>
|
rtfm::export::FreeQueue<#capacity_ty>
|
||||||
> = rtfm::export::MaybeUninit::uninitialized();
|
> = rtfm::export::MaybeUninit::uninit();
|
||||||
|
|
||||||
#[doc = #inputs_symbol]
|
#[doc = #inputs_symbol]
|
||||||
static mut #inputs_alias: rtfm::export::MaybeUninit<[#ty; #capacity_lit]> =
|
static mut #inputs_alias: rtfm::export::MaybeUninit<[#ty; #capacity_lit]> =
|
||||||
rtfm::export::MaybeUninit::uninitialized();
|
rtfm::export::MaybeUninit::uninit();
|
||||||
|
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
@ -1479,7 +1479,7 @@ fn dispatchers(
|
||||||
} else {
|
} else {
|
||||||
data.push(quote!(
|
data.push(quote!(
|
||||||
#[doc = #symbol]
|
#[doc = #symbol]
|
||||||
static mut #ready_alias: #e::MaybeUninit<#ty> = #e::MaybeUninit::uninitialized();
|
static mut #ready_alias: #e::MaybeUninit<#ty> = #e::MaybeUninit::uninit();
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
data.push(quote!(
|
data.push(quote!(
|
||||||
|
@ -1867,14 +1867,14 @@ fn timer_queue(ctxt: &mut Context, app: &App, analysis: &Analysis) -> proc_macro
|
||||||
items.push(quote!(
|
items.push(quote!(
|
||||||
#[doc = #symbol]
|
#[doc = #symbol]
|
||||||
static mut #tq: rtfm::export::MaybeUninit<rtfm::export::TimerQueue<#enum_, #cap>> =
|
static mut #tq: rtfm::export::MaybeUninit<rtfm::export::TimerQueue<#enum_, #cap>> =
|
||||||
rtfm::export::MaybeUninit::uninitialized();
|
rtfm::export::MaybeUninit::uninit();
|
||||||
));
|
));
|
||||||
} else {
|
} else {
|
||||||
items.push(quote!(
|
items.push(quote!(
|
||||||
#[doc = #symbol]
|
#[doc = #symbol]
|
||||||
static mut #tq:
|
static mut #tq:
|
||||||
rtfm::export::MaybeUninit<rtfm::export::TimerQueue<#enum_, #cap>> =
|
rtfm::export::MaybeUninit<rtfm::export::TimerQueue<#enum_, #cap>> =
|
||||||
rtfm::export::MaybeUninit::uninitialized();
|
rtfm::export::MaybeUninit::uninit();
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1945,32 +1945,32 @@ fn pre_init(ctxt: &Context, app: &App, analysis: &Analysis) -> proc_macro2::Toke
|
||||||
// these are `MaybeUninit` arrays
|
// these are `MaybeUninit` arrays
|
||||||
for task in ctxt.tasks.values() {
|
for task in ctxt.tasks.values() {
|
||||||
let inputs = &task.inputs;
|
let inputs = &task.inputs;
|
||||||
exprs.push(quote!(#inputs.set(core::mem::uninitialized());))
|
exprs.push(quote!(#inputs.write(core::mem::uninitialized());))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "timer-queue")]
|
#[cfg(feature = "timer-queue")]
|
||||||
for task in ctxt.tasks.values() {
|
for task in ctxt.tasks.values() {
|
||||||
let scheduleds = &task.scheduleds;
|
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
|
// these are `MaybeUninit` `ReadyQueue`s
|
||||||
for dispatcher in ctxt.dispatchers.values() {
|
for dispatcher in ctxt.dispatchers.values() {
|
||||||
let rq = &dispatcher.ready_queue;
|
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
|
// these are `MaybeUninit` `FreeQueue`s
|
||||||
for task in ctxt.tasks.values() {
|
for task in ctxt.tasks.values() {
|
||||||
let fq = &task.free_queue;
|
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
|
// Initialize the timer queue
|
||||||
if !analysis.timer_queue.tasks.is_empty() {
|
if !analysis.timer_queue.tasks.is_empty() {
|
||||||
let tq = &ctxt.timer_queue;
|
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
|
// Populate the `FreeQueue`s
|
||||||
|
|
|
@ -72,9 +72,9 @@ pub struct MaybeUninit<T> {
|
||||||
|
|
||||||
#[cfg(feature = "nightly")]
|
#[cfg(feature = "nightly")]
|
||||||
impl<T> MaybeUninit<T> {
|
impl<T> MaybeUninit<T> {
|
||||||
pub const fn uninitialized() -> Self {
|
pub const fn uninit() -> Self {
|
||||||
MaybeUninit {
|
MaybeUninit {
|
||||||
inner: core::mem::MaybeUninit::uninitialized(),
|
inner: core::mem::MaybeUninit::uninit(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,8 +86,8 @@ impl<T> MaybeUninit<T> {
|
||||||
self.inner.as_mut_ptr()
|
self.inner.as_mut_ptr()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn set(&mut self, value: T) -> &mut T {
|
pub fn write(&mut self, value: T) -> &mut T {
|
||||||
self.inner.set(value)
|
self.inner.write(value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,7 +102,7 @@ const MSG: &str =
|
||||||
|
|
||||||
#[cfg(not(feature = "nightly"))]
|
#[cfg(not(feature = "nightly"))]
|
||||||
impl<T> MaybeUninit<T> {
|
impl<T> MaybeUninit<T> {
|
||||||
pub const fn uninitialized() -> Self {
|
pub const fn uninit() -> Self {
|
||||||
MaybeUninit { value: None }
|
MaybeUninit { value: None }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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`
|
// NOTE(volatile) we have observed UB when this uses a plain `ptr::write`
|
||||||
unsafe { ptr::write_volatile(&mut self.value, Some(val)) }
|
unsafe { ptr::write_volatile(&mut self.value, Some(val)) }
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue