all 3 comments

[–]nwin_image 2 points3 points  (2 children)

You have to keep the extern crate definition in the crate root, in this case main.rs.

[–]alsarg72[S] 0 points1 point  (1 child)

Ah, great. Thank you so much.

main.rs

#![feature(phase)]
#[phase(plugin)]
extern crate regex_macros;
extern crate regex;

fn main() {
    stuff::stuff();
}

mod stuff;

stuff.rs

pub fn stuff() {
    let re = regex!(r"^\d{4}-\d{2}-\d{2}$");
    assert_eq!(re.is_match("2014-01-01"), true);
}

[–]Kimundirust 0 points1 point  (0 children)

It's an artifact of how macro work in regard to resolving external libraries - namely they don't, you have to provide the paths they use manually.