Suggest const_mut_refs for mutable references in const fn
This commit is contained in:
@@ -535,6 +535,7 @@ impl NonConstOp for UnsizingCast {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Types that cannot appear in the signature or locals of a `const fn`.
|
||||||
pub mod ty {
|
pub mod ty {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
@@ -548,7 +549,13 @@ pub mod ty {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn emit_error(&self, ccx: &ConstCx<'_, '_>, span: Span) {
|
fn emit_error(&self, ccx: &ConstCx<'_, '_>, span: Span) {
|
||||||
mcf_emit_error(ccx, span, "mutable references in const fn are unstable");
|
feature_err(
|
||||||
|
&ccx.tcx.sess.parse_sess,
|
||||||
|
sym::const_mut_refs,
|
||||||
|
span,
|
||||||
|
&format!("mutable references are not allowed in {}s", ccx.const_kind()),
|
||||||
|
)
|
||||||
|
.emit()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user