Closed
Description
The following code ICEs:
#[repr(transparent)]
struct W<T>(T);
// The drop fn is checked before size/align are, so get ourselves a "sufficiently valid" drop fn
fn drop_me(_: *mut usize) {}
const INVALID_VTABLE_SIZE: W<&dyn Send> =
unsafe { std::mem::transmute((&92u8, &(drop_me as fn(*mut usize), usize::MAX, 1usize))) };
To fix this, this code here needs to properly catch the "invalid size/align" error and turn it into a validation failure:
But for this we first need to make these errors catchable by introducing separate variants into this enum:
You can use the existing InvalidDropFn
variant as a model; it does the same job for invalid drop function pointers in the vtable.
Cc @lqd
Metadata
Metadata
Assignees
Labels
Area: Constant evaluation, covers all const contexts (static, const fn, ...)Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ICE tracked in rust-lang/glacier.