Closed dtolnay closed 2 years ago
Macrotest assumes that the output of cargo expand always begins with the following exactly 5 lines.
cargo expand
https://github.com/eupn/macrotest/blob/779cfa5b70899a9793ba8be5f2d78fcb0eb0436f/src/expand.rs#L390-L391
#![feature(prelude_import)] #[prelude_import] use std::prelude::$edition::*; #[macro_use] extern crate std;
However, that is not the case if there is an inner attribute in the input. For example the following crate:
#![feature(proc_macro_span)] fn foo() {}
expands as:
#![feature(prelude_import)] #![feature(proc_macro_span)] #[prelude_import] use std::prelude::rust_2018::*; #[macro_use] extern crate std; fn foo() {}
and after stripping exactly 5 lines from the front, macrotest's .expanded.rs will result in:
.expanded.rs
extern crate std; fn foo() {}
which is not what is expected. The correct expansion would be:
Macrotest assumes that the output of
cargo expand
always begins with the following exactly 5 lines.https://github.com/eupn/macrotest/blob/779cfa5b70899a9793ba8be5f2d78fcb0eb0436f/src/expand.rs#L390-L391
However, that is not the case if there is an inner attribute in the input. For example the following crate:
expands as:
and after stripping exactly 5 lines from the front, macrotest's
.expanded.rs
will result in:which is not what is expected. The correct expansion would be: