diff options
| author | Mara Bos <m-ou.se@m-ou.se> | 2021-01-09 16:48:58 +0100 |
|---|---|---|
| committer | Mara Bos <m-ou.se@m-ou.se> | 2021-01-09 19:50:06 +0100 |
| commit | d651fa78cefecefa87fa3d7dc1e1389d275afb63 (patch) | |
| tree | 45bc43f0d9979d6cd5051426d24cab97102593ae /compiler/rustc_resolve/src/lib.rs | |
| parent | 1f9dc9a1821d55b1641c517feac7fcd6ac76aadc (diff) | |
| download | rust-d651fa78cefecefa87fa3d7dc1e1389d275afb63.tar.gz rust-d651fa78cefecefa87fa3d7dc1e1389d275afb63.zip | |
Allow #[rustc_builtin_macro = "name"].
This makes it possible to have both std::panic and core::panic as a builtin macro, by using different builtin macro names for each. Also removes SyntaxExtension::is_derive_copy, as the macro name (e.g. sym::Copy) is now tracked and provides that information directly.
Diffstat (limited to 'compiler/rustc_resolve/src/lib.rs')
| -rw-r--r-- | compiler/rustc_resolve/src/lib.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/rustc_resolve/src/lib.rs b/compiler/rustc_resolve/src/lib.rs index a6d0240b6fd..fdeacafc4a8 100644 --- a/compiler/rustc_resolve/src/lib.rs +++ b/compiler/rustc_resolve/src/lib.rs @@ -1443,7 +1443,7 @@ impl<'a> Resolver<'a> { } fn is_builtin_macro(&mut self, res: Res) -> bool { - self.get_macro(res).map_or(false, |ext| ext.is_builtin) + self.get_macro(res).map_or(false, |ext| ext.builtin_name.is_some()) } fn macro_def(&self, mut ctxt: SyntaxContext) -> DefId { @@ -2010,7 +2010,7 @@ impl<'a> Resolver<'a> { // The macro is a proc macro derive if let Some(def_id) = module.expansion.expn_data().macro_def_id { let ext = self.get_macro_by_def_id(def_id); - if !ext.is_builtin + if ext.builtin_name.is_none() && ext.macro_kind() == MacroKind::Derive && parent.expansion.outer_expn_is_descendant_of(span.ctxt()) { |
