@@ -5,7 +5,7 @@ use rustc::ty::{self, Ty};
55use rustc:: hir:: def_id:: DefId ;
66use syntax_pos:: DUMMY_SP ;
77
8- use super :: { ConstKind , Item as ConstCx } ;
8+ use super :: Item as ConstCx ;
99
1010pub fn in_any_value_of_ty ( cx : & ConstCx < ' _ , ' tcx > , ty : Ty < ' tcx > ) -> ConstQualifs {
1111 ConstQualifs {
@@ -218,34 +218,6 @@ impl Qualif for HasMutInterior {
218218 rvalue : & Rvalue < ' tcx > ,
219219 ) -> bool {
220220 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-
249221 Rvalue :: Aggregate ( ref kind, _) => {
250222 if let AggregateKind :: Adt ( def, ..) = * * kind {
251223 if Some ( def. did ) == cx. tcx . lang_items ( ) . unsafe_cell_type ( ) {
0 commit comments