@@ -32,7 +32,6 @@ pub use self::ImplOrTraitItem::*;
3232pub use self :: BoundRegion :: * ;
3333pub use self :: sty:: * ;
3434pub use self :: IntVarValue :: * ;
35- pub use self :: vtable_origin:: * ;
3635pub use self :: MethodOrigin :: * ;
3736pub use self :: CopyImplementationError :: * ;
3837
@@ -402,12 +401,6 @@ pub enum CustomCoerceUnsized {
402401 Struct ( usize )
403402}
404403
405- #[ derive( Clone , Copy , RustcEncodable , RustcDecodable , PartialEq , PartialOrd , Debug ) ]
406- pub struct param_index {
407- pub space : subst:: ParamSpace ,
408- pub index : usize
409- }
410-
411404#[ derive( Clone , Debug ) ]
412405pub enum MethodOrigin < ' tcx > {
413406 // fully statically resolved method
@@ -510,46 +503,6 @@ impl MethodCall {
510503// of the method to be invoked
511504pub type MethodMap < ' tcx > = RefCell < FnvHashMap < MethodCall , MethodCallee < ' tcx > > > ;
512505
513- pub type vtable_param_res < ' tcx > = Vec < vtable_origin < ' tcx > > ;
514-
515- // Resolutions for bounds of all parameters, left to right, for a given path.
516- pub type vtable_res < ' tcx > = VecPerParamSpace < vtable_param_res < ' tcx > > ;
517-
518- #[ derive( Clone ) ]
519- pub enum vtable_origin < ' tcx > {
520- /*
521- Statically known vtable. def_id gives the impl item
522- from whence comes the vtable, and tys are the type substs.
523- vtable_res is the vtable itself.
524- */
525- vtable_static( ast:: DefId , subst:: Substs < ' tcx > , vtable_res < ' tcx > ) ,
526-
527- /*
528- Dynamic vtable, comes from a parameter that has a bound on it:
529- fn foo<T:quux,baz,bar>(a: T) -- a's vtable would have a
530- vtable_param origin
531-
532- The first argument is the param index (identifying T in the example),
533- and the second is the bound number (identifying baz)
534- */
535- vtable_param( param_index , usize ) ,
536-
537- /*
538- Vtable automatically generated for a closure. The def ID is the
539- ID of the closure expression.
540- */
541- vtable_closure( ast:: DefId ) ,
542-
543- /*
544- Asked to determine the vtable for ty_err. This is the value used
545- for the vtables of `Self` in a virtual call like `foo.bar()`
546- where `foo` is of object type. The same value is also used when
547- type errors occur.
548- */
549- vtable_error,
550- }
551-
552-
553506// For every explicit cast into an object type, maps from the cast
554507// expr to the associated trait ref.
555508pub type ObjectCastMap < ' tcx > = RefCell < NodeMap < ty:: PolyTraitRef < ' tcx > > > ;
@@ -803,9 +756,6 @@ pub struct ctxt<'tcx> {
803756 /// Maps any item's def-id to its stability index.
804757 pub stability : RefCell < stability:: Index > ,
805758
806- /// Maps def IDs to true if and only if they're associated types.
807- pub associated_types : RefCell < DefIdMap < bool > > ,
808-
809759 /// Caches the results of trait selection. This cache is used
810760 /// for things that do not have to do with the parameters in scope.
811761 pub selection_cache : traits:: SelectionCache < ' tcx > ,
@@ -2816,7 +2766,6 @@ pub fn mk_ctxt<'tcx>(s: Session,
28162766 node_lint_levels : RefCell :: new ( FnvHashMap ( ) ) ,
28172767 transmute_restrictions : RefCell :: new ( Vec :: new ( ) ) ,
28182768 stability : RefCell :: new ( stability) ,
2819- associated_types : RefCell :: new ( DefIdMap ( ) ) ,
28202769 selection_cache : traits:: SelectionCache :: new ( ) ,
28212770 repr_hint_cache : RefCell :: new ( DefIdMap ( ) ) ,
28222771 type_impls_copy_cache : RefCell :: new ( HashMap :: new ( ) ) ,
@@ -4305,17 +4254,9 @@ pub fn is_type_representable<'tcx>(cx: &ctxt<'tcx>, sp: Span, ty: Ty<'tcx>)
43054254}
43064255
43074256pub fn type_is_trait ( ty : Ty ) -> bool {
4308- type_trait_info ( ty) . is_some ( )
4309- }
4310-
4311- pub fn type_trait_info < ' tcx > ( ty : Ty < ' tcx > ) -> Option < & ' tcx TyTrait < ' tcx > > {
43124257 match ty. sty {
4313- ty_uniq( ty) | ty_rptr( _, mt { ty, ..} ) | ty_ptr( mt { ty, ..} ) => match ty. sty {
4314- ty_trait( ref t) => Some ( & * * t) ,
4315- _ => None
4316- } ,
4317- ty_trait( ref t) => Some ( & * * t) ,
4318- _ => None
4258+ ty_trait( ..) => true ,
4259+ _ => false
43194260 }
43204261}
43214262
@@ -5399,26 +5340,6 @@ pub fn impl_or_trait_item<'tcx>(cx: &ctxt<'tcx>, id: ast::DefId)
53995340 } )
54005341}
54015342
5402- /// Returns true if the given ID refers to an associated type and false if it
5403- /// refers to anything else.
5404- pub fn is_associated_type ( cx : & ctxt , id : ast:: DefId ) -> bool {
5405- memoized ( & cx. associated_types , id, |id : ast:: DefId | {
5406- if id. krate == ast:: LOCAL_CRATE {
5407- match cx. impl_or_trait_items . borrow ( ) . get ( & id) {
5408- Some ( ref item) => {
5409- match * * item {
5410- TypeTraitItem ( _) => true ,
5411- _ => false ,
5412- }
5413- }
5414- None => false ,
5415- }
5416- } else {
5417- csearch:: is_associated_type ( & cx. sess . cstore , id)
5418- }
5419- } )
5420- }
5421-
54225343/// Returns the parameter index that the given associated type corresponds to.
54235344pub fn associated_type_parameter_index ( cx : & ctxt ,
54245345 trait_def : & TraitDef ,
@@ -7223,32 +7144,6 @@ impl<'tcx> Repr<'tcx> for ty::Predicate<'tcx> {
72237144 }
72247145}
72257146
7226- impl < ' tcx > Repr < ' tcx > for vtable_origin < ' tcx > {
7227- fn repr ( & self , tcx : & ty:: ctxt < ' tcx > ) -> String {
7228- match * self {
7229- vtable_static( def_id, ref tys, ref vtable_res) => {
7230- format ! ( "vtable_static({:?}:{}, {}, {})" ,
7231- def_id,
7232- ty:: item_path_str( tcx, def_id) ,
7233- tys. repr( tcx) ,
7234- vtable_res. repr( tcx) )
7235- }
7236-
7237- vtable_param( x, y) => {
7238- format ! ( "vtable_param({:?}, {})" , x, y)
7239- }
7240-
7241- vtable_closure( def_id) => {
7242- format ! ( "vtable_closure({:?})" , def_id)
7243- }
7244-
7245- vtable_error => {
7246- format ! ( "vtable_error" )
7247- }
7248- }
7249- }
7250- }
7251-
72527147pub fn make_substs_for_receiver_types < ' tcx > ( tcx : & ty:: ctxt < ' tcx > ,
72537148 trait_ref : & ty:: TraitRef < ' tcx > ,
72547149 method : & ty:: Method < ' tcx > )
0 commit comments