This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +14
-21
lines changed Expand file tree Collapse file tree 4 files changed +14
-21
lines changed Original file line number Diff line number Diff line change @@ -102,4 +102,10 @@ declare_hooks! {
102102 /// turn a deserialized `DefPathHash` into its current `DefId`.
103103 /// Will fetch a DefId from a DefPathHash for a foreign crate.
104104 hook def_path_hash_to_def_id_extern( hash: DefPathHash , stable_crate_id: StableCrateId ) -> DefId ;
105+
106+ /// Create a THIR tree for debugging.
107+ hook thir_tree( key: LocalDefId ) -> String ;
108+
109+ /// Create a list-like THIR representation for debugging.
110+ hook thir_flat( key: LocalDefId ) -> String ;
105111}
Original file line number Diff line number Diff line change @@ -474,20 +474,6 @@ rustc_queries! {
474474 desc { |tcx| "building THIR for `{}`" , tcx. def_path_str( key) }
475475 }
476476
477- /// Create a THIR tree for debugging.
478- query thir_tree( key: LocalDefId ) -> & ' tcx String {
479- no_hash
480- arena_cache
481- desc { |tcx| "constructing THIR tree for `{}`" , tcx. def_path_str( key) }
482- }
483-
484- /// Create a list-like THIR representation for debugging.
485- query thir_flat( key: LocalDefId ) -> & ' tcx String {
486- no_hash
487- arena_cache
488- desc { |tcx| "constructing flat THIR representation for `{}`" , tcx. def_path_str( key) }
489- }
490-
491477 /// Set of all the `DefId`s in this crate that have MIR associated with
492478 /// them. This includes all the body owners, but also things like struct
493479 /// constructors.
Original file line number Diff line number Diff line change @@ -34,6 +34,6 @@ pub fn provide(providers: &mut Providers) {
3434 build:: closure_saved_names_of_captured_variables;
3535 providers. check_unsafety = check_unsafety:: check_unsafety;
3636 providers. thir_body = thir:: cx:: thir_body;
37- providers. thir_tree = thir:: print:: thir_tree;
38- providers. thir_flat = thir:: print:: thir_flat;
37+ providers. hooks . thir_tree = thir:: print:: thir_tree;
38+ providers. hooks . thir_flat = thir:: print:: thir_flat;
3939}
Original file line number Diff line number Diff line change 1+ use rustc_middle:: query:: TyCtxtAt ;
12use rustc_middle:: thir:: * ;
2- use rustc_middle:: ty:: { self , TyCtxt } ;
3+ use rustc_middle:: ty;
34use rustc_span:: def_id:: LocalDefId ;
45use std:: fmt:: { self , Write } ;
56
6- pub ( crate ) fn thir_tree ( tcx : TyCtxt < ' _ > , owner_def : LocalDefId ) -> String {
7- match super :: cx:: thir_body ( tcx, owner_def) {
7+ pub ( crate ) fn thir_tree ( tcx : TyCtxtAt < ' _ > , owner_def : LocalDefId ) -> String {
8+ match super :: cx:: thir_body ( * tcx, owner_def) {
89 Ok ( ( thir, _) ) => {
910 let thir = thir. steal ( ) ;
1011 let mut printer = ThirPrinter :: new ( & thir) ;
@@ -15,8 +16,8 @@ pub(crate) fn thir_tree(tcx: TyCtxt<'_>, owner_def: LocalDefId) -> String {
1516 }
1617}
1718
18- pub ( crate ) fn thir_flat ( tcx : TyCtxt < ' _ > , owner_def : LocalDefId ) -> String {
19- match super :: cx:: thir_body ( tcx, owner_def) {
19+ pub ( crate ) fn thir_flat ( tcx : TyCtxtAt < ' _ > , owner_def : LocalDefId ) -> String {
20+ match super :: cx:: thir_body ( * tcx, owner_def) {
2021 Ok ( ( thir, _) ) => format ! ( "{:#?}" , thir. steal( ) ) ,
2122 Err ( _) => "error" . into ( ) ,
2223 }
You can’t perform that action at this time.
0 commit comments