fn assemble_unboxed_closure_candidates(&mut self,
                                           obligation: &Obligation<'tcx>,
                                           candidates: &mut CandidateSet<'tcx>)
                                           -> Result<(),SelectionError<'tcx>>
    {
        let kind = match self.fn_family_trait_kind(obligation.trait_ref.def_id) {
            Some(k) => k,
            None => { return Ok(()); }
        };

        let self_ty = self.infcx.shallow_resolve(obligation.self_ty());
        let (closure_def_id, substs) = match self_ty.sty {
            ty::ty_unboxed_closure(id, _, ref substs) => (id, substs.clone()),
            ty::ty_infer(ty::TyVar(_)) => {
                candidates.ambiguous = true;
                return Ok(());
            }
            _ => { return Ok(()); }
        };

        debug!("assemble_unboxed_candidates: self_ty={} obligation={}",
               self_ty.repr(self.tcx()),
               obligation.repr(self.tcx()));

        let closure_kind = match self.typer.unboxed_closures().borrow().get(&closure_def_id) {
            Some(closure) => closure.kind,
            None => {
                self.tcx().sess.span_bug(
                    obligation.cause.span,
                    format!("No entry for unboxed closure: {}",
                            closure_def_id.repr(self.tcx())).as_slice());
            }
        };

        if closure_kind == kind {
            candidates.vec.push(UnboxedClosureCandidate(closure_def_id, substs.clone()));
        }

        Ok(())
    }
/// Check for the artificial impl that the compiler will create for an obligation like `X :
/// FnMut<..>` where `X` is an unboxed closure type.
///
/// Note: the type parameters on an unboxed closure candidate are modeled as *output* type
/// parameters and hence do not affect whether this trait is a match or not. They will be
/// unified during the confirmation step.
Check for the artificial impl that the compiler will create for an obligation like `X :
FnMut<..>` where `X` is an unboxed closure type.

the type parameters on an unboxed closure candidate are modeled as *output* type
parameters and hence do not affect whether this trait is a match or not. They will be
unified during the confirmation step.
Check for the artificial impl that the compiler will create for an obligation like ` X : FnMut< .. > ` where ` X ` is an unboxed closure type . the type parameters on an unboxed closure candidate are modeled as * output * type parameters and hence do not affect whether this trait is a match or not . They will be unified during the confirmation step .
fn assemble_unboxed_closure_candidates(&mut self,
                                           obligation: &Obligation<'tcx>,
                                           candidates: &mut CandidateSet<'tcx>)
                                           -> Result<(),SelectionError<'tcx>>
    {
        let kind = match self.fn_family_trait_kind(obligation.trait_ref.def_id) {
            Some(k) => k,
            None => { return Ok(()); }
        };
        let self_ty = self.infcx.shallow_resolve(obligation.self_ty());
        let (closure_def_id, substs) = match self_ty.sty {
            ty::ty_unboxed_closure(id, _, ref substs) => (id, substs.clone()),
            ty::ty_infer(ty::TyVar(_)) => {
                candidates.ambiguous = true;
                return Ok(());
            }
            _ => { return Ok(()); }
        };
        debug!("assemble_unboxed_candidates: self_ty={} obligation={}",
               self_ty.repr(self.tcx()),
               obligation.repr(self.tcx()));
        let closure_kind = match self.typer.unboxed_closures().borrow().get(&closure_def_id) {
            Some(closure) => closure.kind,
            None => {
                self.tcx().sess.span_bug(
                    obligation.cause.span,
                    format!("No entry for unboxed closure: {}",
                            closure_def_id.repr(self.tcx())).as_slice());
            }
        };
        if closure_kind == kind {
            candidates.vec.push(UnboxedClosureCandidate(closure_def_id, substs.clone()));
        }
        Ok(())
    }
fn assemble_unboxed_closure_candidates ( & mut self , obligation : & Obligation < ' tcx > , candidates : & mut CandidateSet < ' tcx > ) -> Result < ( ) , SelectionError < ' tcx > > { let kind = match self . fn_family_trait_kind ( obligation . trait_ref . def_id ) { Some ( k ) => k , None => { return Ok ( ( ) ) ; } } ; let self_ty = self . infcx . shallow_resolve ( obligation . self_ty ( ) ) ; let ( closure_def_id , substs ) = match self_ty . sty { ty :: ty_unboxed_closure ( id , _ , ref substs ) => ( id , substs . clone ( ) ) , ty :: ty_infer ( ty :: TyVar ( _ ) ) => { candidates . ambiguous = true ; return Ok ( ( ) ) ; } _ => { return Ok ( ( ) ) ; } } ; debug ! ( " " self_ty repr ( self tcx ( ) ) obligation repr ( self tcx ( ) ) ) ; let closure_kind = match self . typer . unboxed_closures ( ) . borrow ( ) . get ( & closure_def_id ) { Some ( closure ) => closure . kind , None => { self . tcx ( ) . sess . span_bug ( obligation . cause . span , format ! ( " " closure_def_id repr ( self tcx ( ) ) ) . as_slice ( ) ) ; } } ; if closure_kind == kind { candidates . vec . push ( UnboxedClosureCandidate ( closure_def_id , substs . clone ( ) ) ) ; } Ok ( ( ) ) }
Check for the artificial impl that the compiler will create for an obligation like `X :
FnMut<..>` where `X` is an unboxed closure type.
Check for the artificial impl that the compiler will create for an obligation like ` X : FnMut< .. > ` where ` X ` is an unboxed closure type .
&mut self
obligation
&Obligation<'tcx>
candidates
&mut CandidateSet<'tcx>