File tree Expand file tree Collapse file tree 2 files changed +27
-3
lines changed
crates/rustc_codegen_spirv/src/codegen_cx
tests/compiletests/ui/lang/core/mem Expand file tree Collapse file tree 2 files changed +27
-3
lines changed Original file line number Diff line number Diff line change @@ -573,9 +573,10 @@ impl<'tcx> CodegenCx<'tcx> {
573573 SpirvType :: Array { count, .. } => {
574574 u64:: try_from ( self . builder . lookup_const_scalar ( count) . unwrap ( ) ) . unwrap ( )
575575 }
576- SpirvType :: RuntimeArray { .. } => {
577- ( alloc. inner ( ) . size ( ) - offset) . bytes ( ) / stride. bytes ( )
578- }
576+ SpirvType :: RuntimeArray { .. } => ( alloc. inner ( ) . size ( ) - offset)
577+ . bytes ( )
578+ . checked_div ( stride. bytes ( ) )
579+ . unwrap_or ( 0 ) ,
579580 _ => unreachable ! ( ) ,
580581 } ;
581582
Original file line number Diff line number Diff line change 1+ error: unsupported unsized `[struct () { }]` constant
2+ |
3+ = note: used by unnamed global (%68)
4+ = note: used by unnamed global (%69)
5+ note: used from within `size_of_val_unsized::main`
6+ --> <$DIR/size_of_val_unsized.rs>:5:12
7+ |
8+ LL | *out = core::mem::size_of_val(
9+ | ____________^
10+ LL | | const {
11+ LL | | struct S<T: ?Sized>(T);
12+ LL | | &S([]) as &S<[()]>
13+ LL | | },
14+ LL | | );
15+ | |_____^
16+ note: called by `main`
17+ --> <$DIR/size_of_val_unsized.rs>:4:8
18+ |
19+ LL | pub fn main(out: &mut usize) {
20+ | ^^^^
21+
22+ error: aborting due to 1 previous error
23+
You can’t perform that action at this time.
0 commit comments