We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
const_fn_transmute
const_fn
1 parent a6008fa commit ebf024bCopy full SHA for ebf024b
compiler/rustc_mir/src/transform/check_consts/ops.rs
@@ -489,7 +489,14 @@ impl NonConstOp for Transmute {
489
}
490
491
fn emit_error(&self, ccx: &ConstCx<'_, '_>, span: Span) {
492
- mcf_emit_error(ccx, span, "can only call `transmute` from const items, not `const fn`");
+ feature_err(
493
+ &ccx.tcx.sess.parse_sess,
494
+ sym::const_fn_transmute,
495
+ span,
496
+ &format!("`transmute` is not allowed in {}s", ccx.const_kind()),
497
+ )
498
+ .note("`transmute` is only allowed in constants and statics for now")
499
+ .emit();
500
501
502
0 commit comments