File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -662,15 +662,26 @@ impl Config {
662662 /// This is only relevant for C and C++ files.
663663 ///
664664 /// # Panics
665+ /// Panics if more than one file is present in the config, or if compiler
666+ /// path has an invalid file name.
665667 ///
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+ /// ```
667674 pub fn expand ( & self ) -> Vec < u8 > {
668675 let compiler = self . get_compiler ( ) ;
669676 let mut cmd = compiler. to_command ( ) ;
670677 for & ( ref a, ref b) in self . env . iter ( ) {
671678 cmd. env ( a, b) ;
672679 }
673680 cmd. arg ( compiler. family . expand_flag ( ) ) ;
681+
682+ assert ! ( self . files. len( ) <= 1 ,
683+ "Expand may only be called for a single file" ) ;
684+
674685 for file in self . files . iter ( ) {
675686 cmd. arg ( file) ;
676687 }
You can’t perform that action at this time.
0 commit comments