From f5a4d8e9041d81e8c423727010f99df5fa97616d Mon Sep 17 00:00:00 2001 From: Jorge Aparicio Date: Sun, 23 Jul 2017 20:59:35 -0500 Subject: [PATCH] don't wrap static references in a `Static` --- ci/script.sh | 8 ++------ examples/full-syntax.rs | 4 ++-- examples/modules.rs | 4 ++-- macros/src/trans.rs | 13 ++++--------- 4 files changed, 10 insertions(+), 19 deletions(-) diff --git a/ci/script.sh b/ci/script.sh index 212a48adff..5b9cea7f4a 100644 --- a/ci/script.sh +++ b/ci/script.sh @@ -3,16 +3,12 @@ set -ex main() { if [ $TARGET = x86_64-unknown-linux-gnu ]; then cargo build - cargo test + cargo test --tests return fi xargo build --target $TARGET - for ex in $(ls examples/*); do - ex=$(basename $ex) - ex=${ex%.*} - xargo build --target $TARGET --example $ex - done + xargo test --target $TARGET --examples } main diff --git a/examples/full-syntax.rs b/examples/full-syntax.rs index 7ac42e399a..6965a63b68 100644 --- a/examples/full-syntax.rs +++ b/examples/full-syntax.rs @@ -47,9 +47,9 @@ fn init_(_p: init::Peripherals, _r: init::Resources) {} fn idle_(t: &mut Threshold, mut r: idle::Resources) -> ! { loop { - **r.OWNED != **r.OWNED; + *r.OWNED != *r.OWNED; - if **r.OWNED { + if *r.OWNED { if r.SHARED.claim(t, |shared, _| **shared) { rtfm::wfi(); } diff --git a/examples/modules.rs b/examples/modules.rs index f938461278..aabada4538 100644 --- a/examples/modules.rs +++ b/examples/modules.rs @@ -50,9 +50,9 @@ mod main { pub fn idle(t: &mut Threshold, mut r: ::idle::Resources) -> ! { loop { - **r.OWNED != **r.OWNED; + *r.OWNED != *r.OWNED; - if **r.OWNED { + if *r.OWNED { if r.SHARED.claim(t, |shared, _| **shared) { rtfm::wfi(); } diff --git a/macros/src/trans.rs b/macros/src/trans.rs index 293c8d2c9d..0a02d3e291 100644 --- a/macros/src/trans.rs +++ b/macros/src/trans.rs @@ -91,24 +91,19 @@ fn idle( let ty = &resource.ty; rfields.push(quote! { - pub #name: &'static mut ::#krate::Static<#ty>, + pub #name: &'static mut #ty, }); rexprs.push(quote! { - #name: #krate::Static::ref_mut( - &mut #super_::#name, - ), + #name: &mut #super_::#name, }); } else { rfields.push(quote! { - pub #name: - &'static mut ::#krate::Static<::#device::#name>, + pub #name: &'static mut ::#device::#name, }); rexprs.push(quote! { - #name: ::#krate::Static::ref_mut( - &mut *::#device::#name.get(), - ), + #name: &mut *::#device::#name.get(), }); } } else {