diff options
| author | Aaron Hill <aa1ronham@gmail.com> | 2020-05-22 16:57:25 -0400 |
|---|---|---|
| committer | Aaron Hill <aa1ronham@gmail.com> | 2020-05-22 16:57:25 -0400 |
| commit | d277904582d530feb4701dc76508fdf473cce8f4 (patch) | |
| tree | 8dd72bac22b68a64ac819265d997686d1b9bbe86 /src/librustc_resolve/macros.rs | |
| parent | 215f2d3294b08dbdcf8f7d40de21ef1e7eae0a2d (diff) | |
| download | rust-d277904582d530feb4701dc76508fdf473cce8f4.tar.gz rust-d277904582d530feb4701dc76508fdf473cce8f4.zip | |
Remove `macro_defs` map
We store store the `DefId` directly in `ExpnData`. This will allow us to serialize `ExpnData` in PR #72121 without needing to manage a side table.
Diffstat (limited to 'src/librustc_resolve/macros.rs')
| -rw-r--r-- | src/librustc_resolve/macros.rs | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/librustc_resolve/macros.rs b/src/librustc_resolve/macros.rs index 1b6268dc8cb..7027c826267 100644 --- a/src/librustc_resolve/macros.rs +++ b/src/librustc_resolve/macros.rs @@ -186,6 +186,7 @@ impl<'a> base::Resolver for Resolver<'a> { call_site, self.session.edition(), features.into(), + None, ))); let parent_scope = if let Some(module_id) = parent_module_id { @@ -290,13 +291,17 @@ impl<'a> base::Resolver for Resolver<'a> { let (ext, res) = self.smart_resolve_macro_path(path, kind, parent_scope, force)?; let span = invoc.span(); - invoc_id.set_expn_data(ext.expn_data(parent_scope.expansion, span, fast_print_path(path))); - - if let Res::Def(_, def_id) = res { + invoc_id.set_expn_data(ext.expn_data( + parent_scope.expansion, + span, + fast_print_path(path), + res.opt_def_id(), + )); + + if let Res::Def(_, _) = res { if after_derive { self.session.span_err(span, "macro attributes must be placed before `#[derive]`"); } - self.macro_defs.insert(invoc_id, def_id); let normal_module_def_id = self.macro_def_scope(invoc_id).normal_ancestor_id; self.definitions.add_parent_module_of_macro_def(invoc_id, normal_module_def_id); } |
