qualify-const remove cannot mutate statics in initializer of another static error

This commit is contained in:
Santiago Pastorino 2019-11-11 19:11:24 +01:00
parent 9248b019b2
commit b941034f2f
No known key found for this signature in database
GPG key ID: 88C941CDA1D46432

View file

@ -782,19 +782,6 @@ impl<'a, 'tcx> Visitor<'tcx> for Checker<'a, 'tcx> {
// Only allow statics (not consts) to refer to other statics.
if self.mode == Mode::Static || self.mode == Mode::StaticMut {
if self.mode == Mode::Static
&& context.is_mutating_use()
&& !self.suppress_errors
{
// this is not strictly necessary as miri will also bail out
// For interior mutability we can't really catch this statically as that
// goes through raw pointers and intermediate temporaries, so miri has
// to catch this anyway
self.tcx.sess.span_err(
self.span,
"cannot mutate statics in the initializer of another static",
);
}
return;
}
unleash_miri!(self);