fn maybe_inline_local(&mut self, id: ast::NodeId, renamed: Option<ast::Name>,
                  glob: bool, om: &mut Module, please_inline: bool) -> bool {

        fn inherits_doc_hidden(cx: &core::DocContext, mut node: ast::NodeId) -> bool {
            while let Some(id) = cx.map.get_enclosing_scope(node) {
                node = id;
                let attrs = cx.map.attrs(node).clean(cx);
                if attrs.list("doc").has_word("hidden") {
                    return true;
                }
                if node == ast::CRATE_NODE_ID {
                    break;
                }
            }
            false
        }

        let tcx = match self.cx.tcx_opt() {
            Some(tcx) => tcx,
            None => return false
        };
        let def = tcx.expect_def(id);
        let def_did = def.def_id();

        let use_attrs = tcx.map.attrs(id).clean(self.cx);
        // Don't inline doc(hidden) imports so they can be stripped at a later stage.
        let is_no_inline = use_attrs.list("doc").has_word("no_inline") ||
                           use_attrs.list("doc").has_word("hidden");

        // For cross-crate impl inlining we need to know whether items are
        // reachable in documentation - a previously nonreachable item can be
        // made reachable by cross-crate inlining which we're checking here.
        // (this is done here because we need to know this upfront)
        if !def_did.is_local() && !is_no_inline {
            let attrs = clean::inline::load_attrs(self.cx, tcx, def_did);
            let self_is_hidden = attrs.list("doc").has_word("hidden");
            match def {
                Def::Trait(did) |
                Def::Struct(did) |
                Def::Enum(did) |
                Def::TyAlias(did) if !self_is_hidden => {
                    self.cx.access_levels.borrow_mut().map.insert(did, AccessLevel::Public);
                },
                Def::Mod(did) => if !self_is_hidden {
                    ::visit_lib::LibEmbargoVisitor::new(self.cx).visit_mod(did);
                },
                _ => {},
            }
            return false
        }

        let def_node_id = match tcx.map.as_local_node_id(def_did) {
            Some(n) => n, None => return false
        };

        let is_private = !self.cx.access_levels.borrow().is_public(def_did);
        let is_hidden = inherits_doc_hidden(self.cx, def_node_id);

        // Only inline if requested or if the item would otherwise be stripped
        if (!please_inline && !is_private && !is_hidden) || is_no_inline {
            return false
        }

        if !self.view_item_stack.insert(def_node_id) { return false }

        let ret = match tcx.map.get(def_node_id) {
            hir_map::NodeItem(it) => {
                if glob {
                    let prev = mem::replace(&mut self.inlining_from_glob, true);
                    match it.node {
                        hir::ItemMod(ref m) => {
                            for i in &m.item_ids {
                                let i = self.cx.map.expect_item(i.id);
                                self.visit_item(i, None, om);
                            }
                        }
                        hir::ItemEnum(..) => {}
                        _ => { panic!("glob not mapped to a module or enum"); }
                    }
                    self.inlining_from_glob = prev;
                } else {
                    self.visit_item(it, renamed, om);
                }
                true
            }
            _ => false,
        };
        self.view_item_stack.remove(&def_node_id);
        return ret;
    }
/// Tries to resolve the target of a `pub use` statement and inlines the
/// target if it is defined locally and would not be documented otherwise,
/// or when it is specifically requested with `please_inline`.
/// (the latter is the case when the import is marked `doc(inline)`)
///
/// Cross-crate inlining occurs later on during crate cleaning
/// and follows different rules.
///
/// Returns true if the target has been inlined.
Tries to resolve the target of a `pub use` statement and inlines the
target if it is defined locally and would not be documented otherwise,
or when it is specifically requested with `please_inline`.
(the latter is the case when the import is marked `doc(inline)`)

Cross-crate inlining occurs later on during crate cleaning
and follows different rules.

Returns true if the target has been inlined.
Tries to resolve the target of a ` pub use ` statement and inlines the target if it is defined locally and would not be documented otherwise or when it is specifically requested with ` please_inline ` . ( the latter is the case when the import is marked ` doc ( inline ) ` ) Cross - crate inlining occurs later on during crate cleaning and follows different rules . Returns true if the target has been inlined .
fn maybe_inline_local(&mut self, id: ast::NodeId, renamed: Option<ast::Name>,
                  glob: bool, om: &mut Module, please_inline: bool) -> bool {
        fn inherits_doc_hidden(cx: &core::DocContext, mut node: ast::NodeId) -> bool {
            while let Some(id) = cx.map.get_enclosing_scope(node) {
                node = id;
                let attrs = cx.map.attrs(node).clean(cx);
                if attrs.list("doc").has_word("hidden") {
                    return true;
                }
                if node == ast::CRATE_NODE_ID {
                    break;
                }
            }
            false
        }
        let tcx = match self.cx.tcx_opt() {
            Some(tcx) => tcx,
            None => return false
        };
        let def = tcx.expect_def(id);
        let def_did = def.def_id();
        let use_attrs = tcx.map.attrs(id).clean(self.cx);
        // Don't inline doc(hidden) imports so they can be stripped at a later stage.
        let is_no_inline = use_attrs.list("doc").has_word("no_inline") ||
                           use_attrs.list("doc").has_word("hidden");
        // For cross-crate impl inlining we need to know whether items are
        // reachable in documentation - a previously nonreachable item can be
        // made reachable by cross-crate inlining which we're checking here.
        // (this is done here because we need to know this upfront)
        if !def_did.is_local() && !is_no_inline {
            let attrs = clean::inline::load_attrs(self.cx, tcx, def_did);
            let self_is_hidden = attrs.list("doc").has_word("hidden");
            match def {
                Def::Trait(did) |
                Def::Struct(did) |
                Def::Enum(did) |
                Def::TyAlias(did) if !self_is_hidden => {
                    self.cx.access_levels.borrow_mut().map.insert(did, AccessLevel::Public);
                },
                Def::Mod(did) => if !self_is_hidden {
                    ::visit_lib::LibEmbargoVisitor::new(self.cx).visit_mod(did);
                },
                _ => {},
            }
            return false
        }
        let def_node_id = match tcx.map.as_local_node_id(def_did) {
            Some(n) => n, None => return false
        };
        let is_private = !self.cx.access_levels.borrow().is_public(def_did);
        let is_hidden = inherits_doc_hidden(self.cx, def_node_id);
        // Only inline if requested or if the item would otherwise be stripped
        if (!please_inline && !is_private && !is_hidden) || is_no_inline {
            return false
        }
        if !self.view_item_stack.insert(def_node_id) { return false }
        let ret = match tcx.map.get(def_node_id) {
            hir_map::NodeItem(it) => {
                if glob {
                    let prev = mem::replace(&mut self.inlining_from_glob, true);
                    match it.node {
                        hir::ItemMod(ref m) => {
                            for i in &m.item_ids {
                                let i = self.cx.map.expect_item(i.id);
                                self.visit_item(i, None, om);
                            }
                        }
                        hir::ItemEnum(..) => {}
                        _ => { panic!("glob not mapped to a module or enum"); }
                    }
                    self.inlining_from_glob = prev;
                } else {
                    self.visit_item(it, renamed, om);
                }
                true
            }
            _ => false,
        };
        self.view_item_stack.remove(&def_node_id);
        return ret;
    }
fn maybe_inline_local ( & mut self , id : ast :: NodeId , renamed : Option < ast :: Name > , glob : bool , om : & mut Module , please_inline : bool ) -> bool { fn inherits_doc_hidden ( cx : & core :: DocContext , mut node : ast :: NodeId ) -> bool { while let Some ( id ) = cx . map . get_enclosing_scope ( node ) { node = id ; let attrs = cx . map . attrs ( node ) . clean ( cx ) ; if attrs . list ( " " ) . has_word ( " " ) { return true ; } if node == ast :: CRATE_NODE_ID { break ; } } false } let tcx = match self . cx . tcx_opt ( ) { Some ( tcx ) => tcx , None => return false } ; let def = tcx . expect_def ( id ) ; let def_did = def . def_id ( ) ; let use_attrs = tcx . map . attrs ( id ) . clean ( self . cx ) ; // Don't inline doc(hidden) imports so they can be stripped at a later stage. let is_no_inline = use_attrs . list ( " " ) . has_word ( " " ) || use_attrs . list ( " " ) . has_word ( " " ) ; // For cross-crate impl inlining we need to know whether items are // reachable in documentation - a previously nonreachable item can be // made reachable by cross-crate inlining which we're checking here. // (this is done here because we need to know this upfront) if ! def_did . is_local ( ) && ! is_no_inline { let attrs = clean :: inline :: load_attrs ( self . cx , tcx , def_did ) ; let self_is_hidden = attrs . list ( " " ) . has_word ( " " ) ; match def { Def :: Trait ( did ) | Def :: Struct ( did ) | Def :: Enum ( did ) | Def :: TyAlias ( did ) if ! self_is_hidden => { self . cx . access_levels . borrow_mut ( ) . map . insert ( did , AccessLevel :: Public ) ; } , Def :: Mod ( did ) => if ! self_is_hidden { :: visit_lib :: LibEmbargoVisitor :: new ( self . cx ) . visit_mod ( did ) ; } , _ => { } , } return false } let def_node_id = match tcx . map . as_local_node_id ( def_did ) { Some ( n ) => n , None => return false } ; let is_private = ! self . cx . access_levels . borrow ( ) . is_public ( def_did ) ; let is_hidden = inherits_doc_hidden ( self . cx , def_node_id ) ; // Only inline if requested or if the item would otherwise be stripped if ( ! please_inline && ! is_private && ! is_hidden ) || is_no_inline { return false } if ! self . view_item_stack . insert ( def_node_id ) { return false } let ret = match tcx . map . get ( def_node_id ) { hir_map :: NodeItem ( it ) => { if glob { let prev = mem :: replace ( & mut self . inlining_from_glob , true ) ; match it . node { hir :: ItemMod ( ref m ) => { for i in & m . item_ids { let i = self . cx . map . expect_item ( i . id ) ; self . visit_item ( i , None , om ) ; } } hir :: ItemEnum ( .. ) => { } _ => { panic ! ( " " ) ; } } self . inlining_from_glob = prev ; } else { self . visit_item ( it , renamed , om ) ; } true } _ => false , } ; self . view_item_stack . remove ( & def_node_id ) ; return ret ; }
Tries to resolve the target of a `pub use` statement and inlines the
target if it is defined locally and would not be documented otherwise,
or when it is specifically requested with `please_inline`.
Tries to resolve the target of a ` pub use ` statement and inlines the target if it is defined locally and would not be documented otherwise or when it is specifically requested with ` please_inline ` .
&mut self
id
ast::NodeId
renamed
Option<ast::Name>
glob
bool
om
&mut Module
please_inline
bool
&mut self
id
ast::NodeId
renamed
Option<ast::Name>
glob
bool
om
&mut Module
please_inline
bool