Skip to content

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

Merged
bors[bot] merged 1 commit into
masterfrom
make-mod
Apr 17, 2021
Merged

Add -m switch to create a module instead of a lib#510
bors[bot] merged 1 commit into
masterfrom
make-mod

Conversation

@adamgreig

Copy link
Copy Markdown
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
Copy Markdown

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
Copy Markdown
Member

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

@adamgreig

Copy link
Copy Markdown
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
Copy Markdown
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