File tree Expand file tree Collapse file tree 1 file changed +12
-16
lines changed
src/librustc_mir/transform/check_consts Expand file tree Collapse file tree 1 file changed +12
-16
lines changed Original file line number Diff line number Diff line change @@ -214,23 +214,19 @@ impl Qualif for HasMutInterior {
214
214
215
215
if let BorrowKind :: Mut { .. } = kind {
216
216
// In theory, any zero-sized value could be borrowed
217
- // mutably without consequences. However, only &mut []
218
- // is allowed right now, and only in functions.
219
- if cx. mode == Mode :: StaticMut {
217
+ // mutably without consequences.
218
+ match ty. sty {
220
219
// Inside a `static mut`, &mut [...] is also allowed.
221
- match ty. sty {
222
- ty:: Array ( ..) | ty:: Slice ( _) => { }
223
- _ => return true ,
224
- }
225
- } else if let ty:: Array ( _, len) = ty. sty {
226
- // FIXME(eddyb) the `cx.mode == Mode::NonConstFn` condition
227
- // seems unnecessary, given that this is merely a ZST.
228
- match len. try_eval_usize ( cx. tcx , cx. param_env ) {
229
- Some ( 0 ) if cx. mode == Mode :: NonConstFn => { } ,
230
- _ => return true ,
231
- }
232
- } else {
233
- return true ;
220
+ ty:: Array ( ..) | ty:: Slice ( _) if cx. mode == Mode :: StaticMut => { } ,
221
+
222
+ // FIXME(ecstaticmorse): uncomment the following match arm to stop marking
223
+ // `&mut []` as `HasMutInterior`.
224
+ /*
225
+ ty::Array(_, len) if len.try_eval_usize(cx.tcx, cx.param_env) == Some(0)
226
+ => {},
227
+ */
228
+
229
+ _ => return true ,
234
230
}
235
231
}
236
232
}
You can’t perform that action at this time.
0 commit comments