Skip to content

Commit 69a997b

Browse files
committed
update const_err description
1 parent 5be27b7 commit 69a997b

File tree

1 file changed

+7
-26
lines changed

1 file changed

+7
-26
lines changed

compiler/rustc_lint_defs/src/builtin.rs

+7-26
Original file line numberDiff line numberDiff line change
@@ -238,41 +238,22 @@ declare_lint! {
238238
///
239239
/// ```rust,compile_fail
240240
/// #![allow(unconditional_panic)]
241-
/// let x: &'static i32 = &(1 / 0);
241+
/// const C: i32 = 1/0;
242242
/// ```
243243
///
244244
/// {{produces}}
245245
///
246246
/// ### Explanation
247247
///
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.
252252
///
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
273254
pub CONST_ERR,
274255
Deny,
275-
"constant evaluation detected erroneous expression",
256+
"constant evaluation encountered erroneous expression",
276257
report_in_external_macro
277258
}
278259

0 commit comments

Comments
 (0)