Skip to content

Commit

Permalink
qualify-const remove cannot mutate statics in initializer of another …
Browse files Browse the repository at this point in the history
…static error
  • Loading branch information
spastorino committed Nov 12, 2019
1 parent 9248b01 commit b941034
Showing 1 changed file with 0 additions and 13 deletions.
13 changes: 0 additions & 13 deletions src/librustc_mir/transform/qualify_consts.rs
Expand Up @@ -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);
Expand Down

0 comments on commit b941034

Please sign in to comment.