2019-07-14 10:34:13 +00:00
|
|
|
// check-pass
|
2018-09-25 21:51:35 +00:00
|
|
|
#![allow(dead_code)]
|
2017-11-29 09:05:31 +00:00
|
|
|
// ignore-pretty pretty-printing is unhygienic
|
|
|
|
|
|
|
|
// aux-build:legacy_interaction.rs
|
|
|
|
|
2018-04-28 04:32:00 +00:00
|
|
|
#![feature(decl_macro)]
|
2017-11-29 09:05:31 +00:00
|
|
|
#[allow(unused)]
|
|
|
|
|
|
|
|
extern crate legacy_interaction;
|
|
|
|
// ^ defines
|
|
|
|
// ```rust
|
|
|
|
// macro_rules! m {
|
|
|
|
// () => {
|
2019-07-14 10:34:13 +00:00
|
|
|
// fn f() {} // (1)
|
2017-11-29 09:05:31 +00: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() {}
|