Skip to content

use_mocks isn't compatible with Rust 2018 uniform paths #10

@asomers

Description

@asomers

The #[use_mocks] macro panics when faced with use statements that use Rust 2018 uniform paths. For example, this code:

#![feature(proc_macro_hygiene)]
struct Foo();

#[cfg(test)]
mod tests {
    use galvanic_mock::*;

    #[use_mocks]
    mod t {
        use crate::Foo;
    }
}

will fail to build with this error:

error: custom attribute panicked
 --> src/lib.rs:8:5
  |
8 |     #[use_mocks]
  |     ^^^^^^^^^^^^
  |
  = help: message: called `Result::unwrap()` on an `Err` value: "failed to parse item: \"mod t {\\n    use crate::Foo;\\n}\""

error: aborting due to previous error

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions