Closed
Description
STR
#![crate_type = "lib"]
mod mmio {
use std::intrinsics;
pub struct RO<T>(T) where T: Copy;
impl<T> RO<T> where T: Copy {
pub fn get(&self) -> T {
unsafe {
intrinsics::volatile_load(&self.0)
}
}
}
}
struct Gpio {
idr: mmio::RO<Idr>,
}
#[derive(Copy)]
struct Idr(u32);
fn ice(gpio: &Gpio) -> Idr {
gpio.idr.get()
}
Output
rustc: /home/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/llvm/lib/IR/Instructions.cpp:1083: void llvm::StoreInst::AssertOK(): Assertion `getOperand(0)->getType() == cast<PointerType>(getOperand(1)->getType())->getElementType() && "Ptr must be a pointer to Val type!"' failed.
I think this should work given that Idr
is a newtype over a copyable/primitive type.