@@ -64,38 +64,30 @@ impl<'tcx> UnsafetyVisitor<'tcx> {
6464 SafetyContext :: UnsafeFn if unsafe_op_in_unsafe_fn_allowed => { }
6565 SafetyContext :: UnsafeFn => {
6666 // unsafe_op_in_unsafe_fn is disallowed
67- if kind == BorrowOfPackedField {
68- // FIXME handle borrows of packed fields
69- } else {
70- struct_span_err ! (
71- self . tcx. sess,
72- span,
73- E0133 ,
74- "{} is unsafe and requires unsafe block" ,
75- description,
76- )
77- . span_label ( span, description)
78- . note ( note)
79- . emit ( ) ;
80- }
67+ struct_span_err ! (
68+ self . tcx. sess,
69+ span,
70+ E0133 ,
71+ "{} is unsafe and requires unsafe block" ,
72+ description,
73+ )
74+ . span_label ( span, description)
75+ . note ( note)
76+ . emit ( ) ;
8177 }
8278 SafetyContext :: Safe => {
83- if kind == BorrowOfPackedField {
84- // FIXME handle borrows of packed fields
85- } else {
86- let fn_sugg = if unsafe_op_in_unsafe_fn_allowed { " function or" } else { "" } ;
87- struct_span_err ! (
88- self . tcx. sess,
89- span,
90- E0133 ,
91- "{} is unsafe and requires unsafe{} block" ,
92- description,
93- fn_sugg,
94- )
95- . span_label ( span, description)
96- . note ( note)
97- . emit ( ) ;
98- }
79+ let fn_sugg = if unsafe_op_in_unsafe_fn_allowed { " function or" } else { "" } ;
80+ struct_span_err ! (
81+ self . tcx. sess,
82+ span,
83+ E0133 ,
84+ "{} is unsafe and requires unsafe{} block" ,
85+ description,
86+ fn_sugg,
87+ )
88+ . span_label ( span, description)
89+ . note ( note)
90+ . emit ( ) ;
9991 }
10092 }
10193 }
@@ -203,8 +195,6 @@ enum UnsafeOpKind {
203195 #[ allow( dead_code) ] // FIXME
204196 CastOfPointerToInt ,
205197 #[ allow( dead_code) ] // FIXME
206- BorrowOfPackedField ,
207- #[ allow( dead_code) ] // FIXME
208198 UseOfMutableStatic ,
209199 #[ allow( dead_code) ] // FIXME
210200 UseOfExternStatic ,
@@ -244,11 +234,6 @@ impl UnsafeOpKind {
244234 CastOfPointerToInt => {
245235 ( "cast of pointer to int" , "casting pointers to integers in constants" )
246236 }
247- BorrowOfPackedField => (
248- "borrow of packed field" ,
249- "fields of packed structs might be misaligned: dereferencing a misaligned pointer \
250- or even just creating a misaligned reference is undefined behavior",
251- ) ,
252237 UseOfMutableStatic => (
253238 "use of mutable static" ,
254239 "mutable statics can be mutated by multiple threads: aliasing violations or data \
0 commit comments