),
},
ConstantKind::Unevaluated(mir::UnevaluatedConst { def, .. }, _)
- if fx.tcx.is_static(def.did) =>
+ if fx.tcx.is_static(def) =>
{
span_bug!(constant.span, "MIR constant refers to static");
}
_ => unreachable!(),
};
+ // FIXME avoid this extra copy to the stack and directly write to the final
+ // destination
let place = CPlace::new_stack_slot(fx, layout);
place.to_ptr().store(fx, val, MemFlags::trusted());
place.to_cvalue(fx)
attrs.flags.contains(CodegenFnAttrFlags::THREAD_LOCAL),
) {
Ok(data_id) => data_id,
- Err(ModuleError::IncompatibleDeclaration(_)) => tcx.sess.fatal(&format!(
+ Err(ModuleError::IncompatibleDeclaration(_)) => tcx.sess.fatal(format!(
"attempt to declare `{symbol_name}` as static, but it was already declared as function"
)),
Err(err) => Err::<_, _>(err).unwrap(),
attrs.flags.contains(CodegenFnAttrFlags::THREAD_LOCAL),
) {
Ok(data_id) => data_id,
- Err(ModuleError::IncompatibleDeclaration(_)) => tcx.sess.fatal(&format!(
+ Err(ModuleError::IncompatibleDeclaration(_)) => tcx.sess.fatal(format!(
"attempt to declare `{symbol_name}` as static, but it was already declared as function"
)),
Err(err) => Err::<_, _>(err).unwrap(),
if let Some(names) = section_name.split_once(',') {
names
} else {
- tcx.sess.fatal(&format!(
+ tcx.sess.fatal(format!(
"#[link_section = \"{}\"] is not valid for macos target: must be segment and section separated by comma",
section_name
));
GlobalAlloc::Static(def_id) => {
if tcx.codegen_fn_attrs(def_id).flags.contains(CodegenFnAttrFlags::THREAD_LOCAL)
{
- tcx.sess.fatal(&format!(
+ tcx.sess.fatal(format!(
"Allocation {:?} contains reference to TLS value {:?}",
alloc_id, def_id
));