pub fn normalize_ty(cx: ctxt, t: t) -> t {
    let u = TypeNormalizer(cx).fold_ty(t);
    return u;

    struct TypeNormalizer(ctxt);

    impl TypeFolder for TypeNormalizer {
        fn tcx(&self) -> ty::ctxt { let TypeNormalizer(c) = *self; c }

        fn fold_ty(&mut self, t: ty::t) -> ty::t {
            let normalized_opt = {
                let normalized_cache = self.tcx().normalized_cache.borrow();
                normalized_cache.get().find_copy(&t)
            };
            match normalized_opt {
                Some(u) => {
                    return u;
                }
                None => {
                    let t_norm = ty_fold::super_fold_ty(self, t);
                    let mut normalized_cache = self.tcx()
                                                   .normalized_cache
                                                   .borrow_mut();
                    normalized_cache.get().insert(t, t_norm);
                    return t_norm;
                }
            }
        }

        fn fold_vstore(&mut self, vstore: vstore) -> vstore {
            match vstore {
                vstore_fixed(..) | vstore_uniq | vstore_box => vstore,
                vstore_slice(_) => vstore_slice(ReStatic)
            }
        }

        fn fold_region(&mut self, _: ty::Region) -> ty::Region {
            ty::ReStatic
        }

        fn fold_substs(&mut self,
                       substs: &substs)
                       -> substs {
            substs { regions: ErasedRegions,
                     self_ty: ty_fold::fold_opt_ty(self, substs.self_ty),
                     tps: ty_fold::fold_ty_vec(self, substs.tps) }
        }

        fn fold_sig(&mut self,
                    sig: &ty::FnSig)
                    -> ty::FnSig {
            // The binder-id is only relevant to bound regions, which
            // are erased at trans time.
            ty::FnSig { binder_id: ast::DUMMY_NODE_ID,
                        inputs: ty_fold::fold_ty_vec(self, sig.inputs),
                        output: self.fold_ty(sig.output),
                        variadic: sig.variadic }
        }
    }
}
/// Returns an equivalent type with all the typedefs and self regions removed.
Returns an equivalent type with all the typedefs and self regions removed.
Returns an equivalent type with all the typedefs and self regions removed .
pub fn normalize_ty(cx: ctxt, t: t) -> t {
    let u = TypeNormalizer(cx).fold_ty(t);
    return u;
    struct TypeNormalizer(ctxt);
    impl TypeFolder for TypeNormalizer {
        fn tcx(&self) -> ty::ctxt { let TypeNormalizer(c) = *self; c }
        fn fold_ty(&mut self, t: ty::t) -> ty::t {
            let normalized_opt = {
                let normalized_cache = self.tcx().normalized_cache.borrow();
                normalized_cache.get().find_copy(&t)
            };
            match normalized_opt {
                Some(u) => {
                    return u;
                }
                None => {
                    let t_norm = ty_fold::super_fold_ty(self, t);
                    let mut normalized_cache = self.tcx()
                                                   .normalized_cache
                                                   .borrow_mut();
                    normalized_cache.get().insert(t, t_norm);
                    return t_norm;
                }
            }
        }
        fn fold_vstore(&mut self, vstore: vstore) -> vstore {
            match vstore {
                vstore_fixed(..) | vstore_uniq | vstore_box => vstore,
                vstore_slice(_) => vstore_slice(ReStatic)
            }
        }
        fn fold_region(&mut self, _: ty::Region) -> ty::Region {
            ty::ReStatic
        }
        fn fold_substs(&mut self,
                       substs: &substs)
                       -> substs {
            substs { regions: ErasedRegions,
                     self_ty: ty_fold::fold_opt_ty(self, substs.self_ty),
                     tps: ty_fold::fold_ty_vec(self, substs.tps) }
        }
        fn fold_sig(&mut self,
                    sig: &ty::FnSig)
                    -> ty::FnSig {
            // The binder-id is only relevant to bound regions, which
            // are erased at trans time.
            ty::FnSig { binder_id: ast::DUMMY_NODE_ID,
                        inputs: ty_fold::fold_ty_vec(self, sig.inputs),
                        output: self.fold_ty(sig.output),
                        variadic: sig.variadic }
        }
    }
}
pub fn normalize_ty ( cx : ctxt , t : t ) -> t { let u = TypeNormalizer ( cx ) . fold_ty ( t ) ; return u ; struct TypeNormalizer ( ctxt ) ; impl TypeFolder for TypeNormalizer { fn tcx ( & self ) -> ty :: ctxt { let TypeNormalizer ( c ) = * self ; c } fn fold_ty ( & mut self , t : ty :: t ) -> ty :: t { let normalized_opt = { let normalized_cache = self . tcx ( ) . normalized_cache . borrow ( ) ; normalized_cache . get ( ) . find_copy ( & t ) } ; match normalized_opt { Some ( u ) => { return u ; } None => { let t_norm = ty_fold :: super_fold_ty ( self , t ) ; let mut normalized_cache = self . tcx ( ) . normalized_cache . borrow_mut ( ) ; normalized_cache . get ( ) . insert ( t , t_norm ) ; return t_norm ; } } } fn fold_vstore ( & mut self , vstore : vstore ) -> vstore { match vstore { vstore_fixed ( .. ) | vstore_uniq | vstore_box => vstore , vstore_slice ( _ ) => vstore_slice ( ReStatic ) } } fn fold_region ( & mut self , _ : ty :: Region ) -> ty :: Region { ty :: ReStatic } fn fold_substs ( & mut self , substs : & substs ) -> substs { substs { regions : ErasedRegions , self_ty : ty_fold :: fold_opt_ty ( self , substs . self_ty ) , tps : ty_fold :: fold_ty_vec ( self , substs . tps ) } } fn fold_sig ( & mut self , sig : & ty :: FnSig ) -> ty :: FnSig { // The binder-id is only relevant to bound regions, which // are erased at trans time. ty :: FnSig { binder_id : ast :: DUMMY_NODE_ID , inputs : ty_fold :: fold_ty_vec ( self , sig . inputs ) , output : self . fold_ty ( sig . output ) , variadic : sig . variadic } } } }
Returns an equivalent type with all the typedefs and self regions removed.
Returns an equivalent type with all the typedefs and self regions removed .
cx
ctxt
t
t
cx
ctxt
t
t