diff options
| author | Igor Matuszewski <Xanewok@gmail.com> | 2019-07-14 20:29:20 +0200 |
|---|---|---|
| committer | Igor Matuszewski <Xanewok@gmail.com> | 2019-07-15 17:01:03 +0200 |
| commit | ff63336b65691f4fd0e339bb74a1798d1f96e86e (patch) | |
| tree | c9a92f101b6045aa3c7265d5211aae5b97652c38 | |
| parent | ae75311823574fd697f28961cecb0e0f3f3382ce (diff) | |
| download | rust-ff63336b65691f4fd0e339bb74a1798d1f96e86e.tar.gz rust-ff63336b65691f4fd0e339bb74a1798d1f96e86e.zip | |
Use more descriptive Compilation enum in rustc interface callbacks
| -rw-r--r-- | src/librustc_driver/lib.rs | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/src/librustc_driver/lib.rs b/src/librustc_driver/lib.rs index 8f69171cb4e..2bc79e5080f 100644 --- a/src/librustc_driver/lib.rs +++ b/src/librustc_driver/lib.rs @@ -105,17 +105,20 @@ pub fn abort_on_err<T>(result: Result<T, ErrorReported>, sess: &Session) -> T { pub trait Callbacks { /// Called before creating the compiler instance fn config(&mut self, _config: &mut interface::Config) {} - /// Called after parsing and returns true to continue execution - fn after_parsing(&mut self, _compiler: &interface::Compiler) -> bool { - true + /// Called after parsing. Return value instructs the compiler whether to + /// continue the compilation afterwards (defaults to `Compilation::Continue`) + fn after_parsing(&mut self, _compiler: &interface::Compiler) -> Compilation { + Compilation::Continue } - /// Called after expansion and returns true to continue execution - fn after_expansion(&mut self, _compiler: &interface::Compiler) -> bool { - true + /// Called after expansion. Return value instructs the compiler whether to + /// continue the compilation afterwards (defaults to `Compilation::Continue`) + fn after_expansion(&mut self, _compiler: &interface::Compiler) -> Compilation { + Compilation::Continue } - /// Called after analysis and returns true to continue execution - fn after_analysis(&mut self, _compiler: &interface::Compiler) -> bool { - true + /// Called after analysis. Return value instructs the compiler whether to + /// continue the compilation afterwards (defaults to `Compilation::Continue`) + fn after_analysis(&mut self, _compiler: &interface::Compiler) -> Compilation { + Compilation::Continue } } @@ -298,7 +301,7 @@ pub fn run_compiler( } } - if !callbacks.after_parsing(compiler) { + if callbacks.after_parsing(compiler) == Compilation::Stop { return sess.compile_status(); } @@ -317,7 +320,7 @@ pub fn run_compiler( } compiler.expansion()?; - if !callbacks.after_expansion(compiler) { + if callbacks.after_expansion(compiler) == Compilation::Stop { return sess.compile_status(); } @@ -364,7 +367,7 @@ pub fn run_compiler( compiler.global_ctxt()?.peek_mut().enter(|tcx| tcx.analysis(LOCAL_CRATE))?; - if !callbacks.after_analysis(compiler) { + if callbacks.after_analysis(compiler) == Compilation::Stop { return sess.compile_status(); } |
