Open DianQK opened 4 days ago
@rustbot label -needs-triage
It's less about the niche and more about the enum. The logic that computes the attribute has to just stop at the enum.
An argument of type RestrictedAddress
should still get the attribute.
While looking into this I noticed that
#![feature(rustc_attrs)]
#![allow(internal_features)]
#![allow(dead_code)]
#[rustc_layout_scalar_valid_range_start(1)]
#[rustc_layout_scalar_valid_range_end(0xfffffffffffffff0)]
pub struct RestrictedAddress(&'static i8);
enum E {
A(RestrictedAddress),
B,
C,
}
fn main() {
std::hint::black_box(E::B);
}
causes a debug-only ICE (only allows integer types in const_uint_big
) when codegenning the discriminant set.
causes a debug-only ICE (
only allows integer types in const_uint_big
) when codegenning the discriminant set.
Considering the following code, it should print 0 with a release build, but I get a segmentation violation.
This is because we are adding the
dereferenceable
attribute, which allows LLVM to hoist the load instruction. In this case, we need to drop thedereferenceable
attribute.@rustbot label +requires-nightly +I-miscompile +A-codegen