aboutsummaryrefslogtreecommitdiff
path: root/macros/src/check.rs
diff options
context:
space:
mode:
authorGravatar Jorge Aparicio <jorge@japaric.io> 2019-04-21 20:02:59 +0200
committerGravatar Jorge Aparicio <jorge@japaric.io> 2019-05-01 20:49:25 +0200
commita452700628e352e6ac01da9e16223a47752ca860 (patch)
treec04a58222ba95e59d6b6013b5d2314068de6b1d0 /macros/src/check.rs
parente6fb2f216fccc09d8e996525dcef3ffb2004f1ec (diff)
downloadrtic-a452700628e352e6ac01da9e16223a47752ca860.tar.gz
rtic-a452700628e352e6ac01da9e16223a47752ca860.tar.zst
rtic-a452700628e352e6ac01da9e16223a47752ca860.zip
implement RFCs 147 and 155, etc.
This commit: - Implements RFC 147: "all functions must be safe" - Implements RFC 155: "explicit Context parameter" - Implements the pending breaking change #141: reject assign syntax in `init` (which was used to initialize late resources) - Refactors code generation to make it more readable -- there are no more random identifiers in the output -- and align it with the book description of RTFM internals. - Makes the framework hard depend on `core::mem::MaybeUninit` and thus will require nightly until that API is stabilized. - Fixes a ceiling analysis bug where the priority of the system timer was not considered in the analysis. - Shrinks the size of all the internal queues by turning `AtomicUsize` indices into `AtomicU8`s. - Removes the integration with `owned_singleton`.
Diffstat (limited to 'macros/src/check.rs')
-rw-r--r--macros/src/check.rs21
1 files changed, 6 insertions, 15 deletions
diff --git a/macros/src/check.rs b/macros/src/check.rs
index 4adc2c17..6ba7d375 100644
--- a/macros/src/check.rs
+++ b/macros/src/check.rs
@@ -35,21 +35,12 @@ pub fn app(app: &App) -> parse::Result<()> {
}
}
- // Check that all late resources have been initialized in `#[init]` if `init` has signature
- // `fn()`
- if !app.init.returns_late_resources {
- for res in
- app.resources
- .iter()
- .filter_map(|(name, res)| if res.expr.is_none() { Some(name) } else { None })
- {
- if app.init.assigns.iter().all(|assign| assign.left != *res) {
- return Err(parse::Error::new(
- res.span(),
- "late resources MUST be initialized at the end of `init`",
- ));
- }
- }
+ // Check that `init` returns `LateResources` if there's any declared late resource
+ if !app.init.returns_late_resources && app.resources.iter().any(|(_, res)| res.expr.is_none()) {
+ return Err(parse::Error::new(
+ app.init.span,
+ "late resources have been specified so `init` must return `init::LateResources`",
+ ));
}
// Check that all referenced tasks have been declared