fn fresh_receiver_substs(&mut self,
                             self_ty: Ty<'tcx>,
                             pick: &probe::Pick<'tcx>)
                             -> &'tcx Substs<'tcx> {
        match pick.kind {
            probe::InherentImplPick => {
                let impl_def_id = pick.item.container.id();
                assert!(self.tcx.impl_trait_ref(impl_def_id).is_none(),
                        "impl {:?} is not an inherent impl",
                        impl_def_id);
                self.impl_self_ty(self.span, impl_def_id).substs
            }

            probe::ObjectPick => {
                let trait_def_id = pick.item.container.id();
                self.extract_existential_trait_ref(self_ty, |this, object_ty, principal| {
                    // The object data has no entry for the Self
                    // Type. For the purposes of this method call, we
                    // substitute the object type itself. This
                    // wouldn't be a sound substitution in all cases,
                    // since each instance of the object type is a
                    // different existential and hence could match
                    // distinct types (e.g., if `Self` appeared as an
                    // argument type), but those cases have already
                    // been ruled out when we deemed the trait to be
                    // "object safe".
                    let original_poly_trait_ref = principal.with_self_ty(this.tcx, object_ty);
                    let upcast_poly_trait_ref = this.upcast(original_poly_trait_ref, trait_def_id);
                    let upcast_trait_ref =
                        this.replace_late_bound_regions_with_fresh_var(&upcast_poly_trait_ref);
                    debug!("original_poly_trait_ref={:?} upcast_trait_ref={:?} target_trait={:?}",
                           original_poly_trait_ref,
                           upcast_trait_ref,
                           trait_def_id);
                    upcast_trait_ref.substs
                })
            }

            probe::TraitPick => {
                let trait_def_id = pick.item.container.id();

                // Make a trait reference `$0 : Trait<$1...$n>`
                // consisting entirely of type variables. Later on in
                // the process we will unify the transformed-self-type
                // of the method with the actual type in order to
                // unify some of these variables.
                self.fresh_substs_for_item(self.span, trait_def_id)
            }

            probe::WhereClausePick(ref poly_trait_ref) => {
                // Where clauses can have bound regions in them. We need to instantiate
                // those to convert from a poly-trait-ref to a trait-ref.
                self.replace_late_bound_regions_with_fresh_var(&poly_trait_ref).substs
            }
        }
    }
/// Returns a set of substitutions for the method *receiver* where all type and region
/// parameters are instantiated with fresh variables. This substitution does not include any
/// parameters declared on the method itself.
///
/// Note that this substitution may include late-bound regions from the impl level. If so,
/// these are instantiated later in the `instantiate_method_sig` routine.
Returns a set of substitutions for the method *receiver* where all type and region
parameters are instantiated with fresh variables. This substitution does not include any
parameters declared on the method itself.

Note that this substitution may include late-bound regions from the impl level. If so,
these are instantiated later in the `instantiate_method_sig` routine.
Returns a set of substitutions for the method * receiver * where all type and region parameters are instantiated with fresh variables . This substitution does not include any parameters declared on the method itself . Note that this substitution may include late - bound regions from the impl level . If so these are instantiated later in the ` instantiate_method_sig ` routine .
fn fresh_receiver_substs(&mut self,
                             self_ty: Ty<'tcx>,
                             pick: &probe::Pick<'tcx>)
                             -> &'tcx Substs<'tcx> {
        match pick.kind {
            probe::InherentImplPick => {
                let impl_def_id = pick.item.container.id();
                assert!(self.tcx.impl_trait_ref(impl_def_id).is_none(),
                        "impl {:?} is not an inherent impl",
                        impl_def_id);
                self.impl_self_ty(self.span, impl_def_id).substs
            }
            probe::ObjectPick => {
                let trait_def_id = pick.item.container.id();
                self.extract_existential_trait_ref(self_ty, |this, object_ty, principal| {
                    // The object data has no entry for the Self
                    // Type. For the purposes of this method call, we
                    // substitute the object type itself. This
                    // wouldn't be a sound substitution in all cases,
                    // since each instance of the object type is a
                    // different existential and hence could match
                    // distinct types (e.g., if `Self` appeared as an
                    // argument type), but those cases have already
                    // been ruled out when we deemed the trait to be
                    // "object safe".
                    let original_poly_trait_ref = principal.with_self_ty(this.tcx, object_ty);
                    let upcast_poly_trait_ref = this.upcast(original_poly_trait_ref, trait_def_id);
                    let upcast_trait_ref =
                        this.replace_late_bound_regions_with_fresh_var(&upcast_poly_trait_ref);
                    debug!("original_poly_trait_ref={:?} upcast_trait_ref={:?} target_trait={:?}",
                           original_poly_trait_ref,
                           upcast_trait_ref,
                           trait_def_id);
                    upcast_trait_ref.substs
                })
            }
            probe::TraitPick => {
                let trait_def_id = pick.item.container.id();
                // Make a trait reference `$0 : Trait<$1...$n>`
                // consisting entirely of type variables. Later on in
                // the process we will unify the transformed-self-type
                // of the method with the actual type in order to
                // unify some of these variables.
                self.fresh_substs_for_item(self.span, trait_def_id)
            }
            probe::WhereClausePick(ref poly_trait_ref) => {
                // Where clauses can have bound regions in them. We need to instantiate
                // those to convert from a poly-trait-ref to a trait-ref.
                self.replace_late_bound_regions_with_fresh_var(&poly_trait_ref).substs
            }
        }
    }
fn fresh_receiver_substs ( & mut self , self_ty : Ty < ' tcx > , pick : & probe :: Pick < ' tcx > ) -> & ' tcx Substs < ' tcx > { match pick . kind { probe :: InherentImplPick => { let impl_def_id = pick . item . container . id ( ) ; assert ! ( self tcx impl_trait_ref ( impl_def_id ) is_none ( ) " " impl_def_id ) ; self . impl_self_ty ( self . span , impl_def_id ) . substs } probe :: ObjectPick => { let trait_def_id = pick . item . container . id ( ) ; self . extract_existential_trait_ref ( self_ty , | this , object_ty , principal | { // The object data has no entry for the Self // Type. For the purposes of this method call, we // substitute the object type itself. This // wouldn't be a sound substitution in all cases, // since each instance of the object type is a // different existential and hence could match // distinct types (e.g., if `Self` appeared as an // argument type), but those cases have already // been ruled out when we deemed the trait to be // "object safe". let original_poly_trait_ref = principal . with_self_ty ( this . tcx , object_ty ) ; let upcast_poly_trait_ref = this . upcast ( original_poly_trait_ref , trait_def_id ) ; let upcast_trait_ref = this . replace_late_bound_regions_with_fresh_var ( & upcast_poly_trait_ref ) ; debug ! ( " " original_poly_trait_ref upcast_trait_ref trait_def_id ) ; upcast_trait_ref . substs } ) } probe :: TraitPick => { let trait_def_id = pick . item . container . id ( ) ; // Make a trait reference `$0 : Trait<$1...$n>` // consisting entirely of type variables. Later on in // the process we will unify the transformed-self-type // of the method with the actual type in order to // unify some of these variables. self . fresh_substs_for_item ( self . span , trait_def_id ) } probe :: WhereClausePick ( ref poly_trait_ref ) => { // Where clauses can have bound regions in them. We need to instantiate // those to convert from a poly-trait-ref to a trait-ref. self . replace_late_bound_regions_with_fresh_var ( & poly_trait_ref ) . substs } } }
Returns a set of substitutions for the method *receiver* where all type and region
parameters are instantiated with fresh variables.
Returns a set of substitutions for the method * receiver * where all type and region parameters are instantiated with fresh variables .
&mut self
self_ty
Ty<'tcx>
pick
&probe::Pick<'tcx>
&mut self
self_ty
Ty<'tcx>
pick
&probe::Pick<'tcx>