summaryrefslogtreecommitdiffstats
path: root/src/test/ui/consts/const-eval/promoted_errors.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/consts/const-eval/promoted_errors.rs')
-rw-r--r--src/test/ui/consts/const-eval/promoted_errors.rs25
1 files changed, 3 insertions, 22 deletions
diff --git a/src/test/ui/consts/const-eval/promoted_errors.rs b/src/test/ui/consts/const-eval/promoted_errors.rs
index eb891de33..2c42d0356 100644
--- a/src/test/ui/consts/const-eval/promoted_errors.rs
+++ b/src/test/ui/consts/const-eval/promoted_errors.rs
@@ -8,20 +8,16 @@
//! This test ensures that when we promote code that fails to evaluate, the build still succeeds.
-#![warn(const_err, arithmetic_overflow, unconditional_panic)]
+#![warn(arithmetic_overflow, unconditional_panic)]
// The only way to have promoteds that fail is in `const fn` called from `const`/`static`.
const fn overflow() -> u32 {
0 - 1
- //[opt_with_overflow_checks,noopt]~^ WARN any use of this value will cause an error
- //[opt_with_overflow_checks,noopt]~| WARN this was previously accepted by the compiler
- //~^^^ WARN this arithmetic operation will overflow
+ //~^ WARN this arithmetic operation will overflow
}
const fn div_by_zero1() -> i32 {
1 / 0
- //[opt]~^ WARN any use of this value will cause an error
- //[opt]~| WARN this was previously accepted by the compiler but is being phased out
- //~^^^ WARN this operation will panic at runtime
+ //~^ WARN this operation will panic at runtime
}
const fn div_by_zero2() -> i32 {
1 / (1 - 1)
@@ -36,21 +32,6 @@ const fn oob() -> i32 {
//~^ WARN this operation will panic at runtime
}
-// An unused constant containing failing promoteds.
-// This should work as long as `const_err` can be turned into just a warning;
-// once it turns into a hard error, just remove `X`.
-const X: () = {
- let _x: &'static u32 = &overflow();
- //[opt_with_overflow_checks,noopt]~^ WARN any use of this value will cause an error
- //[opt_with_overflow_checks,noopt]~| WARN this was previously accepted by the compiler
- let _x: &'static i32 = &div_by_zero1();
- //[opt]~^ WARN any use of this value will cause an error
- //[opt]~| WARN this was previously accepted by the compiler but is being phased out
- let _x: &'static i32 = &div_by_zero2();
- let _x: &'static i32 = &div_by_zero3();
- let _x: &'static i32 = &oob();
-};
-
const fn mk_false() -> bool { false }
// An actually used constant referencing failing promoteds in dead code.