fn record_impl(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>,
                   impl_def_id: DefId,
                   impl_trait_ref: TraitRef<'tcx>)
                   -> bool {
        debug!("TraitDef::record_impl for {:?}, from {:?}",
               self, impl_trait_ref);

        // Record the write into the impl set, but only for local
        // impls: external impls are handled differently.
        if impl_def_id.is_local() {
            self.write_trait_impls(tcx);
        }

        // We don't want to borrow_mut after we already populated all impls,
        // so check if an impl is present with an immutable borrow first.
        if let Some(sty) = fast_reject::simplify_type(tcx,
                                                      impl_trait_ref.self_ty(), false) {
            if let Some(is) = self.nonblanket_impls.borrow().get(&sty) {
                if is.contains(&impl_def_id) {
                    return false; // duplicate - skip
                }
            }

            self.nonblanket_impls.borrow_mut().entry(sty).or_insert(vec![]).push(impl_def_id)
        } else {
            if self.blanket_impls.borrow().contains(&impl_def_id) {
                return false; // duplicate - skip
            }
            self.blanket_impls.borrow_mut().push(impl_def_id)
        }

        true
    }
/// Records a basic trait-to-implementation mapping.
///
/// Returns `true` iff the impl has not previously been recorded.
Records a basic trait-to-implementation mapping.
Returns `true` iff the impl has not previously been recorded.
Records a basic trait - to - implementation mapping . Returns ` true ` iff the impl has not previously been recorded .
fn record_impl(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>,
                   impl_def_id: DefId,
                   impl_trait_ref: TraitRef<'tcx>)
                   -> bool {
        debug!("TraitDef::record_impl for {:?}, from {:?}",
               self, impl_trait_ref);
        // Record the write into the impl set, but only for local
        // impls: external impls are handled differently.
        if impl_def_id.is_local() {
            self.write_trait_impls(tcx);
        }
        // We don't want to borrow_mut after we already populated all impls,
        // so check if an impl is present with an immutable borrow first.
        if let Some(sty) = fast_reject::simplify_type(tcx,
                                                      impl_trait_ref.self_ty(), false) {
            if let Some(is) = self.nonblanket_impls.borrow().get(&sty) {
                if is.contains(&impl_def_id) {
                    return false; // duplicate - skip
                }
            }
            self.nonblanket_impls.borrow_mut().entry(sty).or_insert(vec![]).push(impl_def_id)
        } else {
            if self.blanket_impls.borrow().contains(&impl_def_id) {
                return false; // duplicate - skip
            }
            self.blanket_impls.borrow_mut().push(impl_def_id)
        }
        true
    }
fn record_impl ( & self , tcx : TyCtxt < ' a , ' gcx , ' tcx > , impl_def_id : DefId , impl_trait_ref : TraitRef < ' tcx > ) -> bool { debug ! ( " " self impl_trait_ref ) ; // Record the write into the impl set, but only for local // impls: external impls are handled differently. if impl_def_id . is_local ( ) { self . write_trait_impls ( tcx ) ; } // We don't want to borrow_mut after we already populated all impls, // so check if an impl is present with an immutable borrow first. if let Some ( sty ) = fast_reject :: simplify_type ( tcx , impl_trait_ref . self_ty ( ) , false ) { if let Some ( is ) = self . nonblanket_impls . borrow ( ) . get ( & sty ) { if is . contains ( & impl_def_id ) { return false ; // duplicate - skip } } self . nonblanket_impls . borrow_mut ( ) . entry ( sty ) . or_insert ( vec ! [ ] ) . push ( impl_def_id ) } else { if self . blanket_impls . borrow ( ) . contains ( & impl_def_id ) { return false ; // duplicate - skip } self . blanket_impls . borrow_mut ( ) . push ( impl_def_id ) } true }
Records a basic trait-to-implementation mapping.
Records a basic trait - to - implementation mapping .
&self
tcx
TyCtxt<'a, 'gcx, 'tcx>
impl_def_id
DefId
impl_trait_ref
TraitRef<'tcx>
&self
tcx
TyCtxt<'a, 'gcx, 'tcx>
impl_def_id
DefId
impl_trait_ref
TraitRef<'tcx>