From d651fa78cefecefa87fa3d7dc1e1389d275afb63 Mon Sep 17 00:00:00 2001 From: Mara Bos Date: Sat, 9 Jan 2021 16:48:58 +0100 Subject: 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. --- compiler/rustc_resolve/src/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'compiler/rustc_resolve/src/lib.rs') 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()) { -- cgit 1.4.1-3-g733a5