use alloc::borrow::ToOwned;
use alloc::boxed::Box;
use alloc::format;
use alloc::string::{String, ToString};
use alloc::vec;
use alloc::vec::Vec;
use crate::rustc_hir::def::Res;
use rustc_macros::{StableHash, TyDecodable, TyEncodable};
use crate::rustc_span::Ident;
use crate::rustc_span::def_id::{DefId, ModId};
use smallvec::SmallVec;
use crate::rustc_middle::ty;
#[derive(Clone, Copy, Debug, TyEncodable, TyDecodable, StableHash)]
pub enum Reexport {
Single(DefId),
Glob(DefId),
ExternCrate(DefId),
MacroUse,
MacroExport,
}
impl Reexport {
pub fn id(self) -> Option<DefId> {
match self {
Reexport::Single(id) | Reexport::Glob(id) | Reexport::ExternCrate(id) => Some(id),
Reexport::MacroUse | Reexport::MacroExport => None,
}
}
}
#[derive(Debug, TyEncodable, TyDecodable, StableHash)]
pub struct ModChild {
pub ident: Ident,
pub res: Res<crate::Never>,
pub vis: ty::Visibility<ModId>,
pub reexport_chain: SmallVec<[Reexport; 2]>,
}
#[derive(Debug, TyEncodable, TyDecodable, StableHash)]
pub struct AmbigModChild {
pub main: ModChild,
pub second: ModChild,
}