]> git.lizzy.rs Git - rust.git/blob - tests/ui/consts/const-eval/no_lint_for_statically_known_error.rs
Merge commit '598f0909568a51de8a2d1148f55a644fd8dffad0' into sync_cg_clif-2023-01-24
[rust.git] / tests / ui / consts / const-eval / no_lint_for_statically_known_error.rs
1 // check-pass
2
3 // if `X` were used instead of `x`, `X - 10` would result in a lint.
4 // This file should never produce a lint, no matter how the const
5 // propagator is improved.
6
7 #![deny(warnings)]
8
9 const X: u32 = 5;
10
11 fn main() {
12     let x = X;
13     if x > 10 {
14         println!("{}", x - 10);
15     } else {
16         println!("{}", 10 - x);
17     }
18 }