@@ -105,17 +105,20 @@ pub fn abort_on_err<T>(result: Result<T, ErrorReported>, sess: &Session) -> T {
105105pub trait Callbacks {
106106 /// Called before creating the compiler instance
107107 fn config ( & mut self , _config : & mut interface:: Config ) { }
108- /// Called after parsing and returns true to continue execution
109- fn after_parsing ( & mut self , _compiler : & interface:: Compiler ) -> bool {
110- true
108+ /// Called after parsing. Return value instructs the compiler whether to
109+ /// continue the compilation afterwards (defaults to `Compilation::Continue`)
110+ fn after_parsing ( & mut self , _compiler : & interface:: Compiler ) -> Compilation {
111+ Compilation :: Continue
111112 }
112- /// Called after expansion and returns true to continue execution
113- fn after_expansion ( & mut self , _compiler : & interface:: Compiler ) -> bool {
114- true
113+ /// Called after expansion. Return value instructs the compiler whether to
114+ /// continue the compilation afterwards (defaults to `Compilation::Continue`)
115+ fn after_expansion ( & mut self , _compiler : & interface:: Compiler ) -> Compilation {
116+ Compilation :: Continue
115117 }
116- /// Called after analysis and returns true to continue execution
117- fn after_analysis ( & mut self , _compiler : & interface:: Compiler ) -> bool {
118- true
118+ /// Called after analysis. Return value instructs the compiler whether to
119+ /// continue the compilation afterwards (defaults to `Compilation::Continue`)
120+ fn after_analysis ( & mut self , _compiler : & interface:: Compiler ) -> Compilation {
121+ Compilation :: Continue
119122 }
120123}
121124
@@ -298,7 +301,7 @@ pub fn run_compiler(
298301 }
299302 }
300303
301- if ! callbacks. after_parsing ( compiler) {
304+ if callbacks. after_parsing ( compiler) == Compilation :: Stop {
302305 return sess. compile_status ( ) ;
303306 }
304307
@@ -317,7 +320,7 @@ pub fn run_compiler(
317320 }
318321
319322 compiler. expansion ( ) ?;
320- if ! callbacks. after_expansion ( compiler) {
323+ if callbacks. after_expansion ( compiler) == Compilation :: Stop {
321324 return sess. compile_status ( ) ;
322325 }
323326
@@ -364,7 +367,7 @@ pub fn run_compiler(
364367
365368 compiler. global_ctxt ( ) ?. peek_mut ( ) . enter ( |tcx| tcx. analysis ( LOCAL_CRATE ) ) ?;
366369
367- if ! callbacks. after_analysis ( compiler) {
370+ if callbacks. after_analysis ( compiler) == Compilation :: Stop {
368371 return sess. compile_status ( ) ;
369372 }
370373
0 commit comments