File tree 1 file changed +12
-1
lines changed 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -662,15 +662,26 @@ impl Config {
662
662
/// This is only relevant for C and C++ files.
663
663
///
664
664
/// # Panics
665
+ /// Panics if more than one file is present in the config, or if compiler
666
+ /// path has an invalid file name.
665
667
///
666
- /// Panics if compiler path has an invalid file name.
668
+ /// # Example
669
+ /// ```no_run
670
+ /// let out = gcc::Config::new()
671
+ /// .file("src/foo.c")
672
+ /// .expand();
673
+ /// ```
667
674
pub fn expand ( & self ) -> Vec < u8 > {
668
675
let compiler = self . get_compiler ( ) ;
669
676
let mut cmd = compiler. to_command ( ) ;
670
677
for & ( ref a, ref b) in self . env . iter ( ) {
671
678
cmd. env ( a, b) ;
672
679
}
673
680
cmd. arg ( compiler. family . expand_flag ( ) ) ;
681
+
682
+ assert ! ( self . files. len( ) <= 1 ,
683
+ "Expand may only be called for a single file" ) ;
684
+
674
685
for file in self . files . iter ( ) {
675
686
cmd. arg ( file) ;
676
687
}
You can’t perform that action at this time.
0 commit comments