@@ -3,7 +3,7 @@ use std::ops::RangeInclusive;
3
3
4
4
use syntax_pos:: symbol:: { sym, Symbol } ;
5
5
use rustc:: hir;
6
- use rustc:: ty:: layout:: { self , Size , TyLayout , LayoutOf , VariantIdx } ;
6
+ use rustc:: ty:: layout:: { self , TyLayout , LayoutOf , VariantIdx } ;
7
7
use rustc:: ty;
8
8
use rustc_data_structures:: fx:: FxHashSet ;
9
9
@@ -276,20 +276,11 @@ impl<'rt, 'mir, 'tcx, M: Machine<'mir, 'tcx>> ValidityVisitor<'rt, 'mir, 'tcx, M
276
276
// FIXME: More checks for the vtable.
277
277
}
278
278
ty:: Slice ( ..) | ty:: Str => {
279
- let len = try_validation ! ( meta. unwrap( ) . to_usize( self . ecx) ,
279
+ let _len = try_validation ! ( meta. unwrap( ) . to_usize( self . ecx) ,
280
280
"non-integer slice length in wide pointer" , self . path) ;
281
- // check max slice length
282
- let elem_size = match tail. sty {
283
- ty:: Str => Size :: from_bytes ( 1 ) ,
284
- ty:: Slice ( ty) => self . ecx . layout_of ( ty) ?. size ,
285
- _ => bug ! ( "It cannot be another type" ) ,
286
- } ;
287
- if elem_size. checked_mul ( len, & * self . ecx . tcx ) . is_none ( ) {
288
- throw_validation_failure ! (
289
- "too large slice (longer than isize::MAX bytes)" ,
290
- self . path
291
- ) ;
292
- }
281
+ // We do not check that `len * elem_size <= isize::MAX`:
282
+ // that is only required for references, and there it falls out of the
283
+ // "dereferencable" check performed by Stacked Borrows.
293
284
}
294
285
ty:: Foreign ( ..) => {
295
286
// Unsized, but not wide.
0 commit comments