Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
b283aaf0
R
Rust
项目概览
int
/
Rust
12 个月 前同步成功
通知
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,发现更多精彩内容 >>
提交
b283aaf0
编写于
10月 18, 2016
作者:
J
Jeffrey Seyfried
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Future proof `#[no_link]`.
上级
0c429872
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
13 addition
and
7 deletion
+13
-7
src/librustc_metadata/macro_import.rs
src/librustc_metadata/macro_import.rs
+9
-2
src/librustc_resolve/build_reduced_graph.rs
src/librustc_resolve/build_reduced_graph.rs
+1
-1
src/test/compile-fail-fulldeps/macro-crate-doesnt-resolve.rs
src/test/compile-fail-fulldeps/macro-crate-doesnt-resolve.rs
+1
-2
src/test/compile-fail-fulldeps/no-link-unknown-crate.rs
src/test/compile-fail-fulldeps/no-link-unknown-crate.rs
+1
-1
src/test/compile-fail/no-link.rs
src/test/compile-fail/no-link.rs
+1
-1
未找到文件。
src/librustc_metadata/macro_import.rs
浏览文件 @
b283aaf0
...
...
@@ -52,6 +52,7 @@ fn load_crate(&mut self,
// Parse the attributes relating to macros.
let
mut
import
=
ImportSelection
::
Some
(
FnvHashMap
());
let
mut
reexport
=
FnvHashMap
();
let
mut
no_link
=
false
;
for
attr
in
&
extern_crate
.attrs
{
let
mut
used
=
true
;
...
...
@@ -87,6 +88,7 @@ fn load_crate(&mut self,
}
}
}
"no_link"
=>
no_link
=
true
,
_
=>
used
=
false
,
}
if
used
{
...
...
@@ -94,17 +96,22 @@ fn load_crate(&mut self,
}
}
self
.load_macros
(
extern_crate
,
allows_macros
,
import
,
reexport
)
self
.load_macros
(
extern_crate
,
allows_macros
,
import
,
reexport
,
no_link
)
}
fn
load_macros
<
'b
>
(
&
mut
self
,
vi
:
&
ast
::
Item
,
allows_macros
:
bool
,
import
:
ImportSelection
,
reexport
:
MacroSelection
)
reexport
:
MacroSelection
,
no_link
:
bool
)
->
Vec
<
LoadedMacro
>
{
if
let
ImportSelection
::
Some
(
ref
sel
)
=
import
{
if
sel
.is_empty
()
&&
reexport
.is_empty
()
{
// Make sure we can read macros from `#[no_link]` crates.
if
no_link
{
self
.creader
.read_macros
(
vi
);
}
return
Vec
::
new
();
}
}
...
...
src/librustc_resolve/build_reduced_graph.rs
浏览文件 @
b283aaf0
...
...
@@ -250,7 +250,7 @@ fn build_reduced_graph_for_item(&mut self, item: &Item, expansion: Mark) {
self
.define
(
parent
,
name
,
TypeNS
,
(
module
,
sp
,
vis
));
self
.populate_module_if_necessary
(
module
);
}
else
if
custom_derive_crate
{
}
else
{
// Define an empty module
let
def
=
Def
::
Mod
(
self
.definitions
.local_def_id
(
item
.id
));
let
module
=
ModuleS
::
new
(
Some
(
parent
),
ModuleKind
::
Def
(
def
,
name
));
...
...
src/test/compile-fail-fulldeps/macro-crate-doesnt-resolve.rs
浏览文件 @
b283aaf0
...
...
@@ -14,6 +14,5 @@
extern
crate
macro_crate_test
;
fn
main
()
{
macro_crate_test
::
foo
();
//~^ ERROR failed to resolve. Use of undeclared type or module `macro_crate_test`
macro_crate_test
::
foo
();
//~ ERROR unresolved name
}
src/test/compile-fail-fulldeps/
macro-crate
-unknown-crate.rs
→
src/test/compile-fail-fulldeps/
no-link
-unknown-crate.rs
浏览文件 @
b283aaf0
...
...
@@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#[
macro_use]
#[
no_link]
#[no_link]
extern
crate
doesnt_exist
;
//~ ERROR can't find crate
fn
main
()
{}
src/test/compile-fail/no-link.rs
浏览文件 @
b283aaf0
...
...
@@ -13,6 +13,6 @@
fn
main
()
{
unsafe
{
libc
::
abs
(
0
);
//~ ERROR
Use of undeclared type or module `libc`
libc
::
abs
(
0
);
//~ ERROR
unresolved name
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录