@@ -5,7 +5,7 @@ use rustc::ty::{self, Ty};
5
5
use rustc:: hir:: def_id:: DefId ;
6
6
use syntax_pos:: DUMMY_SP ;
7
7
8
- use super :: { ConstKind , Item as ConstCx } ;
8
+ use super :: Item as ConstCx ;
9
9
10
10
pub fn in_any_value_of_ty ( cx : & ConstCx < ' _ , ' tcx > , ty : Ty < ' tcx > ) -> ConstQualifs {
11
11
ConstQualifs {
@@ -218,34 +218,6 @@ impl Qualif for HasMutInterior {
218
218
rvalue : & Rvalue < ' tcx > ,
219
219
) -> bool {
220
220
match * rvalue {
221
- // Returning `true` for `Rvalue::Ref` indicates the borrow isn't
222
- // allowed in constants (and the `Checker` will error), and/or it
223
- // won't be promoted, due to `&mut ...` or interior mutability.
224
- Rvalue :: Ref ( _, kind, ref place) => {
225
- let ty = place. ty ( cx. body , cx. tcx ) . ty ;
226
-
227
- if let BorrowKind :: Mut { .. } = kind {
228
- // In theory, any zero-sized value could be borrowed
229
- // mutably without consequences.
230
- match ty. kind {
231
- // Inside a `static mut`, &mut [...] is also allowed.
232
- | ty:: Array ( ..)
233
- | ty:: Slice ( _)
234
- if cx. const_kind == Some ( ConstKind :: StaticMut )
235
- => { } ,
236
-
237
- // FIXME(eddyb): We only return false for `&mut []` outside a const
238
- // context which seems unnecessary given that this is merely a ZST.
239
- | ty:: Array ( _, len)
240
- if len. try_eval_usize ( cx. tcx , cx. param_env ) == Some ( 0 )
241
- && cx. const_kind == None
242
- => { } ,
243
-
244
- _ => return true ,
245
- }
246
- }
247
- }
248
-
249
221
Rvalue :: Aggregate ( ref kind, _) => {
250
222
if let AggregateKind :: Adt ( def, ..) = * * kind {
251
223
if Some ( def. did ) == cx. tcx . lang_items ( ) . unsafe_cell_type ( ) {
0 commit comments