fn check_access_to(
        &self,
        span: Span,
        from: &CompileMod,
        item: &Item,
        module: &CompileMod,
        location: Location,
        visibility: Visibility,
        chain: &mut Vec<ImportEntryStep>,
    ) -> Result<(), QueryError> {
        let (common, tree) = from.item.ancestry(&module.item);
        let mut current_module = common.clone();

        // Check each module from the common ancestrly to the module.
        for c in &tree {
            current_module.push(c);

            let m = self.modules.get(&current_module).ok_or_else(|| {
                QueryError::new(
                    span,
                    QueryErrorKind::MissingMod {
                        item: current_module.clone(),
                    },
                )
            })?;

            if !m.visibility.is_visible(&common, &current_module) {
                return Err(QueryError::new(
                    span,
                    QueryErrorKind::NotVisibleMod {
                        chain: into_chain(std::mem::take(chain)),
                        location: m.location,
                        visibility: m.visibility,
                        item: current_module,
                        from: from.item.clone(),
                    },
                ));
            }
        }

        if !visibility.is_visible_inside(&common, &module.item) {
            return Err(QueryError::new(
                span,
                QueryErrorKind::NotVisible {
                    chain: into_chain(std::mem::take(chain)),
                    location,
                    visibility,
                    item: item.clone(),
                    from: from.item.clone(),
                },
            ));
        }

        Ok(())
    }
/// Check that the given item is accessible from the given module.
Check that the given item is accessible from the given module.
Check that the given item is accessible from the given module .
fn check_access_to(
        &self,
        span: Span,
        from: &CompileMod,
        item: &Item,
        module: &CompileMod,
        location: Location,
        visibility: Visibility,
        chain: &mut Vec<ImportEntryStep>,
    ) -> Result<(), QueryError> {
        let (common, tree) = from.item.ancestry(&module.item);
        let mut current_module = common.clone();
        // Check each module from the common ancestrly to the module.
        for c in &tree {
            current_module.push(c);
            let m = self.modules.get(&current_module).ok_or_else(|| {
                QueryError::new(
                    span,
                    QueryErrorKind::MissingMod {
                        item: current_module.clone(),
                    },
                )
            })?;
            if !m.visibility.is_visible(&common, &current_module) {
                return Err(QueryError::new(
                    span,
                    QueryErrorKind::NotVisibleMod {
                        chain: into_chain(std::mem::take(chain)),
                        location: m.location,
                        visibility: m.visibility,
                        item: current_module,
                        from: from.item.clone(),
                    },
                ));
            }
        }
        if !visibility.is_visible_inside(&common, &module.item) {
            return Err(QueryError::new(
                span,
                QueryErrorKind::NotVisible {
                    chain: into_chain(std::mem::take(chain)),
                    location,
                    visibility,
                    item: item.clone(),
                    from: from.item.clone(),
                },
            ));
        }
        Ok(())
    }
fn check_access_to ( & self , span : Span , from : & CompileMod , item : & Item , module : & CompileMod , location : Location , visibility : Visibility , chain : & mut Vec < ImportEntryStep > , ) -> Result < ( ) , QueryError > { let ( common , tree ) = from . item . ancestry ( & module . item ) ; let mut current_module = common . clone ( ) ; // Check each module from the common ancestrly to the module. for c in & tree { current_module . push ( c ) ; let m = self . modules . get ( & current_module ) . ok_or_else ( | | { QueryError :: new ( span , QueryErrorKind :: MissingMod { item : current_module . clone ( ) , } , ) } ) ? ; if ! m . visibility . is_visible ( & common , & current_module ) { return Err ( QueryError :: new ( span , QueryErrorKind :: NotVisibleMod { chain : into_chain ( std :: mem :: take ( chain ) ) , location : m . location , visibility : m . visibility , item : current_module , from : from . item . clone ( ) , } , ) ) ; } } if ! visibility . is_visible_inside ( & common , & module . item ) { return Err ( QueryError :: new ( span , QueryErrorKind :: NotVisible { chain : into_chain ( std :: mem :: take ( chain ) ) , location , visibility , item : item . clone ( ) , from : from . item . clone ( ) , } , ) ) ; } Ok ( ( ) ) }
Check that the given item is accessible from the given module.
Check that the given item is accessible from the given module .
&self
span
Span
from
&CompileMod
item
&Item
module
&CompileMod
location
Location
visibility
Visibility
chain
&mut Vec<ImportEntryStep>
&self
span
Span
from
&CompileMod
item
&Item
module
&CompileMod
location
Location
visibility
Visibility
chain
&mut Vec<ImportEntryStep>