Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

sp-api: Support expanding the macro code #13573

Merged
merged 2 commits into from
Mar 14, 2023
Merged

Conversation

bkchr
Copy link
Member

@bkchr bkchr commented Mar 9, 2023

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 code generation is changed to fix warnings in the expanded version.

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.
@bkchr bkchr added A0-please_review Pull request needs code review. D3-trivial 🧸 PR contains trivial changes in a runtime directory that do not require an audit B0-silent Changes should not be mentioned in any release notes C1-low PR touches the given topic and has a low impact on builders. labels Mar 9, 2023
@paritytech-cicd-pr
Copy link

The CI pipeline was cancelled due to failure one of the required jobs.
Job name: test-linux-stable
Logs: https://gitlab.parity.io/parity/mirrors/substrate/-/jobs/2505221

@bkchr bkchr requested a review from a team March 13, 2023 20:57
Copy link
Contributor

@melekes melekes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@bkchr bkchr requested a review from a team March 14, 2023 08:19
Copy link
Contributor

@michalkucharczyk michalkucharczyk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice :)

@bkchr bkchr merged commit 9eafc96 into master Mar 14, 2023
@bkchr bkchr deleted the bkchr-runtime-api-expander branch March 14, 2023 21:15
ukint-vs pushed a commit to gear-tech/substrate that referenced this pull request Apr 10, 2023
* 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
);
assert_eq!(
&<dyn ApiWithCustomVersion::<Block>>::ID,
&runtime_decl_for_ApiWithCustomVersion::ID,
&runtime_decl_for_api_with_custom_version::ID,
);
assert_eq!(<dyn ApiWithCustomVersion::<Block>>::VERSION, 2);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ya, ibne :)

nathanwhit pushed a commit to nathanwhit/substrate that referenced this pull request Jul 19, 2023
* 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
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A0-please_review Pull request needs code review. B0-silent Changes should not be mentioned in any release notes C1-low PR touches the given topic and has a low impact on builders. D3-trivial 🧸 PR contains trivial changes in a runtime directory that do not require an audit
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants