File tree 5 files changed +22
-31
lines changed
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;
29
29
use std:: fmt;
30
30
use std:: ops:: Index ;
31
31
32
- pub mod print;
33
32
pub mod visit;
34
33
35
34
macro_rules! thir_with_elements {
Original file line number Diff line number Diff line change @@ -38,6 +38,6 @@ pub fn provide(providers: &mut Providers) {
38
38
providers. thir_check_unsafety = check_unsafety:: thir_check_unsafety;
39
39
providers. thir_check_unsafety_for_const_arg = check_unsafety:: thir_check_unsafety_for_const_arg;
40
40
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;
43
43
}
Original file line number Diff line number Diff line change @@ -52,23 +52,6 @@ pub(crate) fn thir_body(
52
52
Ok ( ( tcx. alloc_steal_thir ( cx. thir ) , expr) )
53
53
}
54
54
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
-
72
55
struct Cx < ' tcx > {
73
56
tcx : TyCtxt < ' tcx > ,
74
57
thir : Thir < ' tcx > ,
Original file line number Diff line number Diff line change 5
5
//! structures.
6
6
7
7
pub ( crate ) mod constant;
8
-
9
8
pub ( crate ) mod cx;
10
-
11
9
pub ( crate ) mod pattern;
12
-
10
+ pub ( crate ) mod print ;
13
11
mod 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 ;
4
4
use std:: fmt:: { self , Write } ;
5
5
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 ( ) ,
11
22
}
12
23
}
13
24
You can’t perform that action at this time.
0 commit comments