@@ -3,7 +3,7 @@ use std::ops::RangeInclusive;
33
44use syntax_pos:: symbol:: { sym, Symbol } ;
55use rustc:: hir;
6- use rustc:: ty:: layout:: { self , Size , TyLayout , LayoutOf , VariantIdx } ;
6+ use rustc:: ty:: layout:: { self , TyLayout , LayoutOf , VariantIdx } ;
77use rustc:: ty;
88use rustc_data_structures:: fx:: FxHashSet ;
99
@@ -276,20 +276,11 @@ impl<'rt, 'mir, 'tcx, M: Machine<'mir, 'tcx>> ValidityVisitor<'rt, 'mir, 'tcx, M
276276 // FIXME: More checks for the vtable.
277277 }
278278 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) ,
280280 "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.
293284 }
294285 ty:: Foreign ( ..) => {
295286 // Unsized, but not wide.
0 commit comments