@@ -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
42
fn debug_trait_id (
42
- _type_kind_id : chalk_ir :: TraitId < Self > ,
43
- _fmt : & mut fmt:: Formatter < ' _ > ,
43
+ type_kind_id : TraitId ,
44
+ fmt : & mut fmt:: Formatter < ' _ > ,
44
45
) -> Option < fmt:: Result > {
45
- None
46
+ tls :: with_current_program ( |prog| Some ( prog? . debug_trait_id ( type_kind_id , fmt ) ) )
46
47
}
47
48
48
49
fn debug_assoc_type_id (
49
- _id : chalk_ir :: AssocTypeId < Self > ,
50
- _fmt : & mut fmt:: Formatter < ' _ > ,
50
+ id : AssocTypeId ,
51
+ fmt : & mut fmt:: Formatter < ' _ > ,
51
52
) -> Option < fmt:: Result > {
52
- None
53
+ tls :: with_current_program ( |prog| Some ( prog? . debug_assoc_type_id ( id , fmt ) ) )
53
54
}
54
55
55
- fn debug_alias (
56
- _projection : & chalk_ir:: AliasTy < Self > ,
57
- _fmt : & mut fmt:: Formatter < ' _ > ,
58
- ) -> Option < fmt:: Result > {
59
- None
56
+ fn debug_alias ( alias : & chalk_ir:: AliasTy < Interner > , fmt : & mut fmt:: Formatter < ' _ > ) -> Option < fmt:: Result > {
57
+ tls:: with_current_program ( |prog| Some ( prog?. debug_alias ( alias, fmt) ) )
60
58
}
61
59
62
- fn debug_ty ( _ty : & chalk_ir:: Ty < Self > , _fmt : & mut fmt:: Formatter < ' _ > ) -> Option < fmt:: Result > {
63
- 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 ) ) )
64
62
}
65
63
66
64
fn debug_lifetime (
67
- _lifetime : & chalk_ir:: Lifetime < Self > ,
68
- _fmt : & mut fmt:: Formatter < ' _ > ,
65
+ lifetime : & chalk_ir:: Lifetime < Interner > ,
66
+ fmt : & mut fmt:: Formatter < ' _ > ,
69
67
) -> Option < fmt:: Result > {
70
- None
68
+ tls :: with_current_program ( |prog| Some ( prog? . debug_lifetime ( lifetime , fmt ) ) )
71
69
}
72
70
73
71
fn debug_parameter (
74
- _parameter : & Parameter < Self > ,
75
- _fmt : & mut fmt:: Formatter < ' _ > ,
72
+ parameter : & Parameter < Interner > ,
73
+ fmt : & mut fmt:: Formatter < ' _ > ,
76
74
) -> Option < fmt:: Result > {
77
- None
75
+ tls :: with_current_program ( |prog| Some ( prog? . debug_parameter ( parameter , fmt ) ) )
78
76
}
79
77
80
- fn debug_goal ( _goal : & Goal < Self > , _fmt : & mut fmt:: Formatter < ' _ > ) -> Option < fmt:: Result > {
81
- 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 ) ) )
82
80
}
83
81
84
- fn debug_goals (
85
- _goals : & chalk_ir:: Goals < Self > ,
86
- _fmt : & mut fmt:: Formatter < ' _ > ,
87
- ) -> Option < fmt:: Result > {
88
- None
82
+ fn debug_goals ( goals : & chalk_ir:: Goals < Interner > , fmt : & mut fmt:: Formatter < ' _ > ) -> Option < fmt:: Result > {
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