Skip to content

Commit dd67650

Browse files
committed
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.
1 parent bdbcd14 commit dd67650

File tree

1 file changed

+4
-0
lines changed
  • compiler/rustc_driver_impl/src

1 file changed

+4
-0
lines changed

compiler/rustc_driver_impl/src/lib.rs

+4
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,9 @@ pub trait Callbacks {
157157
/// Called after parsing the crate root. Submodules are not yet parsed when
158158
/// this callback is called. Return value instructs the compiler whether to
159159
/// continue the compilation afterwards (defaults to `Compilation::Continue`)
160+
#[deprecated = "This callback will likely be removed or stop giving access \
161+
to the TyCtxt in the future. Use either the after_expansion \
162+
or the after_analysis callback instead."]
160163
fn after_crate_root_parsing<'tcx>(
161164
&mut self,
162165
_compiler: &interface::Compiler,
@@ -407,6 +410,7 @@ fn run_compiler(
407410
return early_exit();
408411
}
409412

413+
#[allow(deprecated)]
410414
if callbacks.after_crate_root_parsing(compiler, queries) == Compilation::Stop {
411415
return early_exit();
412416
}

0 commit comments

Comments
 (0)