From cc5c1a0abb1a4e25c8a40126991acce4c34508c4 Mon Sep 17 00:00:00 2001 From: bjorn3 Date: Mon, 4 Jun 2018 12:14:50 +0200 Subject: [PATCH] Add comment --- src/librustc_driver/driver.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/librustc_driver/driver.rs b/src/librustc_driver/driver.rs index 7b177d5e79c1..8dcbda917b24 100644 --- a/src/librustc_driver/driver.rs +++ b/src/librustc_driver/driver.rs @@ -414,6 +414,18 @@ impl<'a> CompileController<'a> { } } +/// This implementation makes it easier to create a custom driver when you only want to hook +/// into callbacks from `CompileController`. +/// +/// # Example +/// +/// ```no_run +/// # extern crate rustc_driver; +/// # use rustc_driver::driver::CompileController; +/// let mut controller = CompileController::basic(); +/// controller.after_analysis.callback = Box::new(move |_state| {}); +/// rustc_driver::run_compiler(&[], Box::new(controller), None, None); +/// ``` impl<'a> ::CompilerCalls<'a> for CompileController<'a> { fn early_callback( &mut self,