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