Closed
Description
This is a variant of #68304 that was not fixed by #71170:
#![feature(unsized_locals)]
use std::any::Any;
#[repr(align(256))]
#[allow(dead_code)]
struct A {
v: u8
}
impl A {
fn f(&self) -> *const A {
assert_eq!(self as *const A as usize % 256, 0);
self
}
}
fn mk() -> Box<dyn Any> {
Box::new(A { v: 4 })
}
fn main() {
let x = *mk();
let dwncst = x.downcast_ref::<A>().unwrap();
let addr = dwncst.f();
assert_eq!(addr as usize % 256, 0);
}
still fails with
thread 'main' panicked at 'assertion failed: `(left == right)`
left: `176`,
right: `0`', align.rs:13:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace