mirror of https://github.com/rust-lang/rust
36 lines
735 B
Rust
36 lines
735 B
Rust
//@ check-pass
|
|
//@ edition:2021
|
|
//@ aux-build:non_local_macro.rs
|
|
//@ rustc-env:CARGO_CRATE_NAME=non_local_def
|
|
|
|
#![warn(non_local_definitions)]
|
|
|
|
extern crate non_local_macro;
|
|
|
|
const B: u32 = {
|
|
#[macro_export]
|
|
macro_rules! m0 { () => { } };
|
|
//~^ WARN non-local `macro_rules!` definition
|
|
|
|
1
|
|
};
|
|
|
|
non_local_macro::non_local_macro_rules!(my_macro);
|
|
//~^ WARN non-local `macro_rules!` definition
|
|
|
|
fn main() {
|
|
#[macro_export]
|
|
macro_rules! m { () => { } };
|
|
//~^ WARN non-local `macro_rules!` definition
|
|
|
|
struct InsideMain;
|
|
|
|
impl InsideMain {
|
|
fn bar() {
|
|
#[macro_export]
|
|
macro_rules! m2 { () => { } };
|
|
//~^ WARN non-local `macro_rules!` definition
|
|
}
|
|
}
|
|
}
|