From e4e0f959ce23a6a7c33f0178b1c03d1ca19f3746 Mon Sep 17 00:00:00 2001 From: Mazdak Farrokhzad Date: Wed, 12 Jun 2019 22:53:00 +0200 Subject: [PATCH] promoted_errors: warn -> deny. --- .../ui/consts/const-eval/promoted_errors.rs | 24 ++++++----- .../consts/const-eval/promoted_errors.stderr | 42 ++++++++++--------- 2 files changed, 36 insertions(+), 30 deletions(-) diff --git a/src/test/ui/consts/const-eval/promoted_errors.rs b/src/test/ui/consts/const-eval/promoted_errors.rs index ebf80e7d2e67..fa8859cbb3bb 100644 --- a/src/test/ui/consts/const-eval/promoted_errors.rs +++ b/src/test/ui/consts/const-eval/promoted_errors.rs @@ -1,19 +1,23 @@ -#![warn(const_err)] - -// compile-pass // compile-flags: -O + +#![deny(const_err)] + fn main() { println!("{}", 0u32 - 1); let _x = 0u32 - 1; - //~^ WARN const_err + //~^ ERROR this expression will panic at runtime [const_err] println!("{}", 1/(1-1)); - //~^ WARN const_err + //~^ ERROR this expression will panic at runtime [const_err] + //~| ERROR attempt to divide by zero [const_err] + //~| ERROR reaching this expression at runtime will panic or abort [const_err] let _x = 1/(1-1); - //~^ WARN const_err - //~| WARN const_err + //~^ ERROR const_err + //~| ERROR const_err println!("{}", 1/(false as u32)); - //~^ WARN const_err + //~^ ERROR this expression will panic at runtime [const_err] + //~| ERROR attempt to divide by zero [const_err] + //~| ERROR reaching this expression at runtime will panic or abort [const_err] let _x = 1/(false as u32); - //~^ WARN const_err - //~| WARN const_err + //~^ ERROR const_err + //~| ERROR const_err } diff --git a/src/test/ui/consts/const-eval/promoted_errors.stderr b/src/test/ui/consts/const-eval/promoted_errors.stderr index c9f3a7659f9c..12407accf096 100644 --- a/src/test/ui/consts/const-eval/promoted_errors.stderr +++ b/src/test/ui/consts/const-eval/promoted_errors.stderr @@ -1,72 +1,74 @@ -warning: this expression will panic at runtime +error: this expression will panic at runtime --> $DIR/promoted_errors.rs:7:14 | LL | let _x = 0u32 - 1; | ^^^^^^^^ attempt to subtract with overflow | note: lint level defined here - --> $DIR/promoted_errors.rs:1:9 + --> $DIR/promoted_errors.rs:3:9 | -LL | #![warn(const_err)] +LL | #![deny(const_err)] | ^^^^^^^^^ -warning: attempt to divide by zero +error: attempt to divide by zero --> $DIR/promoted_errors.rs:9:20 | LL | println!("{}", 1/(1-1)); | ^^^^^^^ -warning: this expression will panic at runtime +error: this expression will panic at runtime --> $DIR/promoted_errors.rs:9:20 | LL | println!("{}", 1/(1-1)); | ^^^^^^^ attempt to divide by zero -warning: attempt to divide by zero - --> $DIR/promoted_errors.rs:11:14 +error: attempt to divide by zero + --> $DIR/promoted_errors.rs:13:14 | LL | let _x = 1/(1-1); | ^^^^^^^ -warning: this expression will panic at runtime - --> $DIR/promoted_errors.rs:11:14 +error: this expression will panic at runtime + --> $DIR/promoted_errors.rs:13:14 | LL | let _x = 1/(1-1); | ^^^^^^^ attempt to divide by zero -warning: attempt to divide by zero - --> $DIR/promoted_errors.rs:14:20 +error: attempt to divide by zero + --> $DIR/promoted_errors.rs:16:20 | LL | println!("{}", 1/(false as u32)); | ^^^^^^^^^^^^^^^^ -warning: this expression will panic at runtime - --> $DIR/promoted_errors.rs:14:20 +error: this expression will panic at runtime + --> $DIR/promoted_errors.rs:16:20 | LL | println!("{}", 1/(false as u32)); | ^^^^^^^^^^^^^^^^ attempt to divide by zero -warning: attempt to divide by zero - --> $DIR/promoted_errors.rs:16:14 +error: attempt to divide by zero + --> $DIR/promoted_errors.rs:20:14 | LL | let _x = 1/(false as u32); | ^^^^^^^^^^^^^^^^ -warning: this expression will panic at runtime - --> $DIR/promoted_errors.rs:16:14 +error: this expression will panic at runtime + --> $DIR/promoted_errors.rs:20:14 | LL | let _x = 1/(false as u32); | ^^^^^^^^^^^^^^^^ attempt to divide by zero -warning: reaching this expression at runtime will panic or abort - --> $DIR/promoted_errors.rs:14:20 +error: reaching this expression at runtime will panic or abort + --> $DIR/promoted_errors.rs:16:20 | LL | println!("{}", 1/(false as u32)); | ^^^^^^^^^^^^^^^^ attempt to divide by zero -warning: reaching this expression at runtime will panic or abort +error: reaching this expression at runtime will panic or abort --> $DIR/promoted_errors.rs:9:20 | LL | println!("{}", 1/(1-1)); | ^^^^^^^ attempt to divide by zero +error: aborting due to 11 previous errors +