{"global_allocator", MacroBuiltin::sorry},
{"cfg_accessible", MacroBuiltin::sorry},
/* Derive builtins do not need a real transcriber, but still need one. It
- will however never be called since builtin derive macros get expanded
+ should however never be called since builtin derive macros get expanded
differently, and benefit from knowing on what kind of items they are
applied (struct, enums, unions) rather than receiving a list of tokens
like regular builtin macros */
}
AST::Fragment
-MacroBuiltin::proc_macro_builtin (Location, AST::MacroInvocData &)
+MacroBuiltin::proc_macro_builtin (Location invoc_locus,
+ AST::MacroInvocData &invoc)
{
- // nothing to do!
+ rust_error_at (invoc_locus, "cannot invoke derive macro: %qs",
+ invoc.get_path ().as_string ().c_str ());
+
return AST::Fragment::create_error ();
}
static AST::Fragment sorry (Location invoc_locus, AST::MacroInvocData &invoc);
- /* Builtin procedural macros do not work directly on tokens, but still need an
- * empty builtin transcriber to be considered proper builtin macros */
+ /* Builtin procedural macros do not work directly on tokens, but still need a
+ * builtin transcriber to be considered proper builtin macros */
static AST::Fragment proc_macro_builtin (Location, AST::MacroInvocData &);
};
} // namespace Rust
--- /dev/null
+#![feature(rustc_attrs)]
+#![feature(decl_macro)]
+
+#[rustc_builtin_macro]
+pub macro Copy($i:item) { /* builtin */ }
+
+pub fn foo() {
+ Copy!(); // { dg-error "cannot invoke derive macro" }
+}