File tree 2 files changed +11
-0
lines changed
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>(
194
194
return None ;
195
195
} ;
196
196
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
+
197
203
// try to find the underlying allocation
198
204
let e_alloc = cx. expr_or_init ( e) ;
199
205
let e_alloc =
Original file line number Diff line number Diff line change @@ -239,6 +239,11 @@ unsafe fn bigger_layout() {
239
239
//~^ ERROR casting references to a bigger memory layout
240
240
}
241
241
242
+ {
243
+ let x: Box < dyn Send > = Box :: new ( 0i32 ) ;
244
+ let _z = unsafe { & * ( & * x as * const dyn Send as * const i32 ) } ;
245
+ }
246
+
242
247
unsafe fn from_ref ( this : & i32 ) -> & i64 {
243
248
& * ( this as * const i32 as * const i64 )
244
249
}
You can’t perform that action at this time.
0 commit comments