implement MacroData

This commit is contained in:
Takayuki Maeda 2022-06-15 00:31:21 +09:00
parent 60a50d02ab
commit 0d24405211
5 changed files with 34 additions and 28 deletions

View file

@ -658,7 +658,7 @@ impl<'a> Resolver<'a> {
res
};
res.map(|res| (self.get_macro(res), res))
res.map(|res| (self.get_macro(res).map(|macro_data| macro_data.ext), res))
}
pub(crate) fn finalize_macro_resolutions(&mut self) {
@ -853,7 +853,7 @@ impl<'a> Resolver<'a> {
// Reserve some names that are not quite covered by the general check
// performed on `Resolver::builtin_attrs`.
if ident.name == sym::cfg || ident.name == sym::cfg_attr {
let macro_kind = self.get_macro(res).map(|ext| ext.macro_kind());
let macro_kind = self.get_macro(res).map(|macro_data| macro_data.ext.macro_kind());
if macro_kind.is_some() && sub_namespace_match(macro_kind, Some(MacroKind::Attr)) {
self.session.span_err(
ident.span,