Skip to content

Const sanity checks skips uninhabited arrays #54751

Closed
@RalfJung

Description

@RalfJung

The following should be stopped by the const sanity check:

#![feature(never_type, const_transmute)]

use std::mem;

const TEST: [!; 1] = unsafe { mem::transmute(()) };

But it is not.

The issue is that the sanity check calls is_zst() to skip arrays that could be immediate, but some of those arrays are uninhabited...

Cc @oli-obk

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions