2019-07-14 05:34:13 -05:00
|
|
|
// check-pass
|
2018-09-25 16:51:35 -05:00
|
|
|
#![allow(dead_code)]
|
2017-11-29 03:05:31 -06:00
|
|
|
// ignore-pretty pretty-printing is unhygienic
|
|
|
|
|
|
|
|
// aux-build:legacy_interaction.rs
|
|
|
|
|
2018-04-27 23:32:00 -05:00
|
|
|
#![feature(decl_macro)]
|
2017-11-29 03:05:31 -06:00
|
|
|
#[allow(unused)]
|
|
|
|
|
|
|
|
extern crate legacy_interaction;
|
|
|
|
// ^ defines
|
|
|
|
// ```rust
|
|
|
|
// macro_rules! m {
|
|
|
|
// () => {
|
2019-07-14 05:34:13 -05:00
|
|
|
// fn f() {} // (1)
|
2017-11-29 03:05:31 -06:00
|
|
|
// g() // (2)
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// ```rust
|
|
|
|
|
|
|
|
mod def_site {
|
|
|
|
// Unless this macro opts out of hygiene, it should resolve the same wherever it is invoked.
|
|
|
|
pub macro m2() {
|
|
|
|
::legacy_interaction::m!();
|
|
|
|
f(); // This should resolve to (1)
|
|
|
|
fn g() {} // We want (2) resolve to this, not to (4)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
mod use_site {
|
|
|
|
fn test() {
|
|
|
|
fn f() -> bool { true } // (3)
|
|
|
|
fn g() -> bool { true } // (4)
|
|
|
|
|
|
|
|
::def_site::m2!();
|
|
|
|
|
|
|
|
let _: bool = f(); // This should resolve to (3)
|
|
|
|
let _: bool = g(); // This should resolve to (4)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {}
|