Skip to content

Commit 310eb55

Browse files
committed
Auto merge of rust-lang#86735 - jhpratt:rfc-3107, r=petrochenkov
Implement RFC 3107: `#[derive(Default)]` on enums with a `#[default]` attribute This PR implements RFC 3107, which permits `#[derive(Default)]` on enums where a unit variant has a `#[default]` attribute. See comments for current status.
2 parents 7e3fb02 + 08e4ffd commit 310eb55

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

core/src/default.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,8 @@ pub fn default<T: Default>() -> T {
161161
}
162162

163163
/// Derive macro generating an impl of the trait `Default`.
164-
#[rustc_builtin_macro]
164+
#[cfg_attr(not(bootstrap), rustc_builtin_macro(Default, attributes(default)))]
165+
#[cfg_attr(bootstrap, rustc_builtin_macro)]
165166
#[stable(feature = "builtin_macro_prelude", since = "1.38.0")]
166167
#[allow_internal_unstable(core_intrinsics)]
167168
pub macro Default($item:item) {

0 commit comments

Comments
 (0)