Skip to content

Commit f7235a8

Browse files
committed
Normalize the test output of hygiene-related tests
A raw SyntaxContext id is implicitly dependent on the target platform, since libstd and libcore have platform-dependent #[cfg]s which affect which macros are invoked. As a result, we must strip out any SyntaxContext ids from test output to ensure that the captured stdout is not platform-dependent.
1 parent 768803c commit f7235a8

16 files changed

+142
-194
lines changed

src/test/ui/proc-macro/dollar-crate-issue-57089.rs

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
// Anonymize unstable non-dummy spans while still showing dummy spans `0..0`.
66
// normalize-stdout-test "bytes\([^0]\w*\.\.(\w+)\)" -> "bytes(LO..$1)"
77
// normalize-stdout-test "bytes\((\w+)\.\.[^0]\w*\)" -> "bytes($1..HI)"
8+
// normalize-stdout-test "#\d+" -> "#CTXT"
89

910
#[macro_use]
1011
extern crate test_macros;

src/test/ui/proc-macro/dollar-crate-issue-57089.stdout

+16-16
Original file line numberDiff line numberDiff line change
@@ -2,79 +2,79 @@ PRINT-BANG INPUT (DISPLAY): struct M($crate :: S) ;
22
PRINT-BANG INPUT (DEBUG): TokenStream [
33
Ident {
44
ident: "struct",
5-
span: #6 bytes(LO..HI),
5+
span: #CTXT bytes(LO..HI),
66
},
77
Ident {
88
ident: "M",
9-
span: #6 bytes(LO..HI),
9+
span: #CTXT bytes(LO..HI),
1010
},
1111
Group {
1212
delimiter: Parenthesis,
1313
stream: TokenStream [
1414
Ident {
1515
ident: "$crate",
16-
span: #6 bytes(LO..HI),
16+
span: #CTXT bytes(LO..HI),
1717
},
1818
Punct {
1919
ch: ':',
2020
spacing: Joint,
21-
span: #6 bytes(LO..HI),
21+
span: #CTXT bytes(LO..HI),
2222
},
2323
Punct {
2424
ch: ':',
2525
spacing: Alone,
26-
span: #6 bytes(LO..HI),
26+
span: #CTXT bytes(LO..HI),
2727
},
2828
Ident {
2929
ident: "S",
30-
span: #6 bytes(LO..HI),
30+
span: #CTXT bytes(LO..HI),
3131
},
3232
],
33-
span: #6 bytes(LO..HI),
33+
span: #CTXT bytes(LO..HI),
3434
},
3535
Punct {
3636
ch: ';',
3737
spacing: Alone,
38-
span: #6 bytes(LO..HI),
38+
span: #CTXT bytes(LO..HI),
3939
},
4040
]
4141
PRINT-ATTR INPUT (DISPLAY): struct A($crate :: S) ;
4242
PRINT-ATTR INPUT (DEBUG): TokenStream [
4343
Ident {
4444
ident: "struct",
45-
span: #6 bytes(LO..HI),
45+
span: #CTXT bytes(LO..HI),
4646
},
4747
Ident {
4848
ident: "A",
49-
span: #6 bytes(LO..HI),
49+
span: #CTXT bytes(LO..HI),
5050
},
5151
Group {
5252
delimiter: Parenthesis,
5353
stream: TokenStream [
5454
Ident {
5555
ident: "$crate",
56-
span: #6 bytes(LO..HI),
56+
span: #CTXT bytes(LO..HI),
5757
},
5858
Punct {
5959
ch: ':',
6060
spacing: Joint,
61-
span: #6 bytes(LO..HI),
61+
span: #CTXT bytes(LO..HI),
6262
},
6363
Punct {
6464
ch: ':',
6565
spacing: Alone,
66-
span: #6 bytes(LO..HI),
66+
span: #CTXT bytes(LO..HI),
6767
},
6868
Ident {
6969
ident: "S",
70-
span: #6 bytes(LO..HI),
70+
span: #CTXT bytes(LO..HI),
7171
},
7272
],
73-
span: #6 bytes(LO..HI),
73+
span: #CTXT bytes(LO..HI),
7474
},
7575
Punct {
7676
ch: ';',
7777
spacing: Alone,
78-
span: #6 bytes(LO..HI),
78+
span: #CTXT bytes(LO..HI),
7979
},
8080
]

src/test/ui/proc-macro/dollar-crate-issue-62325.rs

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
// Anonymize unstable non-dummy spans while still showing dummy spans `0..0`.
77
// normalize-stdout-test "bytes\([^0]\w*\.\.(\w+)\)" -> "bytes(LO..$1)"
88
// normalize-stdout-test "bytes\((\w+)\.\.[^0]\w*\)" -> "bytes($1..HI)"
9+
// normalize-stdout-test "#\d+" -> "#CTXT"
910

1011
#[macro_use]
1112
extern crate test_macros;

src/test/ui/proc-macro/dollar-crate-issue-62325.stdout

+22-22
Original file line numberDiff line numberDiff line change
@@ -2,109 +2,109 @@ PRINT-ATTR INPUT (DISPLAY): struct A(identity ! ($crate :: S)) ;
22
PRINT-ATTR INPUT (DEBUG): TokenStream [
33
Ident {
44
ident: "struct",
5-
span: #6 bytes(LO..HI),
5+
span: #CTXT bytes(LO..HI),
66
},
77
Ident {
88
ident: "A",
9-
span: #6 bytes(LO..HI),
9+
span: #CTXT bytes(LO..HI),
1010
},
1111
Group {
1212
delimiter: Parenthesis,
1313
stream: TokenStream [
1414
Ident {
1515
ident: "identity",
16-
span: #6 bytes(LO..HI),
16+
span: #CTXT bytes(LO..HI),
1717
},
1818
Punct {
1919
ch: '!',
2020
spacing: Alone,
21-
span: #6 bytes(LO..HI),
21+
span: #CTXT bytes(LO..HI),
2222
},
2323
Group {
2424
delimiter: Parenthesis,
2525
stream: TokenStream [
2626
Ident {
2727
ident: "$crate",
28-
span: #6 bytes(LO..HI),
28+
span: #CTXT bytes(LO..HI),
2929
},
3030
Punct {
3131
ch: ':',
3232
spacing: Joint,
33-
span: #6 bytes(LO..HI),
33+
span: #CTXT bytes(LO..HI),
3434
},
3535
Punct {
3636
ch: ':',
3737
spacing: Alone,
38-
span: #6 bytes(LO..HI),
38+
span: #CTXT bytes(LO..HI),
3939
},
4040
Ident {
4141
ident: "S",
42-
span: #6 bytes(LO..HI),
42+
span: #CTXT bytes(LO..HI),
4343
},
4444
],
45-
span: #6 bytes(LO..HI),
45+
span: #CTXT bytes(LO..HI),
4646
},
4747
],
48-
span: #6 bytes(LO..HI),
48+
span: #CTXT bytes(LO..HI),
4949
},
5050
Punct {
5151
ch: ';',
5252
spacing: Alone,
53-
span: #6 bytes(LO..HI),
53+
span: #CTXT bytes(LO..HI),
5454
},
5555
]
5656
PRINT-ATTR INPUT (DISPLAY): struct B(identity ! ($crate :: S)) ;
5757
PRINT-ATTR INPUT (DEBUG): TokenStream [
5858
Ident {
5959
ident: "struct",
60-
span: #13 bytes(LO..HI),
60+
span: #CTXT bytes(LO..HI),
6161
},
6262
Ident {
6363
ident: "B",
64-
span: #13 bytes(LO..HI),
64+
span: #CTXT bytes(LO..HI),
6565
},
6666
Group {
6767
delimiter: Parenthesis,
6868
stream: TokenStream [
6969
Ident {
7070
ident: "identity",
71-
span: #13 bytes(LO..HI),
71+
span: #CTXT bytes(LO..HI),
7272
},
7373
Punct {
7474
ch: '!',
7575
spacing: Alone,
76-
span: #13 bytes(LO..HI),
76+
span: #CTXT bytes(LO..HI),
7777
},
7878
Group {
7979
delimiter: Parenthesis,
8080
stream: TokenStream [
8181
Ident {
8282
ident: "$crate",
83-
span: #13 bytes(LO..HI),
83+
span: #CTXT bytes(LO..HI),
8484
},
8585
Punct {
8686
ch: ':',
8787
spacing: Joint,
88-
span: #13 bytes(LO..HI),
88+
span: #CTXT bytes(LO..HI),
8989
},
9090
Punct {
9191
ch: ':',
9292
spacing: Alone,
93-
span: #13 bytes(LO..HI),
93+
span: #CTXT bytes(LO..HI),
9494
},
9595
Ident {
9696
ident: "S",
97-
span: #13 bytes(LO..HI),
97+
span: #CTXT bytes(LO..HI),
9898
},
9999
],
100-
span: #13 bytes(LO..HI),
100+
span: #CTXT bytes(LO..HI),
101101
},
102102
],
103-
span: #13 bytes(LO..HI),
103+
span: #CTXT bytes(LO..HI),
104104
},
105105
Punct {
106106
ch: ';',
107107
spacing: Alone,
108-
span: #13 bytes(LO..HI),
108+
span: #CTXT bytes(LO..HI),
109109
},
110110
]

src/test/ui/proc-macro/dollar-crate.rs

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
// Anonymize unstable non-dummy spans while still showing dummy spans `0..0`.
77
// normalize-stdout-test "bytes\([^0]\w*\.\.(\w+)\)" -> "bytes(LO..$1)"
88
// normalize-stdout-test "bytes\((\w+)\.\.[^0]\w*\)" -> "bytes($1..HI)"
9+
// normalize-stdout-test "#\d+" -> "#CTXT"
910

1011
#[macro_use]
1112
extern crate test_macros;

0 commit comments

Comments
 (0)