summaryrefslogtreecommitdiffstats
path: root/tests/ui/consts/const-eval/no_lint_for_statically_known_error.rs
blob: 910ca3c4bcbb601ad768722c22ea1a9e7b5d1cbf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// check-pass

// if `X` were used instead of `x`, `X - 10` would result in a lint.
// This file should never produce a lint, no matter how the const
// propagator is improved.

#![deny(warnings)]

const X: u32 = 5;

fn main() {
    let x = X;
    if x > 10 {
        println!("{}", x - 10);
    } else {
        println!("{}", 10 - x);
    }
}