Remove reference to Mode::NonConstFn
in qualifs
This should have no effect on behavior since the validator is never run in const contexts.
This commit is contained in:
parent
48d3843be6
commit
3758e383a6
1 changed files with 12 additions and 16 deletions
|
@ -214,24 +214,20 @@ impl Qualif for HasMutInterior {
|
||||||
|
|
||||||
if let BorrowKind::Mut { .. } = kind {
|
if let BorrowKind::Mut { .. } = kind {
|
||||||
// In theory, any zero-sized value could be borrowed
|
// In theory, any zero-sized value could be borrowed
|
||||||
// mutably without consequences. However, only &mut []
|
// mutably without consequences.
|
||||||
// is allowed right now, and only in functions.
|
|
||||||
if cx.mode == Mode::StaticMut {
|
|
||||||
// Inside a `static mut`, &mut [...] is also allowed.
|
|
||||||
match ty.sty {
|
match ty.sty {
|
||||||
ty::Array(..) | ty::Slice(_) => {}
|
// Inside a `static mut`, &mut [...] is also allowed.
|
||||||
|
ty::Array(..) | ty::Slice(_) if cx.mode == Mode::StaticMut => {},
|
||||||
|
|
||||||
|
// FIXME(ecstaticmorse): uncomment the following match arm to stop marking
|
||||||
|
// `&mut []` as `HasMutInterior`.
|
||||||
|
/*
|
||||||
|
ty::Array(_, len) if len.try_eval_usize(cx.tcx, cx.param_env) == Some(0)
|
||||||
|
=> {},
|
||||||
|
*/
|
||||||
|
|
||||||
_ => return true,
|
_ => return true,
|
||||||
}
|
}
|
||||||
} else if let ty::Array(_, len) = ty.sty {
|
|
||||||
// FIXME(eddyb) the `cx.mode == Mode::NonConstFn` condition
|
|
||||||
// seems unnecessary, given that this is merely a ZST.
|
|
||||||
match len.try_eval_usize(cx.tcx, cx.param_env) {
|
|
||||||
Some(0) if cx.mode == Mode::NonConstFn => {},
|
|
||||||
_ => return true,
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue