mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-03 12:13:43 +00:00
resolve: Minor miscellaneous cleanups from #89059
This commit is contained in:
parent
3d57c61a9e
commit
1324100800
@ -417,16 +417,12 @@ impl CStore {
|
||||
|
||||
let span = data.get_span(id.index, sess);
|
||||
|
||||
let attrs = data.get_item_attrs(id.index, sess).collect();
|
||||
|
||||
let ident = data.item_ident(id.index, sess);
|
||||
|
||||
LoadedMacro::MacroDef(
|
||||
ast::Item {
|
||||
ident,
|
||||
ident: data.item_ident(id.index, sess),
|
||||
id: ast::DUMMY_NODE_ID,
|
||||
span,
|
||||
attrs,
|
||||
attrs: data.get_item_attrs(id.index, sess).collect(),
|
||||
kind: ast::ItemKind::MacroDef(data.get_macro(id.index, sess)),
|
||||
vis: ast::Visibility {
|
||||
span: span.shrink_to_lo(),
|
||||
|
@ -3419,27 +3419,21 @@ impl<'a> Resolver<'a> {
|
||||
return v.clone();
|
||||
}
|
||||
|
||||
let parse_attrs = || {
|
||||
let attrs = self.cstore().item_attrs(def_id, self.session);
|
||||
let attr =
|
||||
attrs.iter().find(|a| a.has_name(sym::rustc_legacy_const_generics))?;
|
||||
let mut ret = vec![];
|
||||
let attr = self
|
||||
.cstore()
|
||||
.item_attrs(def_id, self.session)
|
||||
.into_iter()
|
||||
.find(|a| a.has_name(sym::rustc_legacy_const_generics))?;
|
||||
let mut ret = Vec::new();
|
||||
for meta in attr.meta_item_list()? {
|
||||
match meta.literal()?.kind {
|
||||
LitKind::Int(a, _) => {
|
||||
ret.push(a as usize);
|
||||
}
|
||||
LitKind::Int(a, _) => ret.push(a as usize),
|
||||
_ => panic!("invalid arg index"),
|
||||
}
|
||||
}
|
||||
Some(ret)
|
||||
};
|
||||
|
||||
// Cache the lookup to avoid parsing attributes for an iterm
|
||||
// multiple times.
|
||||
let ret = parse_attrs();
|
||||
self.legacy_const_generic_args.insert(def_id, ret.clone());
|
||||
return ret;
|
||||
// Cache the lookup to avoid parsing attributes for an iterm multiple times.
|
||||
self.legacy_const_generic_args.insert(def_id, Some(ret.clone()));
|
||||
return Some(ret);
|
||||
}
|
||||
}
|
||||
None
|
||||
|
Loading…
Reference in New Issue
Block a user