diff options
Diffstat (limited to 'tests/ui/consts/const-eval/no_lint_for_statically_known_error.rs')
-rw-r--r-- | tests/ui/consts/const-eval/no_lint_for_statically_known_error.rs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/ui/consts/const-eval/no_lint_for_statically_known_error.rs b/tests/ui/consts/const-eval/no_lint_for_statically_known_error.rs new file mode 100644 index 000000000..910ca3c4b --- /dev/null +++ b/tests/ui/consts/const-eval/no_lint_for_statically_known_error.rs @@ -0,0 +1,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); + } +} |