@@ -7,6 +7,16 @@ use super::directives::{AUX_BIN, AUX_BUILD, AUX_CODEGEN_BACKEND, AUX_CRATE, PROC
77use crate :: common:: Config ;
88use crate :: directives:: DirectiveLine ;
99
10+ /// The value of an `aux-crate` directive.
11+ #[ derive( Clone , Debug , Default ) ]
12+ pub struct AuxCrate {
13+ /// With `aux-crate: foo=bar.rs` this will be `foo`.
14+ /// With `aux-crate: noprelude:foo=bar.rs` this will be `noprelude:foo`.
15+ pub name : String ,
16+ /// With `aux-crate: foo=bar.rs` this will be `bar.rs`.
17+ pub path : String ,
18+ }
19+
1020/// Properties parsed from `aux-*` test directives.
1121#[ derive( Clone , Debug , Default ) ]
1222pub ( crate ) struct AuxProps {
@@ -17,7 +27,7 @@ pub(crate) struct AuxProps {
1727 pub ( crate ) bins : Vec < String > ,
1828 /// Similar to `builds`, but a list of NAME=somelib.rs of dependencies
1929 /// to build and pass with the `--extern` flag.
20- pub ( crate ) crates : Vec < ( String , String ) > ,
30+ pub ( crate ) crates : Vec < AuxCrate > ,
2131 /// Same as `builds`, but for proc-macros.
2232 pub ( crate ) proc_macros : Vec < String > ,
2333 /// Similar to `builds`, but also uses the resulting dylib as a
@@ -34,7 +44,7 @@ impl AuxProps {
3444 iter:: empty ( )
3545 . chain ( builds. iter ( ) . map ( String :: as_str) )
3646 . chain ( bins. iter ( ) . map ( String :: as_str) )
37- . chain ( crates. iter ( ) . map ( |( _ , path ) | path. as_str ( ) ) )
47+ . chain ( crates. iter ( ) . map ( |c| c . path . as_str ( ) ) )
3848 . chain ( proc_macros. iter ( ) . map ( String :: as_str) )
3949 . chain ( codegen_backend. iter ( ) . map ( String :: as_str) )
4050 }
@@ -63,10 +73,10 @@ pub(super) fn parse_and_update_aux(
6373 }
6474}
6575
66- fn parse_aux_crate ( r : String ) -> ( String , String ) {
76+ fn parse_aux_crate ( r : String ) -> AuxCrate {
6777 let mut parts = r. trim ( ) . splitn ( 2 , '=' ) ;
68- (
69- parts. next ( ) . expect ( "missing aux-crate name (e.g. log=log.rs)" ) . to_string ( ) ,
70- parts. next ( ) . expect ( "missing aux-crate value (e.g. log=log.rs)" ) . to_string ( ) ,
71- )
78+ AuxCrate {
79+ name : parts. next ( ) . expect ( "missing aux-crate name (e.g. log=log.rs)" ) . to_string ( ) ,
80+ path : parts. next ( ) . expect ( "missing aux-crate value (e.g. log=log.rs)" ) . to_string ( ) ,
81+ }
7282}
0 commit comments