We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f441adc commit 56633b3Copy full SHA for 56633b3
compiler/rustc_builtin_macros/src/deriving/generic/mod.rs
@@ -1149,8 +1149,9 @@ impl<'a> MethodDef<'a> {
1149
let unify_fieldless_variants =
1150
self.fieldless_variants_strategy == FieldlessVariantsStrategy::Unify;
1151
1152
- // For zero-variant enum, this function body is unreachable.
1153
- // Generate `match *self {}`.
+ // For zero-variant enum, this function body is unreachable. Generate
+ // `match *self {}`. This produces machine code identical to `unsafe {
1154
+ // core::intrinsics::unreachable() }` while being safe and stable.
1155
if variants.is_empty() {
1156
selflike_args.truncate(1);
1157
let match_arg = cx.expr_deref(span, selflike_args.pop().unwrap());
0 commit comments