@@ -25,6 +25,13 @@ pub struct AuxCrate {
2525 pub path : String ,
2626}
2727
28+ /// The value of a `proc-macro` directive.
29+ #[ derive( Clone , Debug , Default ) ]
30+ pub ( crate ) struct ProcMacro {
31+ /// With `proc-macro: bar.rs` this will be `bar.rs`.
32+ pub path : String ,
33+ }
34+
2835/// Properties parsed from `aux-*` test directives.
2936#[ derive( Clone , Debug , Default ) ]
3037pub ( crate ) struct AuxProps {
@@ -37,7 +44,7 @@ pub(crate) struct AuxProps {
3744 /// to build and pass with the `--extern` flag.
3845 pub ( crate ) crates : Vec < AuxCrate > ,
3946 /// Same as `builds`, but for proc-macros.
40- pub ( crate ) proc_macros : Vec < String > ,
47+ pub ( crate ) proc_macros : Vec < ProcMacro > ,
4148 /// Similar to `builds`, but also uses the resulting dylib as a
4249 /// `-Zcodegen-backend` when compiling the test file.
4350 pub ( crate ) codegen_backend : Option < String > ,
@@ -53,7 +60,7 @@ impl AuxProps {
5360 . chain ( builds. iter ( ) . map ( String :: as_str) )
5461 . chain ( bins. iter ( ) . map ( String :: as_str) )
5562 . chain ( crates. iter ( ) . map ( |c| c. path . as_str ( ) ) )
56- . chain ( proc_macros. iter ( ) . map ( String :: as_str) )
63+ . chain ( proc_macros. iter ( ) . map ( |p| p . path . as_str ( ) ) )
5764 . chain ( codegen_backend. iter ( ) . map ( String :: as_str) )
5865 }
5966}
@@ -74,8 +81,8 @@ pub(super) fn parse_and_update_aux(
7481 config. push_name_value_directive ( ln, AUX_BUILD , & mut aux. builds , |r| r. trim ( ) . to_string ( ) ) ;
7582 config. push_name_value_directive ( ln, AUX_BIN , & mut aux. bins , |r| r. trim ( ) . to_string ( ) ) ;
7683 config. push_name_value_directive ( ln, AUX_CRATE , & mut aux. crates , parse_aux_crate) ;
77- config
78- . push_name_value_directive ( ln , PROC_MACRO , & mut aux . proc_macros , |r| r . trim ( ) . to_string ( ) ) ;
84+ config. push_name_value_directive ( ln , PROC_MACRO , & mut aux . proc_macros , parse_proc_macro ) ;
85+
7986 if let Some ( r) = config. parse_name_value_directive ( ln, AUX_CODEGEN_BACKEND ) {
8087 aux. codegen_backend = Some ( r. trim ( ) . to_owned ( ) ) ;
8188 }
@@ -99,3 +106,7 @@ fn parse_aux_crate(r: String) -> AuxCrate {
99106
100107 AuxCrate { extern_modifiers : modifiers, name, path }
101108}
109+
110+ fn parse_proc_macro ( r : String ) -> ProcMacro {
111+ ProcMacro { path : r. trim ( ) . to_string ( ) }
112+ }
0 commit comments