Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
09bab382
R
Rust
项目概览
int
/
Rust
11 个月 前同步成功
通知
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,发现更多精彩内容 >>
提交
09bab382
编写于
3月 22, 2021
作者:
M
Michael Woerister
提交者:
Michael Woerister
3月 26, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix #83045 by moving some crate loading verification code to a better place.
上级
bba40880
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
44 addition
and
3 deletion
+44
-3
compiler/rustc_metadata/src/creader.rs
compiler/rustc_metadata/src/creader.rs
+8
-3
src/test/run-make-fulldeps/issue-83045/Makefile
src/test/run-make-fulldeps/issue-83045/Makefile
+33
-0
src/test/run-make-fulldeps/issue-83045/a.rs
src/test/run-make-fulldeps/issue-83045/a.rs
+1
-0
src/test/run-make-fulldeps/issue-83045/b.rs
src/test/run-make-fulldeps/issue-83045/b.rs
+1
-0
src/test/run-make-fulldeps/issue-83045/c.rs
src/test/run-make-fulldeps/issue-83045/c.rs
+1
-0
未找到文件。
compiler/rustc_metadata/src/creader.rs
浏览文件 @
09bab382
...
...
@@ -350,7 +350,6 @@ fn register_crate(
let
Library
{
source
,
metadata
}
=
lib
;
let
crate_root
=
metadata
.get_root
();
let
host_hash
=
host_lib
.as_ref
()
.map
(|
lib
|
lib
.metadata
.get_root
()
.hash
());
self
.verify_no_symbol_conflicts
(
&
crate_root
)
?
;
let
private_dep
=
self
.sess.opts.externs
.get
(
&
name
.as_str
())
.map_or
(
false
,
|
e
|
e
.is_private_dep
);
...
...
@@ -358,8 +357,6 @@ fn register_crate(
// Claim this crate number and cache it
let
cnum
=
self
.cstore
.alloc_new_crate_num
();
self
.verify_no_stable_crate_id_hash_conflicts
(
&
crate_root
,
cnum
)
?
;
info!
(
"register crate `{}` (cnum = {}. private_dep = {})"
,
crate_root
.name
(),
...
...
@@ -394,6 +391,14 @@ fn register_crate(
None
};
// Perform some verification *after* resolve_crate_deps() above is
// known to have been successful. It seems that - in error cases - the
// cstore can be in a temporarily invalid state between cnum allocation
// and dependency resolution and the verification code would produce
// ICEs in that case (see #83045).
self
.verify_no_symbol_conflicts
(
&
crate_root
)
?
;
self
.verify_no_stable_crate_id_hash_conflicts
(
&
crate_root
,
cnum
)
?
;
let
crate_metadata
=
CrateMetadata
::
new
(
self
.sess
,
metadata
,
...
...
src/test/run-make-fulldeps/issue-83045/Makefile
0 → 100644
浏览文件 @
09bab382
include
../../run-make-fulldeps/tools.mk
# This test case creates a situation where the crate loader would run
# into an ICE when confronted with an invalid setup where it cannot
# find the dependency of a direct dependency.
#
# The test case makes sure that the compiler produces the expected
# error message but does not ICE immediately after.
#
# See https://github.com/rust-lang/rust/issues/83045
# This is a platform-independent issue, no need to waste time testing
# everywhere.
# only-x86_64
# only-linux
# NOTE: We use BARE_RUSTC below so that the compiler can't find liba.rlib
# If we used RUSTC the additional '-L TMPDIR' option would allow rustc to
# actually find the crate.
#
# We check that we get the expected error message
# But that we do not get an ICE
all
:
$(RUSTC)
--crate-name
=
a
--crate-type
=
rlib a.rs
--verbose
$(RUSTC)
--crate-name
=
b
--crate-type
=
rlib
--extern
a
=
$(TMPDIR)
/liba.rlib b.rs
--verbose
$(BARE_RUSTC)
--out-dir
$(TMPDIR)
\
--extern
b
=
$(TMPDIR)
/libb.rlib
\
--crate-type
=
rlib
\
--edition
=
2018
\
c.rs 2>&1 |
tee
$(TMPDIR)
/output.txt
||
exit
0
$(CGREP)
E0463 <
$(TMPDIR)
/output.txt
$(CGREP)
-v
"internal compiler error"
<
$(TMPDIR)
/output.txt
src/test/run-make-fulldeps/issue-83045/a.rs
0 → 100644
浏览文件 @
09bab382
// empty on purpose
src/test/run-make-fulldeps/issue-83045/b.rs
0 → 100644
浏览文件 @
09bab382
extern
crate
a
;
src/test/run-make-fulldeps/issue-83045/c.rs
0 → 100644
浏览文件 @
09bab382
use
b
as
_
;
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录