44//! and levels. The type checker uses a locally nameless representation
55//! for type variables, with additional abstractions for implicitly
66//! quantified type variables in permitted contexts like instance heads.
7- use std:: ops;
7+ use std:: { fmt , ops} ;
88
99use lowering:: { GraphNodeId , ImplicitBindingId , TypeVariableBindingId } ;
1010use rustc_hash:: FxHashMap ;
@@ -39,6 +39,12 @@ pub struct Bound {
3939#[ derive( Debug , Clone , Copy , PartialEq , Eq , PartialOrd , Ord , Hash ) ]
4040pub struct Level ( u32 ) ;
4141
42+ impl fmt:: Display for Level {
43+ fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
44+ write ! ( f, "&{}" , self . 0 )
45+ }
46+ }
47+
4248/// A De Bruijn index.
4349///
4450/// De Bruijn indices are used to identify variables from the
@@ -52,6 +58,12 @@ pub struct Level(u32);
5258#[ derive( Debug , Clone , Copy , PartialEq , Eq , PartialOrd , Ord , Hash ) ]
5359pub struct Index ( u32 ) ;
5460
61+ impl fmt:: Display for Index {
62+ fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
63+ write ! ( f, "*{}" , self . 0 )
64+ }
65+ }
66+
5567impl Bound {
5668 /// Returns the current De Bruijn [`Level`].
5769 pub fn level ( & self ) -> Level {
0 commit comments