@@ -88,6 +88,7 @@ use syntax::visit::{mod, Visitor};
8888use std:: collections:: { HashMap , HashSet } ;
8989use std:: collections:: hash_map:: Entry :: { Occupied , Vacant } ;
9090use std:: cell:: { Cell , RefCell } ;
91+ use std:: fmt;
9192use std:: mem:: replace;
9293use std:: rc:: { Rc , Weak } ;
9394use std:: uint;
@@ -178,7 +179,7 @@ impl<'a, 'v, 'tcx> Visitor<'v> for Resolver<'a, 'tcx> {
178179}
179180
180181/// Contains data for specific types of import directives.
181- #[ deriving( Copy ) ]
182+ #[ deriving( Copy , Show ) ]
182183enum ImportDirectiveSubclass {
183184 SingleImport ( Name /* target */ , Name /* source */ ) ,
184185 GlobImport
@@ -309,6 +310,7 @@ enum Shadowable {
309310}
310311
311312/// One import directive.
313+ #[ deriving( Show ) ]
312314struct ImportDirective {
313315 module_path : Vec < Name > ,
314316 subclass : ImportDirectiveSubclass ,
@@ -338,7 +340,7 @@ impl ImportDirective {
338340}
339341
340342/// The item that an import resolves to.
341- #[ deriving( Clone ) ]
343+ #[ deriving( Clone , Show ) ]
342344struct Target {
343345 target_module : Rc < Module > ,
344346 bindings : Rc < NameBindings > ,
@@ -359,6 +361,7 @@ impl Target {
359361}
360362
361363/// An ImportResolution represents a particular `use` directive.
364+ #[ deriving( Show ) ]
362365struct ImportResolution {
363366 /// Whether this resolution came from a `use` or a `pub use`. Note that this
364367 /// should *not* be used whenever resolution is being performed, this is
@@ -438,15 +441,15 @@ impl ImportResolution {
438441}
439442
440443/// The link from a module up to its nearest parent node.
441- #[ deriving( Clone ) ]
444+ #[ deriving( Clone , Show ) ]
442445enum ParentLink {
443446 NoParentLink ,
444447 ModuleParentLink ( Weak < Module > , Name ) ,
445448 BlockParentLink ( Weak < Module > , NodeId )
446449}
447450
448451/// The type of module this is.
449- #[ deriving( Copy , PartialEq ) ]
452+ #[ deriving( Copy , PartialEq , Show ) ]
450453enum ModuleKind {
451454 NormalModuleKind ,
452455 TraitModuleKind ,
@@ -528,6 +531,15 @@ impl Module {
528531 }
529532}
530533
534+ impl fmt:: Show for Module {
535+ fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
536+ write ! ( f, "{}, kind: {}, {}" ,
537+ self . def_id,
538+ self . kind,
539+ if self . is_public { "public" } else { "private" } )
540+ }
541+ }
542+
531543bitflags ! {
532544 #[ deriving( Show ) ]
533545 flags DefModifiers : u8 {
@@ -537,7 +549,7 @@ bitflags! {
537549}
538550
539551// Records a possibly-private type definition.
540- #[ deriving( Clone ) ]
552+ #[ deriving( Clone , Show ) ]
541553struct TypeNsDef {
542554 modifiers : DefModifiers , // see note in ImportResolution about how to use this
543555 module_def : Option < Rc < Module > > ,
@@ -555,6 +567,7 @@ struct ValueNsDef {
555567
556568// Records the definitions (at most one for each namespace) that a name is
557569// bound to.
570+ #[ deriving( Show ) ]
558571struct NameBindings {
559572 type_def : RefCell < Option < TypeNsDef > > , //< Meaning in type namespace.
560573 value_def : RefCell < Option < ValueNsDef > > , //< Meaning in value namespace.
0 commit comments