@@ -454,7 +454,7 @@ fn get_codegen_sysroot(backend_name: &str) -> fn() -> Box<CodegenBackend> {
454454// See comments on CompilerCalls below for details about the callbacks argument.
455455// The FileLoader provides a way to load files from sources other than the file system.
456456pub fn run_compiler < ' a > ( args : & [ String ] ,
457- callbacks : & mut ( CompilerCalls < ' a > + sync:: Send ) ,
457+ callbacks : Box < CompilerCalls < ' a > + sync:: Send + ' a > ,
458458 file_loader : Option < Box < FileLoader + Send + Sync + ' static > > ,
459459 emitter_dest : Option < Box < Write + Send > > )
460460 -> ( CompileResult , Option < Session > )
@@ -478,7 +478,7 @@ fn run_compiler_with_pool<'a>(
478478 matches : getopts:: Matches ,
479479 sopts : config:: Options ,
480480 cfg : ast:: CrateConfig ,
481- callbacks : & mut ( CompilerCalls < ' a > + sync:: Send ) ,
481+ mut callbacks : Box < CompilerCalls < ' a > + sync:: Send + ' a > ,
482482 file_loader : Option < Box < FileLoader + Send + Sync + ' static > > ,
483483 emitter_dest : Option < Box < Write + Send > >
484484) -> ( CompileResult , Option < Session > ) {
@@ -642,12 +642,12 @@ impl Compilation {
642642 }
643643}
644644
645- // A trait for customising the compilation process. Offers a number of hooks for
646- // executing custom code or customising input.
645+ /// A trait for customising the compilation process. Offers a number of hooks for
646+ /// executing custom code or customising input.
647647pub trait CompilerCalls < ' a > {
648- // Hook for a callback early in the process of handling arguments. This will
649- // be called straight after options have been parsed but before anything
650- // else (e.g., selecting input and output).
648+ /// Hook for a callback early in the process of handling arguments. This will
649+ /// be called straight after options have been parsed but before anything
650+ /// else (e.g., selecting input and output).
651651 fn early_callback ( & mut self ,
652652 _: & getopts:: Matches ,
653653 _: & config:: Options ,
@@ -658,9 +658,9 @@ pub trait CompilerCalls<'a> {
658658 Compilation :: Continue
659659 }
660660
661- // Hook for a callback late in the process of handling arguments. This will
662- // be called just before actual compilation starts (and before build_controller
663- // is called), after all arguments etc. have been completely handled.
661+ /// Hook for a callback late in the process of handling arguments. This will
662+ /// be called just before actual compilation starts (and before build_controller
663+ /// is called), after all arguments etc. have been completely handled.
664664 fn late_callback ( & mut self ,
665665 _: & CodegenBackend ,
666666 _: & getopts:: Matches ,
@@ -673,21 +673,21 @@ pub trait CompilerCalls<'a> {
673673 Compilation :: Continue
674674 }
675675
676- // Called after we extract the input from the arguments. Gives the implementer
677- // an opportunity to change the inputs or to add some custom input handling.
678- // The default behaviour is to simply pass through the inputs.
676+ /// Called after we extract the input from the arguments. Gives the implementer
677+ /// an opportunity to change the inputs or to add some custom input handling.
678+ /// The default behaviour is to simply pass through the inputs.
679679 fn some_input ( & mut self ,
680680 input : Input ,
681681 input_path : Option < PathBuf > )
682682 -> ( Input , Option < PathBuf > ) {
683683 ( input, input_path)
684684 }
685685
686- // Called after we extract the input from the arguments if there is no valid
687- // input. Gives the implementer an opportunity to supply alternate input (by
688- // returning a Some value) or to add custom behaviour for this error such as
689- // emitting error messages. Returning None will cause compilation to stop
690- // at this point.
686+ /// Called after we extract the input from the arguments if there is no valid
687+ /// input. Gives the implementer an opportunity to supply alternate input (by
688+ /// returning a Some value) or to add custom behaviour for this error such as
689+ /// emitting error messages. Returning None will cause compilation to stop
690+ /// at this point.
691691 fn no_input ( & mut self ,
692692 _: & getopts:: Matches ,
693693 _: & config:: Options ,
@@ -701,10 +701,14 @@ pub trait CompilerCalls<'a> {
701701
702702 // Create a CompilController struct for controlling the behaviour of
703703 // compilation.
704- fn build_controller ( & mut self , _: & Session , _: & getopts:: Matches ) -> CompileController < ' a > ;
704+ fn build_controller (
705+ self : Box < Self > ,
706+ _: & Session ,
707+ _: & getopts:: Matches
708+ ) -> CompileController < ' a > ;
705709}
706710
707- // CompilerCalls instance for a regular rustc build.
711+ /// CompilerCalls instance for a regular rustc build.
708712#[ derive( Copy , Clone ) ]
709713pub struct RustcDefaultCalls ;
710714
@@ -878,7 +882,7 @@ impl<'a> CompilerCalls<'a> for RustcDefaultCalls {
878882 . and_then ( || RustcDefaultCalls :: list_metadata ( sess, cstore, matches, input) )
879883 }
880884
881- fn build_controller ( & mut self ,
885+ fn build_controller ( self : Box < Self > ,
882886 sess : & Session ,
883887 matches : & getopts:: Matches )
884888 -> CompileController < ' a > {
@@ -1693,7 +1697,7 @@ pub fn main() {
16931697 } ) )
16941698 . collect :: < Vec < _ > > ( ) ;
16951699 run_compiler ( & args,
1696- & mut RustcDefaultCalls ,
1700+ Box :: new ( RustcDefaultCalls ) ,
16971701 None ,
16981702 None )
16991703 } ) ;
0 commit comments