1
Fork 0

Remove the thir_{tree,flat} hooks.

They were downgraded from queries in #123995 but they can just be
vanilla functions because they are not called in `rustc_middle`.
This commit is contained in:
Nicholas Nethercote 2025-01-31 14:42:19 +11:00
parent be1aa7bb2a
commit 4b025ca083
5 changed files with 12 additions and 17 deletions

View file

@ -18,7 +18,7 @@ mod builder;
mod check_tail_calls;
mod check_unsafety;
mod errors;
mod thir;
pub mod thir;
use rustc_middle::util::Providers;
@ -33,6 +33,4 @@ pub fn provide(providers: &mut Providers) {
providers.check_unsafety = check_unsafety::check_unsafety;
providers.check_tail_calls = check_tail_calls::check_tail_calls;
providers.thir_body = thir::cx::thir_body;
providers.hooks.thir_tree = thir::print::thir_tree;
providers.hooks.thir_flat = thir::print::thir_flat;
}

View file

@ -7,5 +7,5 @@
pub(crate) mod constant;
pub(crate) mod cx;
pub(crate) mod pattern;
pub(crate) mod print;
pub mod print;
mod util;

View file

@ -1,12 +1,13 @@
use std::fmt::{self, Write};
use rustc_middle::query::TyCtxtAt;
use rustc_middle::thir::*;
use rustc_middle::ty;
use rustc_middle::ty::TyCtxt;
use rustc_span::def_id::LocalDefId;
pub(crate) fn thir_tree(tcx: TyCtxtAt<'_>, owner_def: LocalDefId) -> String {
match super::cx::thir_body(*tcx, owner_def) {
/// Create a THIR tree for debugging.
pub fn thir_tree(tcx: TyCtxt<'_>, owner_def: LocalDefId) -> String {
match super::cx::thir_body(tcx, owner_def) {
Ok((thir, _)) => {
let thir = thir.steal();
let mut printer = ThirPrinter::new(&thir);
@ -17,8 +18,9 @@ pub(crate) fn thir_tree(tcx: TyCtxtAt<'_>, owner_def: LocalDefId) -> String {
}
}
pub(crate) fn thir_flat(tcx: TyCtxtAt<'_>, owner_def: LocalDefId) -> String {
match super::cx::thir_body(*tcx, owner_def) {
/// Create a list-like THIR representation for debugging.
pub fn thir_flat(tcx: TyCtxt<'_>, owner_def: LocalDefId) -> String {
match super::cx::thir_body(tcx, owner_def) {
Ok((thir, _)) => format!("{:#?}", thir.steal()),
Err(_) => "error".into(),
}