path attribute is silently accepted and ignored for inline mod items. #13156

pnkfelix opened this Issue Mar 26, 2014 · 1 comment


None yet

3 participants


Consider the following program

#[path=""] mod q {
    pub fn q_main() { println!("Hello World"); }

fn main() { q::q_main() }

I don't know if this is considered a bug or a feature, but we should probably emit a warning when we encounter that useless path attribute attached to q above.

gkoz commented Feb 2, 2016

Doesn't seem useless to me. The reference gives this seemingly reasonable example:

The directories and files used for loading external file modules can be influenced with the path attribute.

#[path = "thread_files"]
mod thread {
    // Load the `local_data` module from `thread_files/`
    #[path = ""]
    mod local_data;

Now suppose you're in a build script and want to include src/ Is there a better way than

// This module hides some optional stuff
#[path = ""]
mod thread {
    #[path = "src/"]
    mod local_data;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment