File tree Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -194,6 +194,12 @@ fn is_cast_to_bigger_memory_layout<'tcx>(
194194 return None ;
195195 } ;
196196
197+ // if the type is not Sized we cannot know by definition it's size
198+ // so we bail out
199+ if !inner_start_ty. is_sized ( cx. tcx , cx. param_env ) {
200+ return None ;
201+ }
202+
197203 // try to find the underlying allocation
198204 let e_alloc = cx. expr_or_init ( e) ;
199205 let e_alloc =
Original file line number Diff line number Diff line change @@ -239,6 +239,11 @@ unsafe fn bigger_layout() {
239239 //~^ ERROR casting references to a bigger memory layout
240240 }
241241
242+ {
243+ let x: Box < dyn Send > = Box :: new ( 0i32 ) ;
244+ let _z = unsafe { & * ( & * x as * const dyn Send as * const i32 ) } ;
245+ }
246+
242247 unsafe fn from_ref ( this : & i32 ) -> & i64 {
243248 & * ( this as * const i32 as * const i64 )
244249 }
You can’t perform that action at this time.
0 commit comments