Put attrs in a Box for memory efficiency.
This commit is contained in:
parent
e2a77b3d46
commit
c975fe25e4
3 changed files with 2 additions and 4 deletions
|
@ -2081,7 +2081,7 @@ crate enum ImportKind {
|
||||||
crate struct ImportSource {
|
crate struct ImportSource {
|
||||||
crate path: Path,
|
crate path: Path,
|
||||||
crate did: Option<DefId>,
|
crate did: Option<DefId>,
|
||||||
crate attrs: Option<Attributes>,
|
crate attrs: Option<Box<Attributes>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
|
|
|
@ -469,7 +469,7 @@ crate fn register_res(cx: &mut DocContext<'_>, res: Res) -> DefId {
|
||||||
|
|
||||||
crate fn resolve_use_source(cx: &mut DocContext<'_>, path: Path) -> ImportSource {
|
crate fn resolve_use_source(cx: &mut DocContext<'_>, path: Path) -> ImportSource {
|
||||||
let did = if path.res.opt_def_id().is_none() { None } else { Some(register_res(cx, path.res)) };
|
let did = if path.res.opt_def_id().is_none() { None } else { Some(register_res(cx, path.res)) };
|
||||||
let attrs = did.map(|did| cx.tcx.get_attrs(did).clean(cx));
|
let attrs = did.map(|did| Box::new(cx.tcx.get_attrs(did).clean(cx)));
|
||||||
|
|
||||||
ImportSource { did, path, attrs }
|
ImportSource { did, path, attrs }
|
||||||
}
|
}
|
||||||
|
|
|
@ -285,8 +285,6 @@ fn item_module(w: &mut Buffer, cx: &Context<'_>, item: &clean::Item, items: &[cl
|
||||||
let (stab, stab_tags) = if let (Some(def_id), Some(attrs)) =
|
let (stab, stab_tags) = if let (Some(def_id), Some(attrs)) =
|
||||||
(import.source.did, import.source.attrs.clone())
|
(import.source.did, import.source.attrs.clone())
|
||||||
{
|
{
|
||||||
let attrs = Box::new(attrs);
|
|
||||||
|
|
||||||
// Just need an item with the correct def_id and attrs
|
// Just need an item with the correct def_id and attrs
|
||||||
let import_item = clean::Item { def_id, attrs, ..myitem.clone() };
|
let import_item = clean::Item { def_id, attrs, ..myitem.clone() };
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue