summaryrefslogtreecommitdiff
path: root/compiler/rustc_const_eval/src/transform/check_consts/ops.rs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/rustc_const_eval/src/transform/check_consts/ops.rs')
-rw-r--r--compiler/rustc_const_eval/src/transform/check_consts/ops.rs21
1 files changed, 12 insertions, 9 deletions
diff --git a/compiler/rustc_const_eval/src/transform/check_consts/ops.rs b/compiler/rustc_const_eval/src/transform/check_consts/ops.rs
index 4fb66854571..21f3c2c8917 100644
--- a/compiler/rustc_const_eval/src/transform/check_consts/ops.rs
+++ b/compiler/rustc_const_eval/src/transform/check_consts/ops.rs
@@ -77,7 +77,7 @@ impl<'tcx> NonConstOp<'tcx> for FloatingPointOp {
&ccx.tcx.sess.parse_sess,
sym::const_fn_floating_point_arithmetic,
span,
- &format!("floating point arithmetic is not allowed in {}s", ccx.const_kind()),
+ format!("floating point arithmetic is not allowed in {}s", ccx.const_kind()),
)
}
}
@@ -184,6 +184,9 @@ impl<'tcx> NonConstOp<'tcx> for FnCallNonConst<'tcx> {
CallDesugaringKind::TryBlockFromOutput => {
error!("`try` block cannot convert `{}` to the result in {}s")
}
+ CallDesugaringKind::Await => {
+ error!("cannot convert `{}` into a future in {}s")
+ }
};
diag_trait(&mut err, self_ty, kind.trait_def_id(tcx));
@@ -208,13 +211,13 @@ impl<'tcx> NonConstOp<'tcx> for FnCallNonConst<'tcx> {
err.span_note(span, "function defined here, but it is not `const`");
}
FnPtr(..) => {
- err.note(&format!(
+ err.note(format!(
"function pointers need an RFC before allowed to be called in {}s",
ccx.const_kind()
));
}
Closure(..) => {
- err.note(&format!(
+ err.note(format!(
"closures need an RFC before allowed to be called in {}s",
ccx.const_kind()
));
@@ -286,7 +289,7 @@ impl<'tcx> NonConstOp<'tcx> for FnCallNonConst<'tcx> {
ccx.const_kind()
);
- err.note(&format!("attempting to deref into `{}`", deref_target_ty));
+ err.note(format!("attempting to deref into `{}`", deref_target_ty));
// Check first whether the source is accessible (issue #87060)
if tcx.sess.source_map().is_span_accessible(deref_target) {
@@ -307,14 +310,14 @@ impl<'tcx> NonConstOp<'tcx> for FnCallNonConst<'tcx> {
}),
};
- err.note(&format!(
+ err.note(format!(
"calls in {}s are limited to constant functions, \
tuple structs and tuple variants",
ccx.const_kind(),
));
if let Some(feature) = feature && ccx.tcx.sess.is_nightly_build() {
- err.help(&format!(
+ err.help(format!(
"add `#![feature({})]` to the crate attributes to enable",
feature,
));
@@ -351,7 +354,7 @@ impl<'tcx> NonConstOp<'tcx> for FnCallUnstable {
err.help("const-stable functions can only call other const-stable functions");
} else if ccx.tcx.sess.is_nightly_build() {
if let Some(feature) = feature {
- err.help(&format!(
+ err.help(format!(
"add `#![feature({})]` to the crate attributes to enable",
feature
));
@@ -634,7 +637,7 @@ impl<'tcx> NonConstOp<'tcx> for RawMutPtrDeref {
&ccx.tcx.sess.parse_sess,
sym::const_mut_refs,
span,
- &format!("dereferencing raw mutable pointers in {}s is unstable", ccx.const_kind(),),
+ format!("dereferencing raw mutable pointers in {}s is unstable", ccx.const_kind(),),
)
}
}
@@ -721,7 +724,7 @@ pub mod ty {
&ccx.tcx.sess.parse_sess,
sym::const_mut_refs,
span,
- &format!("mutable references are not allowed in {}s", ccx.const_kind()),
+ format!("mutable references are not allowed in {}s", ccx.const_kind()),
)
}
}