fn ensure_borrow_source(
        &mut self,
        successor_point: Point,
        borrow_region_name: RegionName,
        source_path: &repr::Path,
    ) {
        log!(
            "ensure_borrow_source({:?}, {:?}, {:?})",
            successor_point,
            borrow_region_name,
            source_path
        );

        for supporting_path in self.env.supporting_prefixes(source_path) {
            match *supporting_path {
                repr::Path::Var(_) => {
                    // No lifetime constraints are needed to ensure the
                    // validity of a variable. That is ensured by borrowck
                    // preventing the storage of variables from being killed
                    // while data owned by that variable is in scope.
                    return;
                }
                repr::Path::Extension(ref base_path, field_name) => {
                    let ty = self.env.path_ty(base_path);
                    log!("ensure_borrow_source: ty={:?}", ty);
                    match *ty {
                        repr::Ty::Ref(ref_region, _, _) => {
                            assert_eq!(field_name, repr::FieldName::star());
                            let ref_region_name = ref_region.assert_free();
                            let borrow_region_variable = self.region_variable(borrow_region_name);
                            let ref_region_variable = self.region_variable(ref_region_name);
                            self.infer.add_outlives(
                                ref_region_variable,
                                borrow_region_variable,
                                successor_point,
                            );
                        }
                        repr::Ty::Unit => {}
                        repr::Ty::Struct(..) => {}
                        repr::Ty::Bound(..) => {}
                    }
                }
            }
        }
    }
/// Add any relations between regions that are needed to ensures
/// that reborrows live long enough. Specifically, if we borrow
/// something like `*r` for `'a`, where `r: &'b i32`, then `'b:
/// 'a` is required.
Add any relations between regions that are needed to ensures
that reborrows live long enough.
Add any relations between regions that are needed to ensures that reborrows live long enough .
fn ensure_borrow_source(
        &mut self,
        successor_point: Point,
        borrow_region_name: RegionName,
        source_path: &repr::Path,
    ) {
        log!(
            "ensure_borrow_source({:?}, {:?}, {:?})",
            successor_point,
            borrow_region_name,
            source_path
        );
        for supporting_path in self.env.supporting_prefixes(source_path) {
            match *supporting_path {
                repr::Path::Var(_) => {
                    // No lifetime constraints are needed to ensure the
                    // validity of a variable. That is ensured by borrowck
                    // preventing the storage of variables from being killed
                    // while data owned by that variable is in scope.
                    return;
                }
                repr::Path::Extension(ref base_path, field_name) => {
                    let ty = self.env.path_ty(base_path);
                    log!("ensure_borrow_source: ty={:?}", ty);
                    match *ty {
                        repr::Ty::Ref(ref_region, _, _) => {
                            assert_eq!(field_name, repr::FieldName::star());
                            let ref_region_name = ref_region.assert_free();
                            let borrow_region_variable = self.region_variable(borrow_region_name);
                            let ref_region_variable = self.region_variable(ref_region_name);
                            self.infer.add_outlives(
                                ref_region_variable,
                                borrow_region_variable,
                                successor_point,
                            );
                        }
                        repr::Ty::Unit => {}
                        repr::Ty::Struct(..) => {}
                        repr::Ty::Bound(..) => {}
                    }
                }
            }
        }
    }
fn ensure_borrow_source ( & mut self , successor_point : Point , borrow_region_name : RegionName , source_path : & repr :: Path , ) { log ! ( " " successor_point borrow_region_name source_path ) ; for supporting_path in self . env . supporting_prefixes ( source_path ) { match * supporting_path { repr :: Path :: Var ( _ ) => { // No lifetime constraints are needed to ensure the // validity of a variable. That is ensured by borrowck // preventing the storage of variables from being killed // while data owned by that variable is in scope. return ; } repr :: Path :: Extension ( ref base_path , field_name ) => { let ty = self . env . path_ty ( base_path ) ; log ! ( " " ty ) ; match * ty { repr :: Ty :: Ref ( ref_region , _ , _ ) => { assert_eq ! ( field_name repr FieldName star ( ) ) ; let ref_region_name = ref_region . assert_free ( ) ; let borrow_region_variable = self . region_variable ( borrow_region_name ) ; let ref_region_variable = self . region_variable ( ref_region_name ) ; self . infer . add_outlives ( ref_region_variable , borrow_region_variable , successor_point , ) ; } repr :: Ty :: Unit => { } repr :: Ty :: Struct ( .. ) => { } repr :: Ty :: Bound ( .. ) => { } } } } } }
Add any relations between regions that are needed to ensures
that reborrows live long enough.
Add any relations between regions that are needed to ensures that reborrows live long enough .
&mut self
successor_point
Point
borrow_region_name
RegionName
source_path
&repr::Path
&mut self
successor_point
Point
borrow_region_name
RegionName
source_path
&repr::Path