We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d632811 commit 8f974ecCopy full SHA for 8f974ec
compiler/rustc_middle/src/mir/interpret/mod.rs
@@ -384,9 +384,12 @@ impl<'tcx> GlobalAlloc<'tcx> {
384
.type_of(def_id)
385
.no_bound_vars()
386
.expect("statics should not have generic parameters");
387
- let layout = tcx.layout_of(typing_env.as_query_input(ty)).unwrap();
388
- assert!(layout.is_sized());
389
- (layout.size, layout.align.abi)
+ if let Ok(layout) = tcx.layout_of(typing_env.as_query_input(ty)) {
+ assert!(layout.is_sized());
+ (layout.size, layout.align.abi)
390
+ } else {
391
+ (Size::ZERO, Align::ONE)
392
+ }
393
}
394
395
GlobalAlloc::Memory(alloc) => {
0 commit comments