summaryrefslogtreecommitdiffstats
path: root/src/test/ui/imports/extern-crate-self/extern-crate-self-macro-self.rs
blob: 009a92e877645ace1e68176b8edd52d4f8836826 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// 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);
}