@@ -11,6 +11,8 @@ use crate::OpaqueTyId;
11
11
use crate :: Parameter ;
12
12
use crate :: ParameterData ;
13
13
use crate :: ParameterKind ;
14
+ use crate :: ParameterKinds ;
15
+ use crate :: ParameterKindsWithUniverseIndex ;
14
16
use crate :: ProgramClause ;
15
17
use crate :: ProgramClauseData ;
16
18
use crate :: ProgramClauseImplication ;
@@ -282,6 +284,36 @@ pub trait Interner: Debug + Copy + Eq + Ord + Hash {
282
284
None
283
285
}
284
286
287
+ /// Prints the debug representation of a parameter kinds list. To get good
288
+ /// results, this requires inspecting TLS, and is difficult to
289
+ /// code without reference to a specific interner (and hence
290
+ /// fully known types).
291
+ ///
292
+ /// Returns `None` to fallback to the default debug output (e.g.,
293
+ /// if no info about current program is available from TLS).
294
+ #[ allow( unused_variables) ]
295
+ fn debug_parameter_kinds (
296
+ parameter_kinds : & ParameterKinds < Self > ,
297
+ fmt : & mut fmt:: Formatter < ' _ > ,
298
+ ) -> Option < fmt:: Result > {
299
+ None
300
+ }
301
+
302
+ /// Prints the debug representation of an parameter kinds list with universe index.
303
+ /// To get good results, this requires inspecting TLS, and is difficult to
304
+ /// code without reference to a specific interner (and hence
305
+ /// fully known types).
306
+ ///
307
+ /// Returns `None` to fallback to the default debug output (e.g.,
308
+ /// if no info about current program is available from TLS).
309
+ #[ allow( unused_variables) ]
310
+ fn debug_parameter_kinds_with_universe_index (
311
+ parameter_kinds_with_universe_index : & ParameterKindsWithUniverseIndex < Self > ,
312
+ fmt : & mut fmt:: Formatter < ' _ > ,
313
+ ) -> Option < fmt:: Result > {
314
+ None
315
+ }
316
+
285
317
/// Prints the debug representation of an goal. To get good
286
318
/// results, this requires inspecting TLS, and is difficult to
287
319
/// code without reference to a specific interner (and hence
@@ -548,12 +580,22 @@ pub trait Interner: Debug + Copy + Eq + Ord + Hash {
548
580
549
581
pub trait TargetInterner < I : Interner > : Interner {
550
582
fn transfer_def_id ( def_id : I :: DefId ) -> Self :: DefId ;
583
+
584
+ fn transfer_parameter_kinds_with_universe_index (
585
+ parameter_kinds : I :: InternedParameterKindsWithUniverseIndex ,
586
+ ) -> Self :: InternedParameterKindsWithUniverseIndex ;
551
587
}
552
588
553
589
impl < I : Interner > TargetInterner < I > for I {
554
590
fn transfer_def_id ( def_id : I :: DefId ) -> Self :: DefId {
555
591
def_id
556
592
}
593
+
594
+ fn transfer_parameter_kinds_with_universe_index (
595
+ parameter_kinds : I :: InternedParameterKindsWithUniverseIndex ,
596
+ ) -> Self :: InternedParameterKindsWithUniverseIndex {
597
+ parameter_kinds
598
+ }
557
599
}
558
600
559
601
/// Implemented by types that have an associated interner (which
@@ -674,6 +716,27 @@ mod default {
674
716
tls:: with_current_program ( |prog| Some ( prog?. debug_parameter ( parameter, fmt) ) )
675
717
}
676
718
719
+ fn debug_parameter_kinds (
720
+ parameter_kinds : & ParameterKinds < Self > ,
721
+ fmt : & mut fmt:: Formatter < ' _ > ,
722
+ ) -> Option < fmt:: Result > {
723
+ tls:: with_current_program ( |prog| {
724
+ Some ( prog?. debug_parameter_kinds ( parameter_kinds, fmt) )
725
+ } )
726
+ }
727
+
728
+ fn debug_parameter_kinds_with_universe_index (
729
+ parameter_kinds_with_universe_index : & ParameterKindsWithUniverseIndex < Self > ,
730
+ fmt : & mut fmt:: Formatter < ' _ > ,
731
+ ) -> Option < fmt:: Result > {
732
+ tls:: with_current_program ( |prog| {
733
+ Some ( prog?. debug_parameter_kinds_with_universe_index (
734
+ parameter_kinds_with_universe_index,
735
+ fmt,
736
+ ) )
737
+ } )
738
+ }
739
+
677
740
fn debug_goal ( goal : & Goal < ChalkIr > , fmt : & mut fmt:: Formatter < ' _ > ) -> Option < fmt:: Result > {
678
741
tls:: with_current_program ( |prog| Some ( prog?. debug_goal ( goal, fmt) ) )
679
742
}
0 commit comments