You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Rollup merge of rust-lang#134732 - compiler-errors:unify-conditional-const-error-reporting, r=RalfJung
Unify conditional-const error reporting with non-const error reporting
This PR unifies the error reporting between `ConditionallyConstCall` and `FnCallNonConst` so that the former will refer to syntactical sugar like operators by their sugared name, rather than calling all operators "methods". We achieve this by making the "non-const" part of the error message generic over the "non" part so we can plug in "conditionally" instead.
This should ensure that as we constify traits in the standard library, we don't regress error messages for things like `==`.
r? fmease or reassign
If you really want global mutable state, try using an interior mutable `static` or a `static mut`.
250
233
251
234
const_eval_nested_static_in_thread_local = #[thread_local] does not support implicit nested statics, please create explicit static items and refer to them instead
235
+
236
+
const_eval_non_const_await =
237
+
cannot convert `{$ty}` into a future in {const_eval_const_context}s
238
+
239
+
const_eval_non_const_closure =
240
+
cannot call {$non_or_conditionally}-const closure in {const_eval_const_context}s
241
+
242
+
const_eval_non_const_deref_coercion =
243
+
cannot perform {$non_or_conditionally}-const deref coercion on `{$ty}` in {const_eval_const_context}s
244
+
.note = attempting to deref into `{$target_ty}`
245
+
.target_note = deref defined here
246
+
252
247
const_eval_non_const_fmt_macro_call =
253
-
cannot call non-const formatting macro in {const_eval_const_context}s
248
+
cannot call {$non_or_conditionally}-const formatting macro in {const_eval_const_context}s
254
249
255
250
const_eval_non_const_fn_call =
256
-
cannot call non-const {$def_descr} `{$def_path_str}` in {const_eval_const_context}s
251
+
cannot call {$non_or_conditionally}-const {$def_descr} `{$def_path_str}` in {const_eval_const_context}s
252
+
253
+
const_eval_non_const_for_loop_into_iter =
254
+
cannot use `for` loop on `{$ty}` in {const_eval_const_context}s
257
255
258
256
const_eval_non_const_impl =
259
257
impl defined here, but it is not `const`
260
258
261
259
const_eval_non_const_intrinsic =
262
260
cannot call non-const intrinsic `{$name}` in {const_eval_const_context}s
263
261
262
+
const_eval_non_const_match_eq = cannot match on `{$ty}` in {const_eval_const_context}s
263
+
.note = `{$ty}` cannot be compared in compile-time, and therefore cannot be used in `match`es
264
+
265
+
const_eval_non_const_operator =
266
+
cannot call {$non_or_conditionally}-const operator in {const_eval_const_context}s
267
+
268
+
const_eval_non_const_question_branch =
269
+
`?` is not allowed on `{$ty}` in {const_eval_const_context}s
270
+
const_eval_non_const_question_from_residual =
271
+
`?` is not allowed on `{$ty}` in {const_eval_const_context}s
272
+
273
+
const_eval_non_const_try_block_from_output =
274
+
`try` block cannot convert `{$ty}` to the result in {const_eval_const_context}s
275
+
264
276
const_eval_not_enough_caller_args =
265
277
calling a function with fewer arguments than it requires
0 commit comments