File tree 4 files changed +14
-21
lines changed
4 files changed +14
-21
lines changed Original file line number Diff line number Diff line change @@ -102,4 +102,10 @@ declare_hooks! {
102
102
/// turn a deserialized `DefPathHash` into its current `DefId`.
103
103
/// Will fetch a DefId from a DefPathHash for a foreign crate.
104
104
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 ;
105
111
}
Original file line number Diff line number Diff line change @@ -474,20 +474,6 @@ rustc_queries! {
474
474
desc { |tcx| "building THIR for `{}`" , tcx. def_path_str( key) }
475
475
}
476
476
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
-
491
477
/// Set of all the `DefId`s in this crate that have MIR associated with
492
478
/// them. This includes all the body owners, but also things like struct
493
479
/// constructors.
Original file line number Diff line number Diff line change @@ -34,6 +34,6 @@ pub fn provide(providers: &mut Providers) {
34
34
build:: closure_saved_names_of_captured_variables;
35
35
providers. check_unsafety = check_unsafety:: check_unsafety;
36
36
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;
39
39
}
Original file line number Diff line number Diff line change
1
+ use rustc_middle:: query:: TyCtxtAt ;
1
2
use rustc_middle:: thir:: * ;
2
- use rustc_middle:: ty:: { self , TyCtxt } ;
3
+ use rustc_middle:: ty;
3
4
use rustc_span:: def_id:: LocalDefId ;
4
5
use std:: fmt:: { self , Write } ;
5
6
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) {
8
9
Ok ( ( thir, _) ) => {
9
10
let thir = thir. steal ( ) ;
10
11
let mut printer = ThirPrinter :: new ( & thir) ;
@@ -15,8 +16,8 @@ pub(crate) fn thir_tree(tcx: TyCtxt<'_>, owner_def: LocalDefId) -> String {
15
16
}
16
17
}
17
18
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) {
20
21
Ok ( ( thir, _) ) => format ! ( "{:#?}" , thir. steal( ) ) ,
21
22
Err ( _) => "error" . into ( ) ,
22
23
}
You can’t perform that action at this time.
0 commit comments