@@ -471,8 +471,7 @@ impl Clean<Item> for doctree::Trait {
471
471
472
472
impl Clean < Type > for ast:: trait_ref {
473
473
fn clean ( & self ) -> Type {
474
- let t = Unresolved ( self . path . clean ( ) , None , self . ref_id ) ;
475
- resolve_type ( & t)
474
+ resolve_type ( self . path . clean ( ) , None , self . ref_id )
476
475
}
477
476
}
478
477
@@ -517,9 +516,6 @@ impl Clean<TraitMethod> for ast::trait_method {
517
516
/// it does not preserve mutability or boxes.
518
517
#[ deriving( Clone , Encodable , Decodable ) ]
519
518
pub enum Type {
520
- /// Most types start out as "Unresolved". It serves as an intermediate stage between cleaning
521
- /// and type resolution.
522
- Unresolved ( Path , Option < ~[ TyParamBound ] > , ast:: NodeId ) ,
523
519
/// structs/enums/traits (anything that'd be an ast::ty_path)
524
520
ResolvedPath { path : Path , typarams : Option < ~[ TyParamBound ] > , id : ast:: NodeId } ,
525
521
/// Reference to an item in an external crate (fully qualified path)
@@ -558,25 +554,25 @@ impl Clean<Type> for ast::Ty {
558
554
debug ! ( "cleaning type `%?`" , self ) ;
559
555
let codemap = local_data:: get ( super :: ctxtkey, |x| * x. unwrap ( ) ) . sess . codemap ;
560
556
debug ! ( "span corresponds to `%s`" , codemap. span_to_str( self . span) ) ;
561
- let t = match self . node {
557
+ match self . node {
562
558
ty_nil => Unit ,
563
- ty_ptr( ref m) => RawPointer ( m. mutbl . clean ( ) , ~resolve_type ( & m. ty . clean ( ) ) ) ,
559
+ ty_ptr( ref m) => RawPointer ( m. mutbl . clean ( ) , ~m. ty . clean ( ) ) ,
564
560
ty_rptr( ref l, ref m) =>
565
561
BorrowedRef { lifetime : l. clean ( ) , mutability : m. mutbl . clean ( ) ,
566
- type_ : ~resolve_type ( & m. ty . clean ( ) ) } ,
567
- ty_box( ref m) => Managed ( m. mutbl . clean ( ) , ~resolve_type ( & m. ty . clean ( ) ) ) ,
568
- ty_uniq( ref m) => Unique ( ~resolve_type ( & m. ty . clean ( ) ) ) ,
569
- ty_vec( ref m) => Vector ( ~resolve_type ( & m. ty . clean ( ) ) ) ,
570
- ty_fixed_length_vec( ref m, ref e) => FixedVector ( ~resolve_type ( & m. ty . clean ( ) ) ,
562
+ type_ : ~m. ty . clean ( ) } ,
563
+ ty_box( ref m) => Managed ( m. mutbl . clean ( ) , ~m. ty . clean ( ) ) ,
564
+ ty_uniq( ref m) => Unique ( ~m. ty . clean ( ) ) ,
565
+ ty_vec( ref m) => Vector ( ~m. ty . clean ( ) ) ,
566
+ ty_fixed_length_vec( ref m, ref e) => FixedVector ( ~m. ty . clean ( ) ,
571
567
e. span . to_src ( ) ) ,
572
- ty_tup( ref tys) => Tuple ( tys. iter ( ) . map ( |x| resolve_type ( & x. clean ( ) ) ) . collect ( ) ) ,
573
- ty_path( ref p, ref tpbs, id) => Unresolved ( p. clean ( ) , tpbs. clean ( ) , id) ,
568
+ ty_tup( ref tys) => Tuple ( tys. iter ( ) . map ( |x| x. clean ( ) ) . collect ( ) ) ,
569
+ ty_path( ref p, ref tpbs, id) =>
570
+ resolve_type ( p. clean ( ) , tpbs. clean ( ) , id) ,
574
571
ty_closure( ref c) => Closure ( ~c. clean ( ) ) ,
575
572
ty_bare_fn( ref barefn) => BareFunction ( ~barefn. clean ( ) ) ,
576
573
ty_bot => Bottom ,
577
574
ref x => fail ! ( "Unimplemented type %?" , x) ,
578
- } ;
579
- resolve_type ( & t)
575
+ }
580
576
}
581
577
}
582
578
@@ -1039,14 +1035,10 @@ fn remove_comment_tags(s: &str) -> ~str {
1039
1035
}
1040
1036
1041
1037
/// Given a Type, resolve it using the def_map
1042
- fn resolve_type( t : & Type ) -> Type {
1038
+ fn resolve_type( path : Path , tpbs : Option < ~[ TyParamBound ] > ,
1039
+ id : ast:: NodeId ) -> Type {
1043
1040
use syntax:: ast:: * ;
1044
1041
1045
- let ( path, tpbs, id) = match t {
1046
- & Unresolved ( ref path, ref tbps, id) => ( path, tbps, id) ,
1047
- _ => return ( * t) . clone ( ) ,
1048
- } ;
1049
-
1050
1042
let dm = local_data:: get ( super :: ctxtkey, |x| * x. unwrap ( ) ) . tycx . def_map ;
1051
1043
debug ! ( "searching for %? in defmap" , id) ;
1052
1044
let d = match dm. find ( & id) {
0 commit comments