This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 5 files changed +22
-31
lines changed Expand file tree Collapse file tree 5 files changed +22
-31
lines changed Original file line number Diff line number Diff line change @@ -29,7 +29,6 @@ use rustc_target::asm::InlineAsmRegOrRegClass;
2929use std:: fmt;
3030use std:: ops:: Index ;
3131
32- pub mod print;
3332pub mod visit;
3433
3534macro_rules! thir_with_elements {
Original file line number Diff line number Diff line change @@ -38,6 +38,6 @@ pub fn provide(providers: &mut Providers) {
3838 providers. thir_check_unsafety = check_unsafety:: thir_check_unsafety;
3939 providers. thir_check_unsafety_for_const_arg = check_unsafety:: thir_check_unsafety_for_const_arg;
4040 providers. thir_body = thir:: cx:: thir_body;
41- providers. thir_tree = thir:: cx :: thir_tree;
42- providers. thir_flat = thir:: cx :: thir_flat;
41+ providers. thir_tree = thir:: print :: thir_tree;
42+ providers. thir_flat = thir:: print :: thir_flat;
4343}
Original file line number Diff line number Diff line change @@ -52,23 +52,6 @@ pub(crate) fn thir_body(
5252 Ok ( ( tcx. alloc_steal_thir ( cx. thir ) , expr) )
5353}
5454
55- pub ( crate ) fn thir_tree ( tcx : TyCtxt < ' _ > , owner_def : ty:: WithOptConstParam < LocalDefId > ) -> String {
56- match thir_body ( tcx, owner_def) {
57- Ok ( ( thir, _) ) => {
58- let thir = thir. steal ( ) ;
59- tcx. thir_tree_representation ( & thir)
60- }
61- Err ( _) => "error" . into ( ) ,
62- }
63- }
64-
65- pub ( crate ) fn thir_flat ( tcx : TyCtxt < ' _ > , owner_def : ty:: WithOptConstParam < LocalDefId > ) -> String {
66- match thir_body ( tcx, owner_def) {
67- Ok ( ( thir, _) ) => format ! ( "{:#?}" , thir. steal( ) ) ,
68- Err ( _) => "error" . into ( ) ,
69- }
70- }
71-
7255struct Cx < ' tcx > {
7356 tcx : TyCtxt < ' tcx > ,
7457 thir : Thir < ' tcx > ,
Original file line number Diff line number Diff line change 55//! structures.
66
77pub ( crate ) mod constant;
8-
98pub ( crate ) mod cx;
10-
119pub ( crate ) mod pattern;
12-
10+ pub ( crate ) mod print ;
1311mod util;
Original file line number Diff line number Diff line change 1- use crate :: thir:: * ;
2- use crate :: ty:: { self , TyCtxt } ;
3-
1+ use rustc_middle :: thir:: * ;
2+ use rustc_middle :: ty:: { self , TyCtxt } ;
3+ use rustc_span :: def_id :: LocalDefId ;
44use std:: fmt:: { self , Write } ;
55
6- impl < ' tcx > TyCtxt < ' tcx > {
7- pub fn thir_tree_representation < ' a > ( self , thir : & ' a Thir < ' tcx > ) -> String {
8- let mut printer = ThirPrinter :: new ( thir) ;
9- printer. print ( ) ;
10- printer. into_buffer ( )
6+ pub ( crate ) fn thir_tree ( tcx : TyCtxt < ' _ > , owner_def : ty:: WithOptConstParam < LocalDefId > ) -> String {
7+ match super :: cx:: thir_body ( tcx, owner_def) {
8+ Ok ( ( thir, _) ) => {
9+ let thir = thir. steal ( ) ;
10+ let mut printer = ThirPrinter :: new ( & thir) ;
11+ printer. print ( ) ;
12+ printer. into_buffer ( )
13+ }
14+ Err ( _) => "error" . into ( ) ,
15+ }
16+ }
17+
18+ pub ( crate ) fn thir_flat ( tcx : TyCtxt < ' _ > , owner_def : ty:: WithOptConstParam < LocalDefId > ) -> String {
19+ match super :: cx:: thir_body ( tcx, owner_def) {
20+ Ok ( ( thir, _) ) => format ! ( "{:#?}" , thir. steal( ) ) ,
21+ Err ( _) => "error" . into ( ) ,
1122 }
1223}
1324
You can’t perform that action at this time.
0 commit comments