1
Fork 0

previous thir unpretty output through thir-flat

This commit is contained in:
b-naber 2023-01-26 23:35:24 +01:00
parent 3bce66f786
commit 9438126fd1
5 changed files with 38 additions and 3 deletions

View file

@ -34,4 +34,5 @@ pub fn provide(providers: &mut Providers) {
providers.thir_check_unsafety_for_const_arg = check_unsafety::thir_check_unsafety_for_const_arg;
providers.thir_body = thir::cx::thir_body;
providers.thir_tree = thir::cx::thir_tree;
providers.thir_flat = thir::cx::thir_flat;
}

View file

@ -62,6 +62,13 @@ pub(crate) fn thir_tree(tcx: TyCtxt<'_>, owner_def: ty::WithOptConstParam<LocalD
}
}
pub(crate) fn thir_flat(tcx: TyCtxt<'_>, owner_def: ty::WithOptConstParam<LocalDefId>) -> String {
match thir_body(tcx, owner_def) {
Ok((thir, _)) => format!("{:#?}", thir.steal()),
Err(_) => "error".into(),
}
}
struct Cx<'tcx> {
tcx: TyCtxt<'tcx>,
thir: Thir<'tcx>,