Skip to content

Commit 9ab1d5c

Browse files
committed
multi-variant enums are tricky
1 parent 0d242b3 commit 9ab1d5c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/librustc_lint/builtin.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1971,14 +1971,16 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for InvalidValue {
19711971
})
19721972
})
19731973
}
1974+
// Multi-variant enums are tricky: if all but one variant are
1975+
// uninhabited, we might actually do layout like for a single-variant
1976+
// enum, and then even leaving them uninitialized could be okay.
19741977
_ => None, // Conservative fallback for multi-variant enum.
19751978
}
19761979
}
19771980
Tuple(..) => {
19781981
// Proceed recursively, check all fields.
19791982
ty.tuple_fields().find_map(|field| ty_find_init_error(tcx, field, init))
19801983
}
1981-
// FIXME: *Only for `mem::uninitialized`*, we could also warn for multivariant enum.
19821984
// Conservative fallback.
19831985
_ => None,
19841986
}

0 commit comments

Comments
 (0)