add test for issue 69020

This commit is contained in:
Ralf Jung 2020-02-15 11:00:14 +01:00
parent 9c7639492f
commit 4b8c784968
5 changed files with 57 additions and 0 deletions

View file

@ -0,0 +1,10 @@
error: this arithmetic operation will overflow
--> $DIR/issue-69020.rs:15:20
|
LL | const N: i32 = -i32::MIN + T::N;
| ^^^^^^^^^ attempt to negate with overflow
|
= note: `#[deny(overflow)]` on by default
error: aborting due to previous error

View file

@ -0,0 +1,10 @@
error: this arithmetic operation will overflow
--> $DIR/issue-69020.rs:15:20
|
LL | const N: i32 = -i32::MIN + T::N;
| ^^^^^^^^^ attempt to negate with overflow
|
= note: `#[deny(overflow)]` on by default
error: aborting due to previous error

View file

@ -0,0 +1,10 @@
error: this arithmetic operation will overflow
--> $DIR/issue-69020.rs:15:20
|
LL | const N: i32 = -i32::MIN + T::N;
| ^^^^^^^^^ attempt to negate with overflow
|
= note: `#[deny(overflow)]` on by default
error: aborting due to previous error

View file

@ -0,0 +1,10 @@
error: this arithmetic operation will overflow
--> $DIR/issue-69020.rs:15:20
|
LL | const N: i32 = -i32::MIN + T::N;
| ^^^^^^^^^ attempt to negate with overflow
|
= note: `#[deny(overflow)]` on by default
error: aborting due to previous error

View file

@ -0,0 +1,17 @@
// revisions: default noopt opt opt_with_overflow_checks
//[noopt]compile-flags: -C opt-level=0
//[opt]compile-flags: -O
//[opt_with_overflow_checks]compile-flags: -C overflow-checks=on -O
#![crate_type="lib"]
use std::i32;
pub trait Foo {
const N: i32;
}
impl<T: Foo> Foo for Vec<T> {
const N: i32 = -i32::MIN + T::N;
//~^ ERROR arithmetic operation will overflow
}