Stream: t-compiler/help

Topic: pub macro vs macro_rules!


yunhua (Dec 05 2019 at 20:55, on Zulip):

Hi there are some macro using pub macro, such as
src/libcore/marker.rs
pub macro Copy($item:item) { /* compiler built-in */ }
what is the difference "pub macro" compare with macro_rules!, there are lots of information for macro_rules!, but I can't find related information for "pub macro", Thanks!

Matthew Jasper (Dec 05 2019 at 21:21, on Zulip):

https://rust-lang.github.io/rfcs/1561-macro-naming.html and https://rust-lang.github.io/rfcs/1584-macros.html give a bit of background

Matthew Jasper (Dec 05 2019 at 21:24, on Zulip):

In short the differences are:

Notably a pub macro doesn't end up at the crate root, unlike a #[macro_export] macro_rules!

Last update: Apr 06 2020 at 02:35UTC