never consider unsafe blocks unused if they would be required with unsafe_op_in_unsafe_fn
This commit is contained in:
parent
4493a0f472
commit
ee3fc9dff8
10 changed files with 124 additions and 631 deletions
|
@ -75,10 +75,10 @@ impl<'tcx> UnsafetyVisitor<'_, 'tcx> {
|
|||
match self.safety_context {
|
||||
SafetyContext::BuiltinUnsafeBlock => {}
|
||||
SafetyContext::UnsafeBlock { ref mut used, .. } => {
|
||||
if !self.body_unsafety.is_unsafe() || !unsafe_op_in_unsafe_fn_allowed {
|
||||
// Mark this block as useful
|
||||
*used = true;
|
||||
}
|
||||
// Mark this block as useful (even inside `unsafe fn`, where it is technically
|
||||
// redundant -- but we want to eventually enable `unsafe_op_in_unsafe_fn` by
|
||||
// default which will require those blocks).
|
||||
*used = true;
|
||||
}
|
||||
SafetyContext::UnsafeFn if unsafe_op_in_unsafe_fn_allowed => {}
|
||||
SafetyContext::UnsafeFn => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue