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

non-public mod_path? #2

Open
dwrensha opened this issue May 21, 2015 · 1 comment
Open

non-public mod_path? #2

dwrensha opened this issue May 21, 2015 · 1 comment

Comments

@dwrensha
Copy link

It looks like mod_path always inserts the pub keyword.

Would it make sense to change this, so that

mod_path! foo (concat!(env!("OUT_DIR"), "/hello.rs"))

would instead expand to

#[path = "path/to/OUT_DIR/hello.rs"]
mod foo;

and maybe

pub_mod_path! foo (concat!(env!("OUT_DIR"), "/hello.rs"))

would expand to

#[path = "path/to/OUT_DIR/hello.rs"]
pub mod foo;

?

@SimonSapin
Copy link
Owner

I’d take a PR to do this.

Note though that the use case for mod_path became much weaker when rust-lang/rust#20179 landed. I prefer using something like this:

#[macro_use]
mod foo {
    include!(concat!(env!("OUT_DIR"), "/foo.rs"));
}

#[macro_use] had to be moved there from #![macro_use] in the included file because of rust-lang/rfcs#752

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants