Skip to content

Add -m switch to create a module instead of a lib #510

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 17, 2021
Merged

Add -m switch to create a module instead of a lib #510

merged 1 commit into from
Apr 17, 2021

Conversation

adamgreig
Copy link
Member

Currently projects like stm32-rs have to strip out all the attributes during build to create a file suitable for use as a module. This PR adds a new -m switch instead, which causes a mod.rs file to be created without the inner attributes or the pub mod generic/use generic::* lines which would live in the top-level lib.rs.

@adamgreig adamgreig requested a review from a team as a code owner April 17, 2021 16:19
@rust-highfive
Copy link

r? @Emilgardis

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-tools labels Apr 17, 2021
@burrbull
Copy link
Member

Have you tested all 4 modes?
-m and -g disables/enabled all/only one

@adamgreig
Copy link
Member Author

I guess ideally we should add a CI test for both -g and -m (and combinations) but it didn't seem too easy to add to the current setup.

svd2rust works OK with nothing, -m, -g, and -m -g, and stm32-rs builds a good PAC with -m or -m -g.

@burrbull
Copy link
Member

bors r+

@bors bors bot merged commit cbb1ade into master Apr 17, 2021
@bors bors bot deleted the make-mod branch April 17, 2021 17:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-tools
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants