From ae75311823574fd697f28961cecb0e0f3f3382ce Mon Sep 17 00:00:00 2001 From: Igor Matuszewski Date: Sun, 14 Jul 2019 20:24:48 +0200 Subject: [PATCH] Add Callbacks::after_expansion --- src/librustc_driver/lib.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/librustc_driver/lib.rs b/src/librustc_driver/lib.rs index e615f8a4846..8f69171cb4e 100644 --- a/src/librustc_driver/lib.rs +++ b/src/librustc_driver/lib.rs @@ -109,6 +109,10 @@ pub trait Callbacks { fn after_parsing(&mut self, _compiler: &interface::Compiler) -> bool { true } + /// Called after expansion and returns true to continue execution + fn after_expansion(&mut self, _compiler: &interface::Compiler) -> bool { + true + } /// Called after analysis and returns true to continue execution fn after_analysis(&mut self, _compiler: &interface::Compiler) -> bool { true @@ -312,6 +316,11 @@ pub fn run_compiler( return sess.compile_status(); } + compiler.expansion()?; + if !callbacks.after_expansion(compiler) { + return sess.compile_status(); + } + compiler.prepare_outputs()?; if sess.opts.output_types.contains_key(&OutputType::DepInfo)