File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -305,7 +305,7 @@ pub enum PrintMode {
305305/// names that types and modules have been aliased with in the current module.
306306#[ derive( Debug ) ]
307307pub struct Printer < ' a > {
308- pub names : & ' a Names ,
308+ names : & ' a Names ,
309309 uid : u64 ,
310310
311311 /// Some type variables aren't bound to names, so when trying to print those,
@@ -360,10 +360,18 @@ impl<'a> Printer<'a> {
360360 }
361361 }
362362
363+ /// Clear the registered type variable names. This allows the same `Printer`
364+ /// to be used in multiple different scopes, which have different sets of
365+ /// type variables. After clearing, the correct variables from the desired
366+ /// scope can be registered using `register_type_variable`.
363367 pub fn clear_type_variables ( & mut self ) {
364368 self . printed_type_variable_names . clear ( ) ;
365369 }
366370
371+ /// As explained in the documentation for `new_without_type_variables`, it
372+ /// it not always possible to determine which type variables are in scope.
373+ /// However, when it is possible, this function can be used to manually
374+ /// register which type variable names are in scope and cannot be used.
367375 pub fn register_type_variable ( & mut self , name : EcoString ) {
368376 _ = self . printed_type_variable_names . insert ( name) ;
369377 }
You can’t perform that action at this time.
0 commit comments