Give `MutDeref` a real error message

This commit is contained in:
Dylan MacKenzie 2020-09-29 14:40:14 -07:00
parent de35c4293d
commit b518ccb4c3
1 changed files with 9 additions and 0 deletions

View File

@ -317,6 +317,15 @@ impl NonConstOp for MutDeref {
fn status_in_item(&self, _: &ConstCx<'_, '_>) -> Status {
Status::Unstable(sym::const_mut_refs)
}
fn build_error(&self, ccx: &ConstCx<'_, 'tcx>, span: Span) -> DiagnosticBuilder<'tcx> {
feature_err(
&ccx.tcx.sess.parse_sess,
sym::const_mut_refs,
span,
&format!("mutation through a reference is not allowed in {}s", ccx.const_kind()),
)
}
}
#[derive(Debug)]