@@ -17,6 +17,8 @@ use crate::{
17
17
ProjectionTy , Substs , TraitRef , Ty , TypeCtor ,
18
18
} ;
19
19
20
+ pub ( super ) mod tls;
21
+
20
22
#[ derive( Debug , Copy , Clone , Hash , PartialOrd , Ord , PartialEq , Eq ) ]
21
23
pub struct Interner ;
22
24
@@ -30,90 +32,85 @@ impl chalk_ir::interner::Interner for Interner {
30
32
type Identifier = TypeAliasId ;
31
33
type DefId = InternId ;
32
34
33
- // FIXME: implement these
34
35
fn debug_struct_id (
35
- _type_kind_id : chalk_ir :: StructId < Self > ,
36
- _fmt : & mut fmt:: Formatter < ' _ > ,
36
+ type_kind_id : StructId ,
37
+ fmt : & mut fmt:: Formatter < ' _ > ,
37
38
) -> Option < fmt:: Result > {
38
- None
39
+ tls :: with_current_program ( |prog| Some ( prog? . debug_struct_id ( type_kind_id , fmt ) ) )
39
40
}
40
41
41
- fn debug_trait_id (
42
- _type_kind_id : chalk_ir:: TraitId < Self > ,
43
- _fmt : & mut fmt:: Formatter < ' _ > ,
44
- ) -> Option < fmt:: Result > {
45
- None
42
+ fn debug_trait_id ( type_kind_id : TraitId , fmt : & mut fmt:: Formatter < ' _ > ) -> Option < fmt:: Result > {
43
+ tls:: with_current_program ( |prog| Some ( prog?. debug_trait_id ( type_kind_id, fmt) ) )
46
44
}
47
45
48
- fn debug_assoc_type_id (
49
- _id : chalk_ir:: AssocTypeId < Self > ,
50
- _fmt : & mut fmt:: Formatter < ' _ > ,
51
- ) -> Option < fmt:: Result > {
52
- None
46
+ fn debug_assoc_type_id ( id : AssocTypeId , fmt : & mut fmt:: Formatter < ' _ > ) -> Option < fmt:: Result > {
47
+ tls:: with_current_program ( |prog| Some ( prog?. debug_assoc_type_id ( id, fmt) ) )
53
48
}
54
49
55
50
fn debug_alias (
56
- _projection : & chalk_ir:: AliasTy < Self > ,
57
- _fmt : & mut fmt:: Formatter < ' _ > ,
51
+ alias : & chalk_ir:: AliasTy < Interner > ,
52
+ fmt : & mut fmt:: Formatter < ' _ > ,
58
53
) -> Option < fmt:: Result > {
59
- None
54
+ tls :: with_current_program ( |prog| Some ( prog? . debug_alias ( alias , fmt ) ) )
60
55
}
61
56
62
- fn debug_ty ( _ty : & chalk_ir:: Ty < Self > , _fmt : & mut fmt:: Formatter < ' _ > ) -> Option < fmt:: Result > {
63
- None
57
+ fn debug_ty ( ty : & chalk_ir:: Ty < Interner > , fmt : & mut fmt:: Formatter < ' _ > ) -> Option < fmt:: Result > {
58
+ tls :: with_current_program ( |prog| Some ( prog? . debug_ty ( ty , fmt ) ) )
64
59
}
65
60
66
61
fn debug_lifetime (
67
- _lifetime : & chalk_ir:: Lifetime < Self > ,
68
- _fmt : & mut fmt:: Formatter < ' _ > ,
62
+ lifetime : & chalk_ir:: Lifetime < Interner > ,
63
+ fmt : & mut fmt:: Formatter < ' _ > ,
69
64
) -> Option < fmt:: Result > {
70
- None
65
+ tls :: with_current_program ( |prog| Some ( prog? . debug_lifetime ( lifetime , fmt ) ) )
71
66
}
72
67
73
68
fn debug_parameter (
74
- _parameter : & Parameter < Self > ,
75
- _fmt : & mut fmt:: Formatter < ' _ > ,
69
+ parameter : & Parameter < Interner > ,
70
+ fmt : & mut fmt:: Formatter < ' _ > ,
76
71
) -> Option < fmt:: Result > {
77
- None
72
+ tls :: with_current_program ( |prog| Some ( prog? . debug_parameter ( parameter , fmt ) ) )
78
73
}
79
74
80
- fn debug_goal ( _goal : & Goal < Self > , _fmt : & mut fmt:: Formatter < ' _ > ) -> Option < fmt:: Result > {
81
- None
75
+ fn debug_goal ( goal : & Goal < Interner > , fmt : & mut fmt:: Formatter < ' _ > ) -> Option < fmt:: Result > {
76
+ tls :: with_current_program ( |prog| Some ( prog? . debug_goal ( goal , fmt ) ) )
82
77
}
83
78
84
79
fn debug_goals (
85
- _goals : & chalk_ir:: Goals < Self > ,
86
- _fmt : & mut fmt:: Formatter < ' _ > ,
80
+ goals : & chalk_ir:: Goals < Interner > ,
81
+ fmt : & mut fmt:: Formatter < ' _ > ,
87
82
) -> Option < fmt:: Result > {
88
- None
83
+ tls :: with_current_program ( |prog| Some ( prog? . debug_goals ( goals , fmt ) ) )
89
84
}
90
85
91
86
fn debug_program_clause_implication (
92
- _pci : & chalk_ir:: ProgramClauseImplication < Self > ,
93
- _fmt : & mut fmt:: Formatter < ' _ > ,
87
+ pci : & chalk_ir:: ProgramClauseImplication < Interner > ,
88
+ fmt : & mut fmt:: Formatter < ' _ > ,
94
89
) -> Option < fmt:: Result > {
95
- None
90
+ tls :: with_current_program ( |prog| Some ( prog? . debug_program_clause_implication ( pci , fmt ) ) )
96
91
}
97
92
98
93
fn debug_application_ty (
99
- _application_ty : & chalk_ir:: ApplicationTy < Self > ,
100
- _fmt : & mut fmt:: Formatter < ' _ > ,
94
+ application_ty : & chalk_ir:: ApplicationTy < Interner > ,
95
+ fmt : & mut fmt:: Formatter < ' _ > ,
101
96
) -> Option < fmt:: Result > {
102
- None
97
+ tls :: with_current_program ( |prog| Some ( prog? . debug_application_ty ( application_ty , fmt ) ) )
103
98
}
104
99
105
100
fn debug_substitution (
106
- _substitution : & chalk_ir:: Substitution < Self > ,
107
- _fmt : & mut fmt:: Formatter < ' _ > ,
101
+ substitution : & chalk_ir:: Substitution < Interner > ,
102
+ fmt : & mut fmt:: Formatter < ' _ > ,
108
103
) -> Option < fmt:: Result > {
109
- None
104
+ tls :: with_current_program ( |prog| Some ( prog? . debug_substitution ( substitution , fmt ) ) )
110
105
}
111
106
112
107
fn debug_separator_trait_ref (
113
- _separator_trait_ref : & chalk_ir:: SeparatorTraitRef < Self > ,
114
- _fmt : & mut fmt:: Formatter < ' _ > ,
108
+ separator_trait_ref : & chalk_ir:: SeparatorTraitRef < Interner > ,
109
+ fmt : & mut fmt:: Formatter < ' _ > ,
115
110
) -> Option < fmt:: Result > {
116
- None
111
+ tls:: with_current_program ( |prog| {
112
+ Some ( prog?. debug_separator_trait_ref ( separator_trait_ref, fmt) )
113
+ } )
117
114
}
118
115
119
116
fn intern_ty ( & self , ty : chalk_ir:: TyData < Self > ) -> Box < chalk_ir:: TyData < Self > > {
0 commit comments