File: key-value-expansion-scope.rs

package info (click to toggle)
rustc 1.85.0%2Bdfsg3-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental, sid, trixie
  • size: 893,396 kB
  • sloc: xml: 158,127; python: 35,830; javascript: 19,497; cpp: 19,002; sh: 17,245; ansic: 13,127; asm: 4,376; makefile: 1,051; perl: 29; lisp: 29; ruby: 19; sql: 11
file content (73 lines) | stat: -rw-r--r-- 2,852 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#![doc = in_root!()] //~ WARN cannot find macro `in_root` in this scope
                     //~| WARN this was previously accepted by the compiler
#![doc = in_mod!()] //~ ERROR cannot find macro `in_mod` in this scope
#![doc = in_mod_escape!()] //~ WARN cannot find macro `in_mod_escape` in this scope
                           //~| WARN this was previously accepted by the compiler
#![doc = in_block!()] //~ ERROR cannot find macro `in_block` in this scope

#[doc = in_root!()] //~ ERROR cannot find macro `in_root` in this scope
#[doc = in_mod!()] //~ ERROR cannot find macro `in_mod` in this scope
#[doc = in_mod_escape!()] //~ ERROR cannot find macro `in_mod_escape` in this scope
#[doc = in_block!()] //~ ERROR cannot find macro `in_block` in this scope
fn before() {
    #![doc = in_root!()] //~ ERROR cannot find macro `in_root` in this scope
    #![doc = in_mod!()] //~ ERROR cannot find macro `in_mod` in this scope
    #![doc = in_mod_escape!()] //~ ERROR cannot find macro `in_mod_escape` in this scope
    #![doc = in_block!()] //~ ERROR cannot find macro `in_block` in this scope
}

macro_rules! in_root { () => { "" } }

#[doc = in_mod!()] //~ WARN cannot find macro `in_mod` in this scope
                   //~| WARN this was previously accepted by the compiler
mod macros_stay {
    #![doc = in_mod!()] //~ WARN cannot find macro `in_mod` in this scope
                        //~| WARN this was previously accepted by the compiler

    macro_rules! in_mod { () => { "" } }

    #[doc = in_mod!()] // OK
    fn f() {
        #![doc = in_mod!()] // OK
    }
}

#[macro_use]
#[doc = in_mod_escape!()] //~ WARN cannot find macro `in_mod_escape` in this scope
                          //~| WARN this was previously accepted by the compiler
mod macros_escape {
    #![doc = in_mod_escape!()] //~ WARN cannot find macro `in_mod_escape` in this scope
                               //~| WARN this was previously accepted by the compiler

    macro_rules! in_mod_escape { () => { "" } }

    #[doc = in_mod_escape!()] // OK
    fn f() {
        #![doc = in_mod_escape!()] // OK
    }
}

#[doc = in_block!()] //~ ERROR cannot find macro `in_block` in this scope
fn block() {
    #![doc = in_block!()] //~ ERROR cannot find macro `in_block` in this scope

    macro_rules! in_block { () => { "" } }

    #[doc = in_block!()] // OK
    fn f() {
        #![doc = in_block!()] // OK
    }
}

#[doc = in_root!()] // OK
#[doc = in_mod!()] //~ ERROR cannot find macro `in_mod` in this scope
#[doc = in_mod_escape!()] // OK
#[doc = in_block!()] //~ ERROR cannot find macro `in_block` in this scope
fn after() {
    #![doc = in_root!()] // OK
    #![doc = in_mod!()] //~ ERROR cannot find macro `in_mod` in this scope
    #![doc = in_mod_escape!()] // OK
    #![doc = in_block!()] //~ ERROR cannot find macro `in_block` in this scope
}

fn main() {}