mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 23:04:33 +00:00
fix(test): improve sensitivity of hygene tests
The change in07f855d781
introduced a trailing numeral of some kind after the `extern crate compiler_builtins`, which appears to have caused at least two false negatives (654b924
and 657fd24). Instead, this change normalizes the test output to ignore the number (of symbols rustc recognizes?) to avoid needing to re-`--bless` these two tests for unrelated changes.
This commit is contained in:
parent
d88ab223c5
commit
26bd86d3d9
@ -3,8 +3,10 @@
|
||||
// edition:2018
|
||||
// compile-flags: -Z span-debug -Z macro-backtrace -Z unpretty=expanded,hygiene -Z trim-diagnostic-paths=no
|
||||
// check-pass
|
||||
// ignore-tidy-linelength
|
||||
// normalize-stdout-test "\d+#" -> "0#"
|
||||
// normalize-stdout-test "expn\d{3,}" -> "expnNNN"
|
||||
// normalize-stdout-test "extern crate compiler_builtins /\* \d+ \*/" -> "extern crate compiler_builtins /* NNN */"
|
||||
//
|
||||
// We don't care about symbol ids, so we set them all to 0
|
||||
// in the stdout
|
||||
@ -22,7 +24,7 @@ macro_rules! produce_it {
|
||||
// the fact that `print_def_site` is produced by a
|
||||
// `macro_rules!` macro in `make_macro`).
|
||||
meta_macro::print_def_site!($crate::dummy!());
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
@ -1,5 +1,5 @@
|
||||
Def site: $DIR/auxiliary/make-macro.rs:7:9: 7:56 (#4)
|
||||
Input: TokenStream [Ident { ident: "$crate", span: $DIR/meta-macro-hygiene.rs:24:37: 24:43 (#3) }, Punct { ch: ':', spacing: Joint, span: $DIR/meta-macro-hygiene.rs:24:43: 24:44 (#3) }, Punct { ch: ':', spacing: Alone, span: $DIR/meta-macro-hygiene.rs:24:44: 24:45 (#3) }, Ident { ident: "dummy", span: $DIR/meta-macro-hygiene.rs:24:45: 24:50 (#3) }, Punct { ch: '!', spacing: Alone, span: $DIR/meta-macro-hygiene.rs:24:50: 24:51 (#3) }, Group { delimiter: Parenthesis, stream: TokenStream [], span: $DIR/meta-macro-hygiene.rs:24:51: 24:53 (#3) }]
|
||||
Input: TokenStream [Ident { ident: "$crate", span: $DIR/meta-macro-hygiene.rs:26:37: 26:43 (#3) }, Punct { ch: ':', spacing: Joint, span: $DIR/meta-macro-hygiene.rs:26:43: 26:44 (#3) }, Punct { ch: ':', spacing: Alone, span: $DIR/meta-macro-hygiene.rs:26:44: 26:45 (#3) }, Ident { ident: "dummy", span: $DIR/meta-macro-hygiene.rs:26:45: 26:50 (#3) }, Punct { ch: '!', spacing: Alone, span: $DIR/meta-macro-hygiene.rs:26:50: 26:51 (#3) }, Group { delimiter: Parenthesis, stream: TokenStream [], span: $DIR/meta-macro-hygiene.rs:26:51: 26:53 (#3) }]
|
||||
Respanned: TokenStream [Ident { ident: "$crate", span: $DIR/auxiliary/make-macro.rs:7:9: 7:56 (#4) }, Punct { ch: ':', spacing: Joint, span: $DIR/auxiliary/make-macro.rs:7:9: 7:56 (#4) }, Punct { ch: ':', spacing: Alone, span: $DIR/auxiliary/make-macro.rs:7:9: 7:56 (#4) }, Ident { ident: "dummy", span: $DIR/auxiliary/make-macro.rs:7:9: 7:56 (#4) }, Punct { ch: '!', spacing: Alone, span: $DIR/auxiliary/make-macro.rs:7:9: 7:56 (#4) }, Group { delimiter: Parenthesis, stream: TokenStream [], span: $DIR/auxiliary/make-macro.rs:7:9: 7:56 (#4) }]
|
||||
#![feature /* 0#0 */(prelude_import)]
|
||||
// aux-build:make-macro.rs
|
||||
@ -7,8 +7,10 @@ Respanned: TokenStream [Ident { ident: "$crate", span: $DIR/auxiliary/make-macro
|
||||
// edition:2018
|
||||
// compile-flags: -Z span-debug -Z macro-backtrace -Z unpretty=expanded,hygiene -Z trim-diagnostic-paths=no
|
||||
// check-pass
|
||||
// ignore-tidy-linelength
|
||||
// normalize-stdout-test "\d+#" -> "0#"
|
||||
// normalize-stdout-test "expn\d{3,}" -> "expnNNN"
|
||||
// normalize-stdout-test "extern crate compiler_builtins /\* \d+ \*/" -> "extern crate compiler_builtins /* NNN */"
|
||||
//
|
||||
// We don't care about symbol ids, so we set them all to 0
|
||||
// in the stdout
|
||||
@ -18,7 +20,7 @@ Respanned: TokenStream [Ident { ident: "$crate", span: $DIR/auxiliary/make-macro
|
||||
use core /* 0#1 */::prelude /* 0#1 */::rust_2018 /* 0#1 */::*;
|
||||
#[macro_use /* 0#1 */]
|
||||
extern crate core /* 0#1 */;
|
||||
extern crate compiler_builtins /* 445 */ as _ /* 0#1 */;
|
||||
extern crate compiler_builtins /* NNN */ as _ /* 0#1 */;
|
||||
// Don't load unnecessary hygiene information from std
|
||||
extern crate std /* 0#0 */;
|
||||
|
||||
@ -36,7 +38,7 @@ macro_rules! produce_it
|
||||
// relative to `meta_macro`, *not* `make_macro` (despite
|
||||
// the fact that `print_def_site` is produced by a
|
||||
// `macro_rules!` macro in `make_macro`).
|
||||
}
|
||||
} ;
|
||||
}
|
||||
|
||||
fn main /* 0#0 */() { ; }
|
||||
|
@ -3,12 +3,13 @@
|
||||
// check-pass
|
||||
// compile-flags: -Z span-debug -Z macro-backtrace -Z unpretty=expanded,hygiene
|
||||
// compile-flags: -Z trim-diagnostic-paths=no
|
||||
// ignore-tidy-linelength
|
||||
// normalize-stdout-test "\d+#" -> "0#"
|
||||
// normalize-stdout-test "expn\d{3,}" -> "expnNNN"
|
||||
// normalize-stdout-test "extern crate compiler_builtins /\* \d+ \*/" -> "extern crate compiler_builtins /* NNN */"
|
||||
// aux-build:test-macros.rs
|
||||
|
||||
#![feature(decl_macro)]
|
||||
|
||||
#![no_std] // Don't load unnecessary hygiene information from std
|
||||
extern crate std;
|
||||
|
||||
|
@ -6,19 +6,19 @@ PRINT-BANG INPUT (DEBUG): TokenStream [
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
ident: "struct",
|
||||
span: $DIR/nonterminal-token-hygiene.rs:31:5: 31:11 (#4),
|
||||
span: $DIR/nonterminal-token-hygiene.rs:32:5: 32:11 (#4),
|
||||
},
|
||||
Ident {
|
||||
ident: "S",
|
||||
span: $DIR/nonterminal-token-hygiene.rs:31:12: 31:13 (#4),
|
||||
span: $DIR/nonterminal-token-hygiene.rs:32:12: 32:13 (#4),
|
||||
},
|
||||
Punct {
|
||||
ch: ';',
|
||||
spacing: Alone,
|
||||
span: $DIR/nonterminal-token-hygiene.rs:31:13: 31:14 (#4),
|
||||
span: $DIR/nonterminal-token-hygiene.rs:32:13: 32:14 (#4),
|
||||
},
|
||||
],
|
||||
span: $DIR/nonterminal-token-hygiene.rs:21:27: 21:32 (#5),
|
||||
span: $DIR/nonterminal-token-hygiene.rs:22:27: 22:32 (#5),
|
||||
},
|
||||
]
|
||||
#![feature /* 0#0 */(prelude_import)]
|
||||
@ -28,18 +28,19 @@ PRINT-BANG INPUT (DEBUG): TokenStream [
|
||||
// check-pass
|
||||
// compile-flags: -Z span-debug -Z macro-backtrace -Z unpretty=expanded,hygiene
|
||||
// compile-flags: -Z trim-diagnostic-paths=no
|
||||
// ignore-tidy-linelength
|
||||
// normalize-stdout-test "\d+#" -> "0#"
|
||||
// normalize-stdout-test "expn\d{3,}" -> "expnNNN"
|
||||
// normalize-stdout-test "extern crate compiler_builtins /\* \d+ \*/" -> "extern crate compiler_builtins /* NNN */"
|
||||
// aux-build:test-macros.rs
|
||||
|
||||
#![feature /* 0#0 */(decl_macro)]
|
||||
|
||||
#![no_std /* 0#0 */]
|
||||
#[prelude_import /* 0#1 */]
|
||||
use ::core /* 0#1 */::prelude /* 0#1 */::rust_2015 /* 0#1 */::*;
|
||||
#[macro_use /* 0#1 */]
|
||||
extern crate core /* 0#2 */;
|
||||
extern crate compiler_builtins /* 445 */ as _ /* 0#2 */;
|
||||
extern crate compiler_builtins /* NNN */ as _ /* 0#2 */;
|
||||
// Don't load unnecessary hygiene information from std
|
||||
extern crate std /* 0#0 */;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user