@@ -238,41 +238,22 @@ declare_lint! {
238
238
///
239
239
/// ```rust,compile_fail
240
240
/// #![allow(unconditional_panic)]
241
- /// let x: &'static i32 = &(1 / 0) ;
241
+ /// const C: i32 = 1/0 ;
242
242
/// ```
243
243
///
244
244
/// {{produces}}
245
245
///
246
246
/// ### Explanation
247
247
///
248
- /// This lint detects code that is very likely incorrect. If this lint is
249
- /// allowed, then the code will not be evaluated at compile-time, and
250
- /// instead continue to generate code to evaluate at runtime, which may
251
- /// panic during runtime .
248
+ /// This lint detects constants that fail to evaluate. Allowing the lint will accept the
249
+ /// constant declaration, but any use of this constant will still lead to a hard error. This is
250
+ /// a future incompatibility lint; the plan is to eventually entirely forbid even declaring
251
+ /// constants that cannot be evaluated. See [issue #71800] for more details .
252
252
///
253
- /// Note that this lint may trigger in either inside or outside of a
254
- /// [const context]. Outside of a [const context], the compiler can
255
- /// sometimes evaluate an expression at compile-time in order to generate
256
- /// more efficient code. As the compiler becomes better at doing this, it
257
- /// needs to decide what to do when it encounters code that it knows for
258
- /// certain will panic or is otherwise incorrect. Making this a hard error
259
- /// would prevent existing code that exhibited this behavior from
260
- /// compiling, breaking backwards-compatibility. However, this is almost
261
- /// certainly incorrect code, so this is a deny-by-default lint. For more
262
- /// details, see [RFC 1229] and [issue #28238].
263
- ///
264
- /// Note that there are several other more specific lints associated with
265
- /// compile-time evaluation, such as [`arithmetic_overflow`],
266
- /// [`unconditional_panic`].
267
- ///
268
- /// [const context]: https://doc.rust-lang.org/reference/const_eval.html#const-context
269
- /// [RFC 1229]: https://github.com/rust-lang/rfcs/blob/master/text/1229-compile-time-asserts.md
270
- /// [issue #28238]: https://github.com/rust-lang/rust/issues/28238
271
- /// [`arithmetic_overflow`]: deny-by-default.html#arithmetic-overflow
272
- /// [`unconditional_panic`]: deny-by-default.html#unconditional-panic
253
+ /// [issue #71800]: https://github.com/rust-lang/rust/issues/71800
273
254
pub CONST_ERR ,
274
255
Deny ,
275
- "constant evaluation detected erroneous expression" ,
256
+ "constant evaluation encountered erroneous expression" ,
276
257
report_in_external_macro
277
258
}
278
259
0 commit comments