// option. This file may not be copied, modified, or distributed
// except according to those terms.
+use back::abi;
use middle::ty::{Ty, HasTypeFlags};
use rustc::middle::const_eval::ConstVal;
use rustc::mir::repr as mir;
let val = consts::trans_constval(bcx, cv, ty, bcx.fcx.param_substs);
let val = if common::type_is_immediate(ccx, ty) {
OperandValue::Immediate(val)
+ } else if common::type_is_fat_ptr(bcx.tcx(), ty) {
+ let data = common::const_get_elt(ccx, val, &[abi::FAT_PTR_ADDR as u32]);
+ let extra = common::const_get_elt(ccx, val, &[abi::FAT_PTR_EXTRA as u32]);
+ OperandValue::FatPtr(data, extra)
} else {
OperandValue::Ref(val)
};
*b = a;
}
+#[rustc_mir]
+fn fat_ptr_constant() -> &'static str {
+ "HELLO"
+}
+
fn main() {
let a = Wrapper(4, [7,6,5]);
let mut target : &[u8] = &[42];
fat_ptr_store_to(p, &mut target);
assert_eq!(target, &a.1);
+
+ assert_eq!(fat_ptr_constant(), "HELLO");
}