From cfc97488db01ad09ebb62ab5ed4ea9b8b6f35912 Mon Sep 17 00:00:00 2001 From: Viktor Sonesten Date: Wed, 21 Apr 2021 15:25:58 +0200 Subject: [PATCH] book: detail import resolving for 0.6 migration --- book/en/src/migration/migration_v5.md | 41 ++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/book/en/src/migration/migration_v5.md b/book/en/src/migration/migration_v5.md index 8edefd2dfb..d56d7ffd26 100644 --- a/book/en/src/migration/migration_v5.md +++ b/book/en/src/migration/migration_v5.md @@ -30,7 +30,46 @@ mod app { Now that a regular Rust module is used it means it is possible to have custom user code within that module. -Additionally, it means that `use`-statements for resources etc may be required. +Additionally, it means that `use`-statements for resources used in user +code must be moved inside `mod app`, or be referred to with `super`. For +example, change: + +```rust +use some_crate::some_func; + +#[rtic::app(/* .. */)] +const APP: () = { + fn func() { + some_crate::some_func(); + } +}; +``` + +into + +```rust +#[rtic::app(/* .. */)] +mod app { + use some_crate::some_func; + + fn func() { + some_crate::some_func(); + } +} +``` + +or + +```rust +use some_crate::some_func; + +#[rtic::app(/* .. */)] +mod app { + fn func() { + super::some_crate::some_func(); + } +}; +``` ## Move Dispatchers from `extern "C"` to app arguments.