Rollup merge of #80850 - m-ou-se:rustc-builtin-macro-name, r=petrochenkov
Allow #[rustc_builtin_macro = "name"] This adds the option of specifying the name of a builtin macro in the `#[rustc_builtin_macro]` attribute: `#[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. This is needed to implement the edition-specific behaviour of the panic macros of RFC 3007. Also removes `SyntaxExtension::is_derive_copy`, as the macro name (e.g. `sym::Copy`) is now tracked and provides that information directly. r? ``@petrochenkov``
This commit is contained in:
commit
3e735c6e93
5 changed files with 13 additions and 15 deletions
|
@ -1447,7 +1447,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 {
|
||||
|
@ -2014,7 +2014,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())
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue