diff --git a/examples/generics.rs b/examples/generics.rs index afcafa0a4026a50497667761ff409fd9bfcf6d75..bc2fe7a81b8fc61c52cc676d9d239e775750e347 100644 --- a/examples/generics.rs +++ b/examples/generics.rs @@ -32,8 +32,8 @@ app! { }, } -fn init(p: init::Peripherals) -> init::LateResourceValues { - init::LateResourceValues { +fn init(p: init::Peripherals) -> init::LateResources { + init::LateResources { GPIOA: p.device.GPIOA, SPI1: p.device.SPI1, } diff --git a/examples/late-resources.rs b/examples/late-resources.rs index 337fbdfa7a698fdd109c46235d4ffebd2005c159..69a0ce8ae02d1c84bd8ef77159d16b25252cd7d3 100644 --- a/examples/late-resources.rs +++ b/examples/late-resources.rs @@ -55,7 +55,7 @@ app! { } // The signature of `init` is now required to have a specific return type. -fn init(_p: init::Peripherals, _r: init::Resources) -> init::LateResourceValues { +fn init(_p: init::Peripherals, _r: init::Resources) -> init::LateResources { // `init::Resources` does not contain `IP_ADDRESS`, since it is not yet // initialized. //_r.IP_ADDRESS; // doesn't compile @@ -63,7 +63,7 @@ fn init(_p: init::Peripherals, _r: init::Resources) -> init::LateResourceValues // ...obtain value for IP_ADDRESS from EEPROM/DHCP... let ip_address = 0x7f000001; - init::LateResourceValues { + init::LateResources { // This struct will contain fields for all resources with omitted // initializers. IP_ADDRESS: ip_address, diff --git a/macros/src/trans.rs b/macros/src/trans.rs index bc69f24e95ae7101e9280a7926918fcfa9db9af2..96631d5d0371ad18923dca4b2964c820456f4ce1 100644 --- a/macros/src/trans.rs +++ b/macros/src/trans.rs @@ -234,17 +234,17 @@ fn init(app: &App, main: &mut Vec<Tokens>, root: &mut Vec<Tokens>) { root.push(quote! { #[allow(non_camel_case_types)] #[allow(non_snake_case)] - pub struct _initLateResourceValues { + pub struct _initLateResources { #(#fields)* } }); mod_items.push(quote! { - pub use ::_initLateResourceValues as LateResourceValues; + pub use ::_initLateResources as LateResources; }); // `init` must return the initialized resources - ret = Some(quote!( -> ::init::LateResourceValues)); + ret = Some(quote!( -> ::init::LateResources)); } root.push(quote! { diff --git a/src/examples/_5_late_resources.rs b/src/examples/_5_late_resources.rs index 8a5b6e169e8cc919ef922ae3d078499ab2dada11..8df6716cbac546cc8368012223b04b5ac70f9ea2 100644 --- a/src/examples/_5_late_resources.rs +++ b/src/examples/_5_late_resources.rs @@ -57,7 +57,7 @@ //! } //! //! // The signature of `init` is now required to have a specific return type. -//! fn init(_p: init::Peripherals, _r: init::Resources) -> init::LateResourceValues { +//! fn init(_p: init::Peripherals, _r: init::Resources) -> init::LateResources { //! // `init::Resources` does not contain `IP_ADDRESS`, since it is not yet //! // initialized. //! //_r.IP_ADDRESS; // doesn't compile @@ -65,7 +65,7 @@ //! // ...obtain value for IP_ADDRESS from EEPROM/DHCP... //! let ip_address = 0x7f000001; //! -//! init::LateResourceValues { +//! init::LateResources { //! // This struct will contain fields for all resources with omitted //! // initializers. //! IP_ADDRESS: ip_address, diff --git a/tests/cfail/late-resource-init.rs b/tests/cfail/late-resource-init.rs index a997b5c232ee20d6d829b929aa7ddd89348ef64e..cb37887f70100ba45856dbb1b84b74624ccea972 100644 --- a/tests/cfail/late-resource-init.rs +++ b/tests/cfail/late-resource-init.rs @@ -30,12 +30,12 @@ app! { }, } -fn init(_p: init::Peripherals, r: init::Resources) -> init::LateResourceValues { +fn init(_p: init::Peripherals, r: init::Resources) -> init::LateResources { // Try to use a resource that's not yet initialized: r.LATE; //~^ error: no field `LATE` - init::LateResourceValues { + init::LateResources { LATE: 0, } }