Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
6b20f58c
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,发现更多精彩内容 >>
提交
6b20f58c
编写于
5月 18, 2020
作者:
J
Joe Richey
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
miri_unleached: We now allow offset in const fn
Signed-off-by:
N
Joe Richey
<
joerichey@google.com
>
上级
88a37a20
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
6 addition
and
25 deletion
+6
-25
src/test/ui/consts/miri_unleashed/ptr_arith.rs
src/test/ui/consts/miri_unleashed/ptr_arith.rs
+1
-9
src/test/ui/consts/miri_unleashed/ptr_arith.stderr
src/test/ui/consts/miri_unleashed/ptr_arith.stderr
+5
-16
未找到文件。
src/test/ui/consts/miri_unleashed/ptr_arith.rs
浏览文件 @
6b20f58c
...
...
@@ -2,8 +2,7 @@
#![feature(core_intrinsics)]
#![allow(const_err)]
// A test demonstrating that we prevent doing even trivial
// pointer arithmetic or comparison during CTFE.
// During CTFE, we prevent pointer comparison and pointer-to-int casts.
static
CMP
:
()
=
{
let
x
=
&
0
as
*
const
_
;
...
...
@@ -19,11 +18,4 @@
//~| NOTE pointer-to-integer cast
};
static
PTR_ARITH
:
()
=
unsafe
{
let
x
=
&
0
as
*
const
_
;
let
_
v
=
core
::
intrinsics
::
offset
(
x
,
0
);
//~^ ERROR could not evaluate static initializer
//~| NOTE calling intrinsic `offset`
};
fn
main
()
{}
src/test/ui/consts/miri_unleashed/ptr_arith.stderr
浏览文件 @
6b20f58c
error[E0080]: could not evaluate static initializer
--> $DIR/ptr_arith.rs:
10
:14
--> $DIR/ptr_arith.rs:
9
:14
|
LL | let _v = x == x;
| ^^^^^^ "pointer arithmetic or comparison" needs an rfc before being allowed inside constants
error[E0080]: could not evaluate static initializer
--> $DIR/ptr_arith.rs:1
7
:14
--> $DIR/ptr_arith.rs:1
6
:14
|
LL | let _v = x + 0;
| ^^^^^ "pointer-to-integer cast" needs an rfc before being allowed inside constants
error[E0080]: could not evaluate static initializer
--> $DIR/ptr_arith.rs:24:14
|
LL | let _v = core::intrinsics::offset(x, 0);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ "calling intrinsic `offset`" needs an rfc before being allowed inside constants
warning: skipping const checks
|
help: skipping check for `const_compare_raw_pointers` feature
--> $DIR/ptr_arith.rs:
10
:14
--> $DIR/ptr_arith.rs:
9
:14
|
LL | let _v = x == x;
| ^^^^^^
help: skipping check that does not even have a feature gate
--> $DIR/ptr_arith.rs:1
6
:20
--> $DIR/ptr_arith.rs:1
5
:20
|
LL | let x: usize = std::mem::transmute(&0);
| ^^^^^^^^^^^^^^^^^^^^^^^
help: skipping check that does not even have a feature gate
--> $DIR/ptr_arith.rs:24:14
|
LL | let _v = core::intrinsics::offset(x, 0);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to
3
previous errors; 1 warning emitted
error: aborting due to
2
previous errors; 1 warning emitted
For more information about this error, try `rustc --explain E0080`.
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录