Skip to content

Commit bb70305

Browse files
authored
Rollup merge of #80578 - RalfJung:panic-lint-description, r=lcnr
improve unconditional_panic description The fact that the lint is triggered by the ConstProp pass is an implementation detail, I do not think that this should be mentioned in the description. Cc `@oli-obk` `@ehuss`
2 parents 4890c06 + b31400a commit bb70305

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

compiler/rustc_lint_defs/src/builtin.rs

+4-8
Original file line numberDiff line numberDiff line change
@@ -221,14 +221,10 @@ declare_lint! {
221221
///
222222
/// ### Explanation
223223
///
224-
/// This lint detects code that is very likely incorrect. When possible,
225-
/// the compiler will attempt to detect situations where code can be
226-
/// evaluated at compile-time to generate more efficient code. While
227-
/// evaluating such code, if it detects that the code will unconditionally
228-
/// panic, this usually indicates that it is doing something incorrectly.
229-
/// If this lint is allowed, then the code will not be evaluated at
230-
/// compile-time, and instead continue to generate code to evaluate at
231-
/// runtime, which may panic during runtime.
224+
/// This lint detects code that is very likely incorrect because it will
225+
/// always panic, such as division by zero and out-of-bounds array
226+
/// accesses. Consider adjusting your code if this is a bug, or using the
227+
/// `panic!` or `unreachable!` macro instead in case the panic is intended.
232228
pub UNCONDITIONAL_PANIC,
233229
Deny,
234230
"operation will cause a panic at runtime"

0 commit comments

Comments
 (0)