Skip to content

Commit 159ba4c

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 3b02a33 commit 159ba4c

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
@@ -159,6 +159,9 @@ pub trait Callbacks {
159159
/// Called after parsing the crate root. Submodules are not yet parsed when
160160
/// this callback is called. Return value instructs the compiler whether to
161161
/// continue the compilation afterwards (defaults to `Compilation::Continue`)
162+
#[deprecated = "This callback will likely be removed or stop giving access \
163+
to the TyCtxt in the future. Use either the after_expansion \
164+
or the after_analysis callback instead."]
162165
fn after_crate_root_parsing<'tcx>(
163166
&mut self,
164167
_compiler: &interface::Compiler,
@@ -409,6 +412,7 @@ fn run_compiler(
409412
return early_exit();
410413
}
411414

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

0 commit comments

Comments
 (0)