rust/tests/ui/imports/extern-crate-self/extern-crate-self-macro-self.rs
2023-01-11 09:32:08 +00:00

17 lines
320 B
Rust

// run-pass
// Test that a macro can correctly expand `self` in
// an `extern crate self as ALIAS` item.
fn the_answer() -> usize { 42 }
macro_rules! extern_something {
($alias:ident) => { extern crate $alias as the_alias; }
}
extern_something!(self);
fn main() {
assert_eq!(the_alias::the_answer(), 42);
}