about summary refs log tree commit diff
path: root/compiler/rustc_driver_impl/src
diff options
context:
space:
mode:
authorbjorn3 <17426603+bjorn3@users.noreply.github.com>2024-10-31 16:34:16 +0000
committerbjorn3 <17426603+bjorn3@users.noreply.github.com>2024-11-09 18:43:29 +0000
commit159ba4ceabbb453bc77263f73f59887b5dfe7d72 (patch)
tree348dac48801ca0a56e3df1ff1c875541c2ab77e6 /compiler/rustc_driver_impl/src
parent3b02a3309e12906a455eb128a0aa74c6a6afc932 (diff)
downloadrust-159ba4ceabbb453bc77263f73f59887b5dfe7d72.tar.gz
rust-159ba4ceabbb453bc77263f73f59887b5dfe7d72.zip
Deprecate the after_crate_root_parsing callback
Several custom drivers are incorrectly calling queries.global_ctxt()
from inside of it, which causes some driver code to be skipped. As such
I would like to either remove it in the future or if custom drivers
still need it, change it to accept an &rustc_ast::Crate instead.
Diffstat (limited to 'compiler/rustc_driver_impl/src')
-rw-r--r--compiler/rustc_driver_impl/src/lib.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/compiler/rustc_driver_impl/src/lib.rs b/compiler/rustc_driver_impl/src/lib.rs
index 1f145185caa..425dda5a1e1 100644
--- a/compiler/rustc_driver_impl/src/lib.rs
+++ b/compiler/rustc_driver_impl/src/lib.rs
@@ -159,6 +159,9 @@ pub trait Callbacks {
     /// Called after parsing the crate root. Submodules are not yet parsed when
     /// this callback is called. Return value instructs the compiler whether to
     /// continue the compilation afterwards (defaults to `Compilation::Continue`)
+    #[deprecated = "This callback will likely be removed or stop giving access \
+                    to the TyCtxt in the future. Use either the after_expansion \
+                    or the after_analysis callback instead."]
     fn after_crate_root_parsing<'tcx>(
         &mut self,
         _compiler: &interface::Compiler,
@@ -409,6 +412,7 @@ fn run_compiler(
                 return early_exit();
             }
 
+            #[allow(deprecated)]
             if callbacks.after_crate_root_parsing(compiler, queries) == Compilation::Stop {
                 return early_exit();
             }