2024-02-19 11:35:12 -06:00
|
|
|
//! Check that `vtable_size` gets overridden by llvm backend even if there is no
|
|
|
|
//! `rustc_intrinsic_must_be_overridden` attribute on this usage.
|
2024-11-07 01:59:43 -06:00
|
|
|
#![feature(intrinsics)]
|
2024-02-19 11:35:12 -06:00
|
|
|
//@run-pass
|
|
|
|
|
|
|
|
#[rustc_intrinsic]
|
|
|
|
pub unsafe fn vtable_size(_ptr: *const ()) -> usize {
|
|
|
|
panic!();
|
|
|
|
}
|
|
|
|
|
|
|
|
trait Trait {}
|
|
|
|
impl Trait for () {}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let x: &dyn Trait = &();
|
|
|
|
unsafe {
|
|
|
|
let (_data, vtable): (*const (), *const ()) = core::mem::transmute(x);
|
|
|
|
assert_eq!(vtable_size(vtable), 0);
|
|
|
|
}
|
|
|
|
}
|