Tech News
← Home  ·  All topics

Derive Macro

1 GoKawiil brief on this topic

Rust compiler marks derived trait methods #[inline] by default

Rust's #[derive(Debug)], #[derive(Clone)] and similar macros automatically attach an #[inline] attribute to the generated methods, as shown by expanding the macros or noted in the language reference. This behavior isn't formally guaranteed by the language specification but is consistently observed in current compiler output.