Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
7d23c3bf
R
Rust
项目概览
int
/
Rust
大约 1 年 前同步成功
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
Rust
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
7d23c3bf
编写于
4月 22, 2020
作者:
R
Ralf Jung
提交者:
Felix S. Klock II
4月 24, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
adjust tests
上级
be0e9c2b
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
113 addition
and
133 deletion
+113
-133
src/test/ui/consts/const-eval/ice-generic-assoc-const.rs
src/test/ui/consts/const-eval/ice-generic-assoc-const.rs
+2
-4
src/test/ui/lint/lint-exceeding-bitshifts.noopt.stderr
src/test/ui/lint/lint-exceeding-bitshifts.noopt.stderr
+28
-34
src/test/ui/lint/lint-exceeding-bitshifts.opt.stderr
src/test/ui/lint/lint-exceeding-bitshifts.opt.stderr
+28
-34
src/test/ui/lint/lint-exceeding-bitshifts.opt_with_overflow_checks.stderr
.../lint-exceeding-bitshifts.opt_with_overflow_checks.stderr
+28
-34
src/test/ui/lint/lint-exceeding-bitshifts.rs
src/test/ui/lint/lint-exceeding-bitshifts.rs
+27
-27
未找到文件。
src/test/ui/consts/const-eval/ice-generic-assoc-const.rs
浏览文件 @
7d23c3bf
// check-pass
// build-pass (tests post-monomorphisation failure)
#![crate_type
=
"lib"
]
pub
trait
Nullable
{
const
NULL
:
Self
;
...
...
@@ -13,6 +14,3 @@ fn is_null(&self) -> bool {
*
self
==
Self
::
NULL
}
}
fn
main
()
{
}
src/test/ui/lint/lint-exceeding-bitshifts.noopt.stderr
浏览文件 @
7d23c3bf
warning
: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:
18:20
error
: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:
22:13
|
LL |
const N: i32 = T::N
<< 42;
|
^^^
^^^^^^^ attempt to shift left with overflow
LL |
let _ = x
<< 42;
| ^^^^^^^ attempt to shift left with overflow
|
note: the lint level is defined here
--> $DIR/lint-exceeding-bitshifts.rs:9:9
|
LL | #![
warn
(arithmetic_overflow, const_err)]
LL | #![
deny
(arithmetic_overflow, const_err)]
| ^^^^^^^^^^^^^^^^^^^
warning: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:22:13
|
LL | let _ = x << 42;
| ^^^^^^^ attempt to shift left with overflow
warning: this arithmetic operation will overflow
error: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:27:15
|
LL | let n = 1u8 << 8;
| ^^^^^^^^ attempt to shift left with overflow
warning
: this arithmetic operation will overflow
error
: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:29:15
|
LL | let n = 1u16 << 16;
| ^^^^^^^^^^ attempt to shift left with overflow
warning
: this arithmetic operation will overflow
error
: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:31:15
|
LL | let n = 1u32 << 32;
| ^^^^^^^^^^ attempt to shift left with overflow
warning
: this arithmetic operation will overflow
error
: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:33:15
|
LL | let n = 1u64 << 64;
| ^^^^^^^^^^ attempt to shift left with overflow
warning
: this arithmetic operation will overflow
error
: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:35:15
|
LL | let n = 1i8 << 8;
| ^^^^^^^^ attempt to shift left with overflow
warning
: this arithmetic operation will overflow
error
: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:37:15
|
LL | let n = 1i16 << 16;
| ^^^^^^^^^^ attempt to shift left with overflow
warning
: this arithmetic operation will overflow
error
: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:39:15
|
LL | let n = 1i32 << 32;
| ^^^^^^^^^^ attempt to shift left with overflow
warning
: this arithmetic operation will overflow
error
: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:41:15
|
LL | let n = 1i64 << 64;
| ^^^^^^^^^^ attempt to shift left with overflow
warning
: this arithmetic operation will overflow
error
: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:44:15
|
LL | let n = 1u8 >> 8;
| ^^^^^^^^ attempt to shift right with overflow
warning
: this arithmetic operation will overflow
error
: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:46:15
|
LL | let n = 1u16 >> 16;
| ^^^^^^^^^^ attempt to shift right with overflow
warning
: this arithmetic operation will overflow
error
: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:48:15
|
LL | let n = 1u32 >> 32;
| ^^^^^^^^^^ attempt to shift right with overflow
warning
: this arithmetic operation will overflow
error
: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:50:15
|
LL | let n = 1u64 >> 64;
| ^^^^^^^^^^ attempt to shift right with overflow
warning
: this arithmetic operation will overflow
error
: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:52:15
|
LL | let n = 1i8 >> 8;
| ^^^^^^^^ attempt to shift right with overflow
warning
: this arithmetic operation will overflow
error
: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:54:15
|
LL | let n = 1i16 >> 16;
| ^^^^^^^^^^ attempt to shift right with overflow
warning
: this arithmetic operation will overflow
error
: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:56:15
|
LL | let n = 1i32 >> 32;
| ^^^^^^^^^^ attempt to shift right with overflow
warning
: this arithmetic operation will overflow
error
: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:58:15
|
LL | let n = 1i64 >> 64;
| ^^^^^^^^^^ attempt to shift right with overflow
warning
: this arithmetic operation will overflow
error
: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:62:15
|
LL | let n = n << 8;
| ^^^^^^ attempt to shift left with overflow
warning
: this arithmetic operation will overflow
error
: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:64:15
|
LL | let n = 1u8 << -8;
| ^^^^^^^^^ attempt to shift left with overflow
warning
: this arithmetic operation will overflow
error
: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:69:15
|
LL | let n = 1u8 << (4+4);
| ^^^^^^^^^^^^ attempt to shift left with overflow
warning
: this arithmetic operation will overflow
error
: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:71:15
|
LL | let n = 1i64 >> [64][0];
| ^^^^^^^^^^^^^^^ attempt to shift right with overflow
warning
: this arithmetic operation will overflow
error
: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:77:15
|
LL | let n = 1_isize << BITS;
| ^^^^^^^^^^^^^^^ attempt to shift left with overflow
warning
: this arithmetic operation will overflow
error
: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:78:15
|
LL | let n = 1_usize << BITS;
| ^^^^^^^^^^^^^^^ attempt to shift left with overflow
warning: 24 warnings emitted
error: aborting due to 23 previous errors
src/test/ui/lint/lint-exceeding-bitshifts.opt.stderr
浏览文件 @
7d23c3bf
warning
: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:
18:20
error
: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:
22:13
|
LL |
const N: i32 = T::N
<< 42;
|
^^^
^^^^^^^ attempt to shift left with overflow
LL |
let _ = x
<< 42;
| ^^^^^^^ attempt to shift left with overflow
|
note: the lint level is defined here
--> $DIR/lint-exceeding-bitshifts.rs:9:9
|
LL | #![
warn
(arithmetic_overflow, const_err)]
LL | #![
deny
(arithmetic_overflow, const_err)]
| ^^^^^^^^^^^^^^^^^^^
warning: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:22:13
|
LL | let _ = x << 42;
| ^^^^^^^ attempt to shift left with overflow
warning: this arithmetic operation will overflow
error: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:27:15
|
LL | let n = 1u8 << 8;
| ^^^^^^^^ attempt to shift left with overflow
warning
: this arithmetic operation will overflow
error
: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:29:15
|
LL | let n = 1u16 << 16;
| ^^^^^^^^^^ attempt to shift left with overflow
warning
: this arithmetic operation will overflow
error
: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:31:15
|
LL | let n = 1u32 << 32;
| ^^^^^^^^^^ attempt to shift left with overflow
warning
: this arithmetic operation will overflow
error
: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:33:15
|
LL | let n = 1u64 << 64;
| ^^^^^^^^^^ attempt to shift left with overflow
warning
: this arithmetic operation will overflow
error
: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:35:15
|
LL | let n = 1i8 << 8;
| ^^^^^^^^ attempt to shift left with overflow
warning
: this arithmetic operation will overflow
error
: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:37:15
|
LL | let n = 1i16 << 16;
| ^^^^^^^^^^ attempt to shift left with overflow
warning
: this arithmetic operation will overflow
error
: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:39:15
|
LL | let n = 1i32 << 32;
| ^^^^^^^^^^ attempt to shift left with overflow
warning
: this arithmetic operation will overflow
error
: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:41:15
|
LL | let n = 1i64 << 64;
| ^^^^^^^^^^ attempt to shift left with overflow
warning
: this arithmetic operation will overflow
error
: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:44:15
|
LL | let n = 1u8 >> 8;
| ^^^^^^^^ attempt to shift right with overflow
warning
: this arithmetic operation will overflow
error
: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:46:15
|
LL | let n = 1u16 >> 16;
| ^^^^^^^^^^ attempt to shift right with overflow
warning
: this arithmetic operation will overflow
error
: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:48:15
|
LL | let n = 1u32 >> 32;
| ^^^^^^^^^^ attempt to shift right with overflow
warning
: this arithmetic operation will overflow
error
: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:50:15
|
LL | let n = 1u64 >> 64;
| ^^^^^^^^^^ attempt to shift right with overflow
warning
: this arithmetic operation will overflow
error
: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:52:15
|
LL | let n = 1i8 >> 8;
| ^^^^^^^^ attempt to shift right with overflow
warning
: this arithmetic operation will overflow
error
: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:54:15
|
LL | let n = 1i16 >> 16;
| ^^^^^^^^^^ attempt to shift right with overflow
warning
: this arithmetic operation will overflow
error
: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:56:15
|
LL | let n = 1i32 >> 32;
| ^^^^^^^^^^ attempt to shift right with overflow
warning
: this arithmetic operation will overflow
error
: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:58:15
|
LL | let n = 1i64 >> 64;
| ^^^^^^^^^^ attempt to shift right with overflow
warning
: this arithmetic operation will overflow
error
: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:62:15
|
LL | let n = n << 8;
| ^^^^^^ attempt to shift left with overflow
warning
: this arithmetic operation will overflow
error
: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:64:15
|
LL | let n = 1u8 << -8;
| ^^^^^^^^^ attempt to shift left with overflow
warning
: this arithmetic operation will overflow
error
: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:69:15
|
LL | let n = 1u8 << (4+4);
| ^^^^^^^^^^^^ attempt to shift left with overflow
warning
: this arithmetic operation will overflow
error
: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:71:15
|
LL | let n = 1i64 >> [64][0];
| ^^^^^^^^^^^^^^^ attempt to shift right with overflow
warning
: this arithmetic operation will overflow
error
: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:77:15
|
LL | let n = 1_isize << BITS;
| ^^^^^^^^^^^^^^^ attempt to shift left with overflow
warning
: this arithmetic operation will overflow
error
: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:78:15
|
LL | let n = 1_usize << BITS;
| ^^^^^^^^^^^^^^^ attempt to shift left with overflow
warning: 24 warnings emitted
error: aborting due to 23 previous errors
src/test/ui/lint/lint-exceeding-bitshifts.opt_with_overflow_checks.stderr
浏览文件 @
7d23c3bf
warning
: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:
18:20
error
: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:
22:13
|
LL |
const N: i32 = T::N
<< 42;
|
^^^
^^^^^^^ attempt to shift left with overflow
LL |
let _ = x
<< 42;
| ^^^^^^^ attempt to shift left with overflow
|
note: the lint level is defined here
--> $DIR/lint-exceeding-bitshifts.rs:9:9
|
LL | #![
warn
(arithmetic_overflow, const_err)]
LL | #![
deny
(arithmetic_overflow, const_err)]
| ^^^^^^^^^^^^^^^^^^^
warning: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:22:13
|
LL | let _ = x << 42;
| ^^^^^^^ attempt to shift left with overflow
warning: this arithmetic operation will overflow
error: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:27:15
|
LL | let n = 1u8 << 8;
| ^^^^^^^^ attempt to shift left with overflow
warning
: this arithmetic operation will overflow
error
: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:29:15
|
LL | let n = 1u16 << 16;
| ^^^^^^^^^^ attempt to shift left with overflow
warning
: this arithmetic operation will overflow
error
: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:31:15
|
LL | let n = 1u32 << 32;
| ^^^^^^^^^^ attempt to shift left with overflow
warning
: this arithmetic operation will overflow
error
: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:33:15
|
LL | let n = 1u64 << 64;
| ^^^^^^^^^^ attempt to shift left with overflow
warning
: this arithmetic operation will overflow
error
: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:35:15
|
LL | let n = 1i8 << 8;
| ^^^^^^^^ attempt to shift left with overflow
warning
: this arithmetic operation will overflow
error
: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:37:15
|
LL | let n = 1i16 << 16;
| ^^^^^^^^^^ attempt to shift left with overflow
warning
: this arithmetic operation will overflow
error
: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:39:15
|
LL | let n = 1i32 << 32;
| ^^^^^^^^^^ attempt to shift left with overflow
warning
: this arithmetic operation will overflow
error
: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:41:15
|
LL | let n = 1i64 << 64;
| ^^^^^^^^^^ attempt to shift left with overflow
warning
: this arithmetic operation will overflow
error
: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:44:15
|
LL | let n = 1u8 >> 8;
| ^^^^^^^^ attempt to shift right with overflow
warning
: this arithmetic operation will overflow
error
: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:46:15
|
LL | let n = 1u16 >> 16;
| ^^^^^^^^^^ attempt to shift right with overflow
warning
: this arithmetic operation will overflow
error
: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:48:15
|
LL | let n = 1u32 >> 32;
| ^^^^^^^^^^ attempt to shift right with overflow
warning
: this arithmetic operation will overflow
error
: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:50:15
|
LL | let n = 1u64 >> 64;
| ^^^^^^^^^^ attempt to shift right with overflow
warning
: this arithmetic operation will overflow
error
: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:52:15
|
LL | let n = 1i8 >> 8;
| ^^^^^^^^ attempt to shift right with overflow
warning
: this arithmetic operation will overflow
error
: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:54:15
|
LL | let n = 1i16 >> 16;
| ^^^^^^^^^^ attempt to shift right with overflow
warning
: this arithmetic operation will overflow
error
: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:56:15
|
LL | let n = 1i32 >> 32;
| ^^^^^^^^^^ attempt to shift right with overflow
warning
: this arithmetic operation will overflow
error
: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:58:15
|
LL | let n = 1i64 >> 64;
| ^^^^^^^^^^ attempt to shift right with overflow
warning
: this arithmetic operation will overflow
error
: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:62:15
|
LL | let n = n << 8;
| ^^^^^^ attempt to shift left with overflow
warning
: this arithmetic operation will overflow
error
: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:64:15
|
LL | let n = 1u8 << -8;
| ^^^^^^^^^ attempt to shift left with overflow
warning
: this arithmetic operation will overflow
error
: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:69:15
|
LL | let n = 1u8 << (4+4);
| ^^^^^^^^^^^^ attempt to shift left with overflow
warning
: this arithmetic operation will overflow
error
: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:71:15
|
LL | let n = 1i64 >> [64][0];
| ^^^^^^^^^^^^^^^ attempt to shift right with overflow
warning
: this arithmetic operation will overflow
error
: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:77:15
|
LL | let n = 1_isize << BITS;
| ^^^^^^^^^^^^^^^ attempt to shift left with overflow
warning
: this arithmetic operation will overflow
error
: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:78:15
|
LL | let n = 1_usize << BITS;
| ^^^^^^^^^^^^^^^ attempt to shift left with overflow
warning: 24 warnings emitted
error: aborting due to 23 previous errors
src/test/ui/lint/lint-exceeding-bitshifts.rs
浏览文件 @
7d23c3bf
...
...
@@ -2,11 +2,11 @@
//[noopt]compile-flags: -C opt-level=0
//[opt]compile-flags: -O
//[opt_with_overflow_checks]compile-flags: -C overflow-checks=on -O
// build-pass
//
ignore-pass (test emits codegen-time warnings and verifies that they are not errors)
//
build-fail
#![crate_type=
"lib"
]
#![
warn
(arithmetic_overflow,
const_err)]
#![
deny
(arithmetic_overflow,
const_err)]
#![allow(unused_variables)]
#![allow(dead_code)]
...
...
@@ -15,65 +15,65 @@ pub trait Foo {
}
impl
<
T
:
Foo
>
Foo
for
Vec
<
T
>
{
const
N
:
i32
=
T
::
N
<<
42
;
//
~ WARN: arithmetic operation will overflow
const
N
:
i32
=
T
::
N
<<
42
;
//
FIXME this should warn
}
pub
fn
foo
(
x
:
i32
)
{
let
_
=
x
<<
42
;
//~
WARN
: arithmetic operation will overflow
let
_
=
x
<<
42
;
//~
ERROR
: arithmetic operation will overflow
}
pub
fn
main
()
{
let
n
=
1u8
<<
7
;
let
n
=
1u8
<<
8
;
//~
WARN
: arithmetic operation will overflow
let
n
=
1u8
<<
8
;
//~
ERROR
: arithmetic operation will overflow
let
n
=
1u16
<<
15
;
let
n
=
1u16
<<
16
;
//~
WARN
: arithmetic operation will overflow
let
n
=
1u16
<<
16
;
//~
ERROR
: arithmetic operation will overflow
let
n
=
1u32
<<
31
;
let
n
=
1u32
<<
32
;
//~
WARN
: arithmetic operation will overflow
let
n
=
1u32
<<
32
;
//~
ERROR
: arithmetic operation will overflow
let
n
=
1u64
<<
63
;
let
n
=
1u64
<<
64
;
//~
WARN
: arithmetic operation will overflow
let
n
=
1u64
<<
64
;
//~
ERROR
: arithmetic operation will overflow
let
n
=
1i8
<<
7
;
let
n
=
1i8
<<
8
;
//~
WARN
: arithmetic operation will overflow
let
n
=
1i8
<<
8
;
//~
ERROR
: arithmetic operation will overflow
let
n
=
1i16
<<
15
;
let
n
=
1i16
<<
16
;
//~
WARN
: arithmetic operation will overflow
let
n
=
1i16
<<
16
;
//~
ERROR
: arithmetic operation will overflow
let
n
=
1i32
<<
31
;
let
n
=
1i32
<<
32
;
//~
WARN
: arithmetic operation will overflow
let
n
=
1i32
<<
32
;
//~
ERROR
: arithmetic operation will overflow
let
n
=
1i64
<<
63
;
let
n
=
1i64
<<
64
;
//~
WARN
: arithmetic operation will overflow
let
n
=
1i64
<<
64
;
//~
ERROR
: arithmetic operation will overflow
let
n
=
1u8
>>
7
;
let
n
=
1u8
>>
8
;
//~
WARN
: arithmetic operation will overflow
let
n
=
1u8
>>
8
;
//~
ERROR
: arithmetic operation will overflow
let
n
=
1u16
>>
15
;
let
n
=
1u16
>>
16
;
//~
WARN
: arithmetic operation will overflow
let
n
=
1u16
>>
16
;
//~
ERROR
: arithmetic operation will overflow
let
n
=
1u32
>>
31
;
let
n
=
1u32
>>
32
;
//~
WARN
: arithmetic operation will overflow
let
n
=
1u32
>>
32
;
//~
ERROR
: arithmetic operation will overflow
let
n
=
1u64
>>
63
;
let
n
=
1u64
>>
64
;
//~
WARN
: arithmetic operation will overflow
let
n
=
1u64
>>
64
;
//~
ERROR
: arithmetic operation will overflow
let
n
=
1i8
>>
7
;
let
n
=
1i8
>>
8
;
//~
WARN
: arithmetic operation will overflow
let
n
=
1i8
>>
8
;
//~
ERROR
: arithmetic operation will overflow
let
n
=
1i16
>>
15
;
let
n
=
1i16
>>
16
;
//~
WARN
: arithmetic operation will overflow
let
n
=
1i16
>>
16
;
//~
ERROR
: arithmetic operation will overflow
let
n
=
1i32
>>
31
;
let
n
=
1i32
>>
32
;
//~
WARN
: arithmetic operation will overflow
let
n
=
1i32
>>
32
;
//~
ERROR
: arithmetic operation will overflow
let
n
=
1i64
>>
63
;
let
n
=
1i64
>>
64
;
//~
WARN
: arithmetic operation will overflow
let
n
=
1i64
>>
64
;
//~
ERROR
: arithmetic operation will overflow
let
n
=
1u8
;
let
n
=
n
<<
7
;
let
n
=
n
<<
8
;
//~
WARN
: arithmetic operation will overflow
let
n
=
n
<<
8
;
//~
ERROR
: arithmetic operation will overflow
let
n
=
1u8
<<
-
8
;
//~
WARN
: arithmetic operation will overflow
let
n
=
1u8
<<
-
8
;
//~
ERROR
: arithmetic operation will overflow
let
n
=
1i8
<<
(
1
isize
+-
1
);
let
n
=
1u8
<<
(
4
+
3
);
let
n
=
1u8
<<
(
4
+
4
);
//~
WARN
: arithmetic operation will overflow
let
n
=
1u8
<<
(
4
+
4
);
//~
ERROR
: arithmetic operation will overflow
let
n
=
1i64
>>
[
63
][
0
];
let
n
=
1i64
>>
[
64
][
0
];
//~
WARN
: arithmetic operation will overflow
let
n
=
1i64
>>
[
64
][
0
];
//~
ERROR
: arithmetic operation will overflow
#[cfg(target_pointer_width
=
"32"
)]
const
BITS
:
usize
=
32
;
#[cfg(target_pointer_width
=
"64"
)]
const
BITS
:
usize
=
64
;
let
n
=
1_
isize
<<
BITS
;
//~
WARN
: arithmetic operation will overflow
let
n
=
1_u
size
<<
BITS
;
//~
WARN
: arithmetic operation will overflow
let
n
=
1_
isize
<<
BITS
;
//~
ERROR
: arithmetic operation will overflow
let
n
=
1_u
size
<<
BITS
;
//~
ERROR
: arithmetic operation will overflow
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录