@@ -64,38 +64,30 @@ impl<'tcx> UnsafetyVisitor<'tcx> {
64
64
SafetyContext :: UnsafeFn if unsafe_op_in_unsafe_fn_allowed => { }
65
65
SafetyContext :: UnsafeFn => {
66
66
// 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 ( ) ;
81
77
}
82
78
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 ( ) ;
99
91
}
100
92
}
101
93
}
@@ -203,8 +195,6 @@ enum UnsafeOpKind {
203
195
#[ allow( dead_code) ] // FIXME
204
196
CastOfPointerToInt ,
205
197
#[ allow( dead_code) ] // FIXME
206
- BorrowOfPackedField ,
207
- #[ allow( dead_code) ] // FIXME
208
198
UseOfMutableStatic ,
209
199
#[ allow( dead_code) ] // FIXME
210
200
UseOfExternStatic ,
@@ -244,11 +234,6 @@ impl UnsafeOpKind {
244
234
CastOfPointerToInt => {
245
235
( "cast of pointer to int" , "casting pointers to integers in constants" )
246
236
}
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
- ) ,
252
237
UseOfMutableStatic => (
253
238
"use of mutable static" ,
254
239
"mutable statics can be mutated by multiple threads: aliasing violations or data \
0 commit comments