pub fn leak_check(&self,
                      overly_polymorphic: bool,
                      _span: Span,
                      skol_map: &SkolemizationMap<'tcx>,
                      snapshot: &CombinedSnapshot<'a, 'tcx>)
                      -> RelateResult<'tcx, ()>
    {
        debug!("leak_check: skol_map={:?}",
               skol_map);

        // If the user gave `-Zno-leak-check`, then skip the leak
        // check completely. This is wildly unsound and also not
        // unlikely to cause an ICE or two. It is intended for use
        // only during a transition period, in which the MIR typeck
        // uses the "universe-style" check, and the rest of typeck
        // uses the more conservative leak check.  Since the leak
        // check is more conservative, we can't test the
        // universe-style check without disabling it.
        if self.tcx.sess.opts.debugging_opts.no_leak_check {
            return Ok(());
        }

        let new_vars = self.region_vars_confined_to_snapshot(snapshot);
        for (&skol_br, &skol) in skol_map {
            // The inputs to a skolemized variable can only
            // be itself or other new variables.
            let incoming_taints = self.tainted_regions(snapshot,
                                                       skol,
                                                       TaintDirections::both());
            for &tainted_region in &incoming_taints {
                // Each skolemized should only be relatable to itself
                // or new variables:
                match *tainted_region {
                    ty::ReVar(vid) => {
                        if new_vars.contains(&vid) {
                            continue;
                        }
                    }
                    _ => {
                        if tainted_region == skol { continue; }
                    }
                };

                debug!("{:?} (which replaced {:?}) is tainted by {:?}",
                       skol,
                       skol_br,
                       tainted_region);

                return Err(if overly_polymorphic {
                    debug!("Overly polymorphic!");
                    TypeError::RegionsOverlyPolymorphic(skol_br, tainted_region)
                } else {
                    debug!("Not as polymorphic!");
                    TypeError::RegionsInsufficientlyPolymorphic(skol_br, tainted_region)
                })
            }
        }

        Ok(())
    }
/// Searches the region constraints created since `snapshot` was started
/// and checks to determine whether any of the skolemized regions created
/// in `skol_map` would "escape" -- meaning that they are related to
/// other regions in some way. If so, the higher-ranked subtyping doesn't
/// hold. See `README.md` for more details.
Searches the region constraints created since `snapshot` was started
and checks to determine whether any of the skolemized regions created
in `skol_map` would "escape" -- meaning that they are related to
other regions in some way. If so, the higher-ranked subtyping doesn't
hold. See `README.md` for more details.
Searches the region constraints created since ` snapshot ` was started and checks to determine whether any of the skolemized regions created in ` skol_map ` would " escape " -- meaning that they are related to other regions in some way . If so the higher - ranked subtyping doesn ' t hold . See ` README . md ` for more details .
pub fn leak_check(&self,
                      overly_polymorphic: bool,
                      _span: Span,
                      skol_map: &SkolemizationMap<'tcx>,
                      snapshot: &CombinedSnapshot<'a, 'tcx>)
                      -> RelateResult<'tcx, ()>
    {
        debug!("leak_check: skol_map={:?}",
               skol_map);
        // If the user gave `-Zno-leak-check`, then skip the leak
        // check completely. This is wildly unsound and also not
        // unlikely to cause an ICE or two. It is intended for use
        // only during a transition period, in which the MIR typeck
        // uses the "universe-style" check, and the rest of typeck
        // uses the more conservative leak check.  Since the leak
        // check is more conservative, we can't test the
        // universe-style check without disabling it.
        if self.tcx.sess.opts.debugging_opts.no_leak_check {
            return Ok(());
        }
        let new_vars = self.region_vars_confined_to_snapshot(snapshot);
        for (&skol_br, &skol) in skol_map {
            // The inputs to a skolemized variable can only
            // be itself or other new variables.
            let incoming_taints = self.tainted_regions(snapshot,
                                                       skol,
                                                       TaintDirections::both());
            for &tainted_region in &incoming_taints {
                // Each skolemized should only be relatable to itself
                // or new variables:
                match *tainted_region {
                    ty::ReVar(vid) => {
                        if new_vars.contains(&vid) {
                            continue;
                        }
                    }
                    _ => {
                        if tainted_region == skol { continue; }
                    }
                };
                debug!("{:?} (which replaced {:?}) is tainted by {:?}",
                       skol,
                       skol_br,
                       tainted_region);
                return Err(if overly_polymorphic {
                    debug!("Overly polymorphic!");
                    TypeError::RegionsOverlyPolymorphic(skol_br, tainted_region)
                } else {
                    debug!("Not as polymorphic!");
                    TypeError::RegionsInsufficientlyPolymorphic(skol_br, tainted_region)
                })
            }
        }
        Ok(())
    }
pub fn leak_check ( & self , overly_polymorphic : bool , _span : Span , skol_map : & SkolemizationMap < ' tcx > , snapshot : & CombinedSnapshot < ' a , ' tcx > ) -> RelateResult < ' tcx , ( ) > { debug ! ( " " skol_map ) ; // If the user gave `-Zno-leak-check`, then skip the leak // check completely. This is wildly unsound and also not // unlikely to cause an ICE or two. It is intended for use // only during a transition period, in which the MIR typeck // uses the "universe-style" check, and the rest of typeck // uses the more conservative leak check.  Since the leak // check is more conservative, we can't test the // universe-style check without disabling it. if self . tcx . sess . opts . debugging_opts . no_leak_check { return Ok ( ( ) ) ; } let new_vars = self . region_vars_confined_to_snapshot ( snapshot ) ; for ( & skol_br , & skol ) in skol_map { // The inputs to a skolemized variable can only // be itself or other new variables. let incoming_taints = self . tainted_regions ( snapshot , skol , TaintDirections :: both ( ) ) ; for & tainted_region in & incoming_taints { // Each skolemized should only be relatable to itself // or new variables: match * tainted_region { ty :: ReVar ( vid ) => { if new_vars . contains ( & vid ) { continue ; } } _ => { if tainted_region == skol { continue ; } } } ; debug ! ( " " skol skol_br tainted_region ) ; return Err ( if overly_polymorphic { debug ! ( " " ) ; TypeError :: RegionsOverlyPolymorphic ( skol_br , tainted_region ) } else { debug ! ( " " ) ; TypeError :: RegionsInsufficientlyPolymorphic ( skol_br , tainted_region ) } ) } } Ok ( ( ) ) }
Searches the region constraints created since `snapshot` was started
and checks to determine whether any of the skolemized regions created
in `skol_map` would "escape" -- meaning that they are related to
other regions in some way.
Searches the region constraints created since ` snapshot ` was started and checks to determine whether any of the skolemized regions created in ` skol_map ` would " escape " -- meaning that they are related to other regions in some way .
&self
overly_polymorphic
bool
_span
Span
skol_map
&SkolemizationMap<'tcx>
snapshot
&CombinedSnapshot<'a, 'tcx>
&self
overly_polymorphic
bool
_span
Span
skol_map
&SkolemizationMap<'tcx>
snapshot
&CombinedSnapshot<'a, 'tcx>