Suggest const_fn_transmute instead of const_fn

This commit is contained in:
Dylan MacKenzie 2020-09-24 11:11:53 -07:00
parent a6008fac97
commit ebf024bba8

View File

@ -489,7 +489,14 @@ fn status_in_item(&self, ccx: &ConstCx<'_, '_>) -> Status {
}
fn emit_error(&self, ccx: &ConstCx<'_, '_>, span: Span) {
mcf_emit_error(ccx, span, "can only call `transmute` from const items, not `const fn`");
feature_err(
&ccx.tcx.sess.parse_sess,
sym::const_fn_transmute,
span,
&format!("`transmute` is not allowed in {}s", ccx.const_kind()),
)
.note("`transmute` is only allowed in constants and statics for now")
.emit();
}
}