Remove remnants of BorrowOfPackedField
This commit is contained in:
parent
7dc9ff5c62
commit
62044b2fab
@ -32,7 +32,6 @@ pub enum UnsafetyViolationDetails {
|
|||||||
UseOfInlineAssembly,
|
UseOfInlineAssembly,
|
||||||
InitializingTypeWith,
|
InitializingTypeWith,
|
||||||
CastOfPointerToInt,
|
CastOfPointerToInt,
|
||||||
BorrowOfPackedField,
|
|
||||||
UseOfMutableStatic,
|
UseOfMutableStatic,
|
||||||
UseOfExternStatic,
|
UseOfExternStatic,
|
||||||
DerefOfRawPointer,
|
DerefOfRawPointer,
|
||||||
@ -64,11 +63,6 @@ impl UnsafetyViolationDetails {
|
|||||||
CastOfPointerToInt => {
|
CastOfPointerToInt => {
|
||||||
("cast of pointer to int", "casting pointers to integers in constants")
|
("cast of pointer to int", "casting pointers to integers in constants")
|
||||||
}
|
}
|
||||||
BorrowOfPackedField => (
|
|
||||||
"borrow of packed field",
|
|
||||||
"fields of packed structs might be misaligned: dereferencing a misaligned pointer \
|
|
||||||
or even just creating a misaligned reference is undefined behavior",
|
|
||||||
),
|
|
||||||
UseOfMutableStatic => (
|
UseOfMutableStatic => (
|
||||||
"use of mutable static",
|
"use of mutable static",
|
||||||
"mutable statics can be mutated by multiple threads: aliasing violations or data \
|
"mutable statics can be mutated by multiple threads: aliasing violations or data \
|
||||||
|
@ -64,38 +64,30 @@ impl<'tcx> UnsafetyVisitor<'tcx> {
|
|||||||
SafetyContext::UnsafeFn if unsafe_op_in_unsafe_fn_allowed => {}
|
SafetyContext::UnsafeFn if unsafe_op_in_unsafe_fn_allowed => {}
|
||||||
SafetyContext::UnsafeFn => {
|
SafetyContext::UnsafeFn => {
|
||||||
// unsafe_op_in_unsafe_fn is disallowed
|
// unsafe_op_in_unsafe_fn is disallowed
|
||||||
if kind == BorrowOfPackedField {
|
struct_span_err!(
|
||||||
// FIXME handle borrows of packed fields
|
self.tcx.sess,
|
||||||
} else {
|
span,
|
||||||
struct_span_err!(
|
E0133,
|
||||||
self.tcx.sess,
|
"{} is unsafe and requires unsafe block",
|
||||||
span,
|
description,
|
||||||
E0133,
|
)
|
||||||
"{} is unsafe and requires unsafe block",
|
.span_label(span, description)
|
||||||
description,
|
.note(note)
|
||||||
)
|
.emit();
|
||||||
.span_label(span, description)
|
|
||||||
.note(note)
|
|
||||||
.emit();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
SafetyContext::Safe => {
|
SafetyContext::Safe => {
|
||||||
if kind == BorrowOfPackedField {
|
let fn_sugg = if unsafe_op_in_unsafe_fn_allowed { " function or" } else { "" };
|
||||||
// FIXME handle borrows of packed fields
|
struct_span_err!(
|
||||||
} else {
|
self.tcx.sess,
|
||||||
let fn_sugg = if unsafe_op_in_unsafe_fn_allowed { " function or" } else { "" };
|
span,
|
||||||
struct_span_err!(
|
E0133,
|
||||||
self.tcx.sess,
|
"{} is unsafe and requires unsafe{} block",
|
||||||
span,
|
description,
|
||||||
E0133,
|
fn_sugg,
|
||||||
"{} is unsafe and requires unsafe{} block",
|
)
|
||||||
description,
|
.span_label(span, description)
|
||||||
fn_sugg,
|
.note(note)
|
||||||
)
|
.emit();
|
||||||
.span_label(span, description)
|
|
||||||
.note(note)
|
|
||||||
.emit();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -203,8 +195,6 @@ enum UnsafeOpKind {
|
|||||||
#[allow(dead_code)] // FIXME
|
#[allow(dead_code)] // FIXME
|
||||||
CastOfPointerToInt,
|
CastOfPointerToInt,
|
||||||
#[allow(dead_code)] // FIXME
|
#[allow(dead_code)] // FIXME
|
||||||
BorrowOfPackedField,
|
|
||||||
#[allow(dead_code)] // FIXME
|
|
||||||
UseOfMutableStatic,
|
UseOfMutableStatic,
|
||||||
#[allow(dead_code)] // FIXME
|
#[allow(dead_code)] // FIXME
|
||||||
UseOfExternStatic,
|
UseOfExternStatic,
|
||||||
@ -244,11 +234,6 @@ impl UnsafeOpKind {
|
|||||||
CastOfPointerToInt => {
|
CastOfPointerToInt => {
|
||||||
("cast of pointer to int", "casting pointers to integers in constants")
|
("cast of pointer to int", "casting pointers to integers in constants")
|
||||||
}
|
}
|
||||||
BorrowOfPackedField => (
|
|
||||||
"borrow of packed field",
|
|
||||||
"fields of packed structs might be misaligned: dereferencing a misaligned pointer \
|
|
||||||
or even just creating a misaligned reference is undefined behavior",
|
|
||||||
),
|
|
||||||
UseOfMutableStatic => (
|
UseOfMutableStatic => (
|
||||||
"use of mutable static",
|
"use of mutable static",
|
||||||
"mutable statics can be mutated by multiple threads: aliasing violations or data \
|
"mutable statics can be mutated by multiple threads: aliasing violations or data \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user