This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +17
-1
lines changed
src/tools/compiletest/src Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change 11//! Code for dealing with test directives that request an "auxiliary" crate to
22//! be built and made available to the test in some way.
33
4+ use std:: iter;
5+
46use crate :: common:: Config ;
57use crate :: header:: directives:: { AUX_BIN , AUX_BUILD , AUX_CODEGEN_BACKEND , AUX_CRATE } ;
68
@@ -20,6 +22,20 @@ pub(crate) struct AuxProps {
2022 pub ( crate ) codegen_backend : Option < String > ,
2123}
2224
25+ impl AuxProps {
26+ /// Yields all of the paths (relative to `./auxiliary/`) that have been
27+ /// specified in `aux-*` directives for this test.
28+ pub ( crate ) fn all_aux_path_strings ( & self ) -> impl Iterator < Item = & str > {
29+ let Self { builds, bins, crates, codegen_backend } = self ;
30+
31+ iter:: empty ( )
32+ . chain ( builds. iter ( ) . map ( String :: as_str) )
33+ . chain ( bins. iter ( ) . map ( String :: as_str) )
34+ . chain ( crates. iter ( ) . map ( |( _, path) | path. as_str ( ) ) )
35+ . chain ( codegen_backend. iter ( ) . map ( String :: as_str) )
36+ }
37+ }
38+
2339/// If the given test directive line contains an `aux-*` directive, parse it
2440/// and update [`AuxProps`] accordingly.
2541pub ( super ) fn parse_and_update_aux ( config : & Config , ln : & str , aux : & mut AuxProps ) {
Original file line number Diff line number Diff line change @@ -862,7 +862,7 @@ fn files_related_to_test(
862862 related. push ( testpaths. file . clone ( ) ) ;
863863 }
864864
865- for aux in & props. aux . builds {
865+ for aux in props. aux . all_aux_path_strings ( ) {
866866 // FIXME(Zalathar): Perform all `auxiliary` path resolution in one place.
867867 let path = testpaths. file . parent ( ) . unwrap ( ) . join ( "auxiliary" ) . join ( aux) ;
868868 related. push ( path) ;
You can’t perform that action at this time.
0 commit comments