Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
47ee538a
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,发现更多精彩内容 >>
提交
47ee538a
编写于
3月 09, 2019
作者:
V
Vadim Petrochenkov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
resolve: Account for new importable entities
上级
52e88562
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
49 addition
and
11 deletion
+49
-11
src/librustc_resolve/build_reduced_graph.rs
src/librustc_resolve/build_reduced_graph.rs
+7
-11
src/test/ui/rust-2018/uniform-paths/auxiliary/cross-crate.rs
src/test/ui/rust-2018/uniform-paths/auxiliary/cross-crate.rs
+5
-0
src/test/ui/rust-2018/uniform-paths/cross-crate.rs
src/test/ui/rust-2018/uniform-paths/cross-crate.rs
+11
-0
src/test/ui/rust-2018/uniform-paths/cross-crate.stderr
src/test/ui/rust-2018/uniform-paths/cross-crate.stderr
+26
-0
未找到文件。
src/librustc_resolve/build_reduced_graph.rs
浏览文件 @
47ee538a
...
...
@@ -636,10 +636,9 @@ fn build_reduced_graph_for_external_crate_def(&mut self, parent: Module<'a>, chi
// but metadata cannot encode gensyms currently, so we create it here.
// This is only a guess, two equivalent idents may incorrectly get different gensyms here.
let
ident
=
ident
.gensym_if_underscore
();
let
def_id
=
def
.def_id
();
let
expansion
=
Mark
::
root
();
// FIXME(jseyfried) intercrate hygiene
match
def
{
Def
::
Mod
(
..
)
|
Def
::
Enum
(
..
)
=>
{
Def
::
Mod
(
def_id
)
|
Def
::
Enum
(
def_id
)
=>
{
let
module
=
self
.new_module
(
parent
,
ModuleKind
::
Def
(
def
,
ident
.name
),
def_id
,
...
...
@@ -647,13 +646,14 @@ fn build_reduced_graph_for_external_crate_def(&mut self, parent: Module<'a>, chi
span
);
self
.define
(
parent
,
ident
,
TypeNS
,
(
module
,
vis
,
DUMMY_SP
,
expansion
));
}
Def
::
Variant
(
..
)
|
Def
::
TyAlias
(
..
)
|
Def
::
ForeignTy
(
..
)
=>
{
Def
::
Variant
(
..
)
|
Def
::
TyAlias
(
..
)
|
Def
::
ForeignTy
(
..
)
|
Def
::
Existential
(
..
)
|
Def
::
TraitAlias
(
..
)
|
Def
::
PrimTy
(
..
)
|
Def
::
ToolMod
=>
{
self
.define
(
parent
,
ident
,
TypeNS
,
(
def
,
vis
,
DUMMY_SP
,
expansion
));
}
Def
::
Fn
(
..
)
|
Def
::
Static
(
..
)
|
Def
::
Const
(
..
)
|
Def
::
VariantCtor
(
..
)
=>
{
self
.define
(
parent
,
ident
,
ValueNS
,
(
def
,
vis
,
DUMMY_SP
,
expansion
));
}
Def
::
StructCtor
(
..
)
=>
{
Def
::
StructCtor
(
def_id
,
..
)
=>
{
self
.define
(
parent
,
ident
,
ValueNS
,
(
def
,
vis
,
DUMMY_SP
,
expansion
));
if
let
Some
(
struct_def_id
)
=
...
...
@@ -662,7 +662,7 @@ fn build_reduced_graph_for_external_crate_def(&mut self, parent: Module<'a>, chi
self
.struct_constructors
.insert
(
struct_def_id
,
(
def
,
vis
));
}
}
Def
::
Trait
(
..
)
=>
{
Def
::
Trait
(
def_id
)
=>
{
let
module_kind
=
ModuleKind
::
Def
(
def
,
ident
.name
);
let
module
=
self
.new_module
(
parent
,
module_kind
,
...
...
@@ -683,18 +683,14 @@ fn build_reduced_graph_for_external_crate_def(&mut self, parent: Module<'a>, chi
}
module
.populated
.set
(
true
);
}
Def
::
Existential
(
..
)
|
Def
::
TraitAlias
(
..
)
=>
{
self
.define
(
parent
,
ident
,
TypeNS
,
(
def
,
vis
,
DUMMY_SP
,
expansion
));
}
Def
::
Struct
(
..
)
|
Def
::
Union
(
..
)
=>
{
Def
::
Struct
(
def_id
)
|
Def
::
Union
(
def_id
)
=>
{
self
.define
(
parent
,
ident
,
TypeNS
,
(
def
,
vis
,
DUMMY_SP
,
expansion
));
// Record field names for error reporting.
let
field_names
=
self
.cstore
.struct_field_names_untracked
(
def_id
);
self
.insert_field_names
(
def_id
,
field_names
);
}
Def
::
Macro
(
..
)
=>
{
Def
::
Macro
(
..
)
|
Def
::
NonMacroAttr
(
..
)
=>
{
self
.define
(
parent
,
ident
,
MacroNS
,
(
def
,
vis
,
DUMMY_SP
,
expansion
));
}
_
=>
bug!
(
"unexpected definition: {:?}"
,
def
)
...
...
src/test/ui/rust-2018/uniform-paths/auxiliary/cross-crate.rs
0 → 100644
浏览文件 @
47ee538a
// edition:2018
pub
use
ignore
as
built_in_attr
;
pub
use
u8
as
built_in_type
;
pub
use
rustfmt
as
tool_mod
;
src/test/ui/rust-2018/uniform-paths/cross-crate.rs
0 → 100644
浏览文件 @
47ee538a
// edition:2018
// aux-build:cross-crate.rs
extern
crate
cross_crate
;
use
cross_crate
::
*
;
#[built_in_attr]
//~ ERROR cannot use a built-in attribute through an import
#[tool_mod::skip]
//~ ERROR cannot use a tool module through an import
fn
main
()
{
let
_
:
built_in_type
;
// OK
}
src/test/ui/rust-2018/uniform-paths/cross-crate.stderr
0 → 100644
浏览文件 @
47ee538a
error: cannot use a built-in attribute through an import
--> $DIR/cross-crate.rs:7:3
|
LL | #[built_in_attr]
| ^^^^^^^^^^^^^
|
note: the built-in attribute imported here
--> $DIR/cross-crate.rs:5:5
|
LL | use cross_crate::*;
| ^^^^^^^^^^^^^^
error: cannot use a tool module through an import
--> $DIR/cross-crate.rs:8:3
|
LL | #[tool_mod::skip]
| ^^^^^^^^
|
note: the tool module imported here
--> $DIR/cross-crate.rs:5:5
|
LL | use cross_crate::*;
| ^^^^^^^^^^^^^^
error: aborting due to 2 previous errors
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录