pub fn try_push_visible_item_path<T>(self, buffer: &mut T, external_def_id: DefId) -> bool
        where T: ItemPathBuffer
    {
        let visible_parent_map = self.visible_parent_map(LOCAL_CRATE);

        let (mut cur_def, mut cur_path) = (external_def_id, Vec::<LocalInternedString>::new());
        loop {
            // If `cur_def` is a direct or injected extern crate, push the path to the crate
            // followed by the path to the item within the crate and return.
            if cur_def.index == CRATE_DEF_INDEX {
                match *self.extern_crate(cur_def) {
                    Some(ExternCrate {
                        src: ExternCrateSource::Extern(def_id),
                        direct: true,
                        ..
                    }) => {
                        self.push_item_path(buffer, def_id);
                        cur_path.iter().rev().for_each(|segment| buffer.push(&segment));
                        return true;
                    }
                    None => {
                        buffer.push(&self.crate_name(cur_def.krate).as_str());
                        cur_path.iter().rev().for_each(|segment| buffer.push(&segment));
                        return true;
                    }
                    _ => {},
                }
            }

            let mut cur_def_key = self.def_key(cur_def);

            // For a UnitStruct or TupleStruct we want the name of its parent rather than <unnamed>.
            if let DefPathData::StructCtor = cur_def_key.disambiguated_data.data {
                let parent = DefId {
                    krate: cur_def.krate,
                    index: cur_def_key.parent.expect("DefPathData::StructCtor missing a parent"),
                };

                cur_def_key = self.def_key(parent);
            }

            let data = cur_def_key.disambiguated_data.data;
            let symbol = data.get_opt_name().map(|n| n.as_str()).unwrap_or_else(|| {
                if let DefPathData::CrateRoot = data {  // reexported `extern crate` (#43189)
                    self.original_crate_name(cur_def.krate).as_str()
                } else {
                    Symbol::intern("<unnamed>").as_str()
                }
            });
            cur_path.push(symbol);

            match visible_parent_map.get(&cur_def) {
                Some(&def) => cur_def = def,
                None => return false,
            };
        }
    }
/// If possible, this pushes a global path resolving to `external_def_id` that is visible
/// from at least one local module and returns true. If the crate defining `external_def_id` is
/// declared with an `extern crate`, the path is guaranteed to use the `extern crate`.
If possible, this pushes a global path resolving to `external_def_id` that is visible
from at least one local module and returns true.
If possible this pushes a global path resolving to ` external_def_id ` that is visible from at least one local module and returns true .
pub fn try_push_visible_item_path<T>(self, buffer: &mut T, external_def_id: DefId) -> bool
        where T: ItemPathBuffer
    {
        let visible_parent_map = self.visible_parent_map(LOCAL_CRATE);
        let (mut cur_def, mut cur_path) = (external_def_id, Vec::<LocalInternedString>::new());
        loop {
            // If `cur_def` is a direct or injected extern crate, push the path to the crate
            // followed by the path to the item within the crate and return.
            if cur_def.index == CRATE_DEF_INDEX {
                match *self.extern_crate(cur_def) {
                    Some(ExternCrate {
                        src: ExternCrateSource::Extern(def_id),
                        direct: true,
                        ..
                    }) => {
                        self.push_item_path(buffer, def_id);
                        cur_path.iter().rev().for_each(|segment| buffer.push(&segment));
                        return true;
                    }
                    None => {
                        buffer.push(&self.crate_name(cur_def.krate).as_str());
                        cur_path.iter().rev().for_each(|segment| buffer.push(&segment));
                        return true;
                    }
                    _ => {},
                }
            }
            let mut cur_def_key = self.def_key(cur_def);
            // For a UnitStruct or TupleStruct we want the name of its parent rather than <unnamed>.
            if let DefPathData::StructCtor = cur_def_key.disambiguated_data.data {
                let parent = DefId {
                    krate: cur_def.krate,
                    index: cur_def_key.parent.expect("DefPathData::StructCtor missing a parent"),
                };
                cur_def_key = self.def_key(parent);
            }
            let data = cur_def_key.disambiguated_data.data;
            let symbol = data.get_opt_name().map(|n| n.as_str()).unwrap_or_else(|| {
                if let DefPathData::CrateRoot = data {  // reexported `extern crate` (#43189)
                    self.original_crate_name(cur_def.krate).as_str()
                } else {
                    Symbol::intern("<unnamed>").as_str()
                }
            });
            cur_path.push(symbol);
            match visible_parent_map.get(&cur_def) {
                Some(&def) => cur_def = def,
                None => return false,
            };
        }
    }
pub fn try_push_visible_item_path < T > ( self , buffer : & mut T , external_def_id : DefId ) -> bool where T : ItemPathBuffer { let visible_parent_map = self . visible_parent_map ( LOCAL_CRATE ) ; let ( mut cur_def , mut cur_path ) = ( external_def_id , Vec :: < LocalInternedString > :: new ( ) ) ; loop { // If `cur_def` is a direct or injected extern crate, push the path to the crate // followed by the path to the item within the crate and return. if cur_def . index == CRATE_DEF_INDEX { match * self . extern_crate ( cur_def ) { Some ( ExternCrate { src : ExternCrateSource :: Extern ( def_id ) , direct : true , .. } ) => { self . push_item_path ( buffer , def_id ) ; cur_path . iter ( ) . rev ( ) . for_each ( | segment | buffer . push ( & segment ) ) ; return true ; } None => { buffer . push ( & self . crate_name ( cur_def . krate ) . as_str ( ) ) ; cur_path . iter ( ) . rev ( ) . for_each ( | segment | buffer . push ( & segment ) ) ; return true ; } _ => { } , } } let mut cur_def_key = self . def_key ( cur_def ) ; // For a UnitStruct or TupleStruct we want the name of its parent rather than <unnamed>. if let DefPathData :: StructCtor = cur_def_key . disambiguated_data . data { let parent = DefId { krate : cur_def . krate , index : cur_def_key . parent . expect ( " " ) , } ; cur_def_key = self . def_key ( parent ) ; } let data = cur_def_key . disambiguated_data . data ; let symbol = data . get_opt_name ( ) . map ( | n | n . as_str ( ) ) . unwrap_or_else ( | | { if let DefPathData :: CrateRoot = data { // reexported `extern crate` (#43189) self . original_crate_name ( cur_def . krate ) . as_str ( ) } else { Symbol :: intern ( " " ) . as_str ( ) } } ) ; cur_path . push ( symbol ) ; match visible_parent_map . get ( & cur_def ) { Some ( & def ) => cur_def = def , None => return false , } ; } }
If possible, this pushes a global path resolving to `external_def_id` that is visible
from at least one local module and returns true.
If possible this pushes a global path resolving to ` external_def_id ` that is visible from at least one local module and returns true .
self
buffer
&mut T
external_def_id
DefId
self
buffer
&mut T
external_def_id
DefId