1
Fork 0

consider assignments of union field of ManuallyDrop type safe

This commit is contained in:
Ralf Jung 2020-10-18 13:53:54 +02:00
parent 3d3c8c5e0d
commit 3ac1df8b99
4 changed files with 35 additions and 56 deletions

View file

@ -46,7 +46,7 @@ pub enum UnsafetyViolationDetails {
UseOfMutableStatic,
UseOfExternStatic,
DerefOfRawPointer,
AssignToNonCopyUnionField,
AssignToDroppingUnionField,
AccessToUnionField,
MutationOfLayoutConstrainedField,
BorrowOfLayoutConstrainedField,
@ -94,8 +94,8 @@ impl UnsafetyViolationDetails {
"raw pointers may be NULL, dangling or unaligned; they can violate aliasing rules \
and cause data races: all of these are undefined behavior",
),
AssignToNonCopyUnionField => (
"assignment to non-`Copy` union field",
AssignToDroppingUnionField => (
"assignment to union field that needs dropping",
"the previous content of the field will be dropped, which causes undefined \
behavior if the field was not properly initialized",
),