add test for issue 69020
This commit is contained in:
parent
9c7639492f
commit
4b8c784968
5 changed files with 57 additions and 0 deletions
10
src/test/ui/consts/issue-69020.default.stderr
Normal file
10
src/test/ui/consts/issue-69020.default.stderr
Normal 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
|
||||
|
||||
10
src/test/ui/consts/issue-69020.noopt.stderr
Normal file
10
src/test/ui/consts/issue-69020.noopt.stderr
Normal 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
|
||||
|
||||
10
src/test/ui/consts/issue-69020.opt.stderr
Normal file
10
src/test/ui/consts/issue-69020.opt.stderr
Normal 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
|
||||
|
||||
|
|
@ -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
|
||||
|
||||
17
src/test/ui/consts/issue-69020.rs
Normal file
17
src/test/ui/consts/issue-69020.rs
Normal 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
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue