sp-api: Support expanding the macro code (#13573)

* sp-api: Support expanding the macro code

This pr introduces the `expander` crate to expand the generated source code into a file. This gives
better error reporting when trying to fix issues in the macro itself as Rustc will point to the line
in this file. The feature can be enabled by setting `SP_API_EXPAND=1` at compile time.

Besides that the generated code is changed to fix warnings in the exanped version.

* Fixes
This commit is contained in:
Bastian Köcher authored and GitHub committed 2023-03-14 22:14:58 +01:00
1 parent ef165cec3e
commit 4ef1d0df02
9 files changed
+124 -101

No files matched your search

@@ -1,10 +1,10 @@
error[E0433]: failed to resolve: could not find `ApiV4` in `runtime_decl_for_Api`
error[E0433]: failed to resolve: could not find `ApiV4` in `runtime_decl_for_api`
--> tests/ui/impl_missing_version.rs:21:13
|
21 | impl self::Api<Block> for Runtime {
| ^^^ could not find `ApiV4` in `runtime_decl_for_Api`
| ^^^ could not find `ApiV4` in `runtime_decl_for_api`
error[E0405]: cannot find trait `ApiV4` in module `self::runtime_decl_for_Api`
error[E0405]: cannot find trait `ApiV4` in module `self::runtime_decl_for_api`
--> tests/ui/impl_missing_version.rs:21:13
|
11 | pub trait Api {