]> git.lizzy.rs Git - rust.git/commitdiff
qualify-const remove cannot mutate statics in initializer of another static error
authorSantiago Pastorino <spastorino@gmail.com>
Mon, 11 Nov 2019 18:11:24 +0000 (19:11 +0100)
committerSantiago Pastorino <spastorino@gmail.com>
Tue, 12 Nov 2019 12:20:19 +0000 (13:20 +0100)
src/librustc_mir/transform/qualify_consts.rs

index 5ad5363768d34a3142480b24f514020470b14e97..15d771ac685f3ac4879e0f4a401457de1c9cadf1 100644 (file)
@@ -782,19 +782,6 @@ fn visit_place_base(
 
                 // 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);