Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
5460b887
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,发现更多精彩内容 >>
提交
5460b887
编写于
2月 06, 2018
作者:
W
Wesley Wiser
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove export_name query
Part of #47320
上级
97b30f09
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
38 addition
and
64 deletion
+38
-64
src/librustc/dep_graph/dep_node.rs
src/librustc/dep_graph/dep_node.rs
+0
-1
src/librustc/hir/mod.rs
src/librustc/hir/mod.rs
+2
-0
src/librustc/ich/impls_hir.rs
src/librustc/ich/impls_hir.rs
+2
-0
src/librustc/ty/maps/mod.rs
src/librustc/ty/maps/mod.rs
+0
-1
src/librustc/ty/maps/plumbing.rs
src/librustc/ty/maps/plumbing.rs
+0
-1
src/librustc_trans_utils/diagnostics.rs
src/librustc_trans_utils/diagnostics.rs
+0
-38
src/librustc_trans_utils/lib.rs
src/librustc_trans_utils/lib.rs
+0
-2
src/librustc_trans_utils/symbol_names.rs
src/librustc_trans_utils/symbol_names.rs
+2
-20
src/librustc_trans_utils/trans_crate.rs
src/librustc_trans_utils/trans_crate.rs
+0
-1
src/librustc_typeck/collect.rs
src/librustc_typeck/collect.rs
+9
-0
src/librustc_typeck/diagnostics.rs
src/librustc_typeck/diagnostics.rs
+23
-0
未找到文件。
src/librustc/dep_graph/dep_node.rs
浏览文件 @
5460b887
...
...
@@ -627,7 +627,6 @@ pub fn fingerprint_needed_for_crate_hash(self) -> bool {
[
input
]
AllCrateNums
,
[]
ExportedSymbols
(
CrateNum
),
[
eval_always
]
CollectAndPartitionTranslationItems
,
[]
ExportName
(
DefId
),
[]
ContainsExternIndicator
(
DefId
),
[]
IsTranslatedItem
(
DefId
),
[]
CodegenUnit
(
InternedString
),
...
...
src/librustc/hir/mod.rs
浏览文件 @
5460b887
...
...
@@ -2216,6 +2216,7 @@ pub fn provide(providers: &mut Providers) {
pub
struct
TransFnAttrs
{
pub
flags
:
TransFnAttrFlags
,
pub
inline
:
InlineAttr
,
pub
export_name
:
Option
<
Symbol
>
,
}
bitflags!
{
...
...
@@ -2234,6 +2235,7 @@ pub fn new() -> TransFnAttrs {
TransFnAttrs
{
flags
:
TransFnAttrFlags
::
empty
(),
inline
:
InlineAttr
::
None
,
export_name
:
None
,
}
}
...
...
src/librustc/ich/impls_hir.rs
浏览文件 @
5460b887
...
...
@@ -1147,10 +1147,12 @@ fn hash_stable<W: StableHasherResult>(&self,
let
hir
::
TransFnAttrs
{
flags
,
inline
,
export_name
,
}
=
*
self
;
flags
.hash_stable
(
hcx
,
hasher
);
inline
.hash_stable
(
hcx
,
hasher
);
export_name
.hash_stable
(
hcx
,
hasher
);
}
}
...
...
src/librustc/ty/maps/mod.rs
浏览文件 @
5460b887
...
...
@@ -363,7 +363,6 @@
[]
fn
collect_and_partition_translation_items
:
collect_and_partition_translation_items_node
(
CrateNum
)
->
(
Arc
<
DefIdSet
>
,
Arc
<
Vec
<
Arc
<
CodegenUnit
<
'tcx
>>>>
),
[]
fn
export_name
:
ExportName
(
DefId
)
->
Option
<
Symbol
>
,
[]
fn
contains_extern_indicator
:
ContainsExternIndicator
(
DefId
)
->
bool
,
[]
fn
symbol_export_level
:
GetSymbolExportLevel
(
DefId
)
->
SymbolExportLevel
,
[]
fn
is_translated_item
:
IsTranslatedItem
(
DefId
)
->
bool
,
...
...
src/librustc/ty/maps/plumbing.rs
浏览文件 @
5460b887
...
...
@@ -926,7 +926,6 @@ pub fn force_from_dep_node<'a, 'gcx, 'lcx>(tcx: TyCtxt<'a, 'gcx, 'lcx>,
DepKind
::
CollectAndPartitionTranslationItems
=>
{
force!
(
collect_and_partition_translation_items
,
LOCAL_CRATE
);
}
DepKind
::
ExportName
=>
{
force!
(
export_name
,
def_id!
());
}
DepKind
::
ContainsExternIndicator
=>
{
force!
(
contains_extern_indicator
,
def_id!
());
}
...
...
src/librustc_trans_utils/diagnostics.rs
已删除
100644 → 0
浏览文件 @
97b30f09
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![allow(non_snake_case)]
register_long_diagnostics!
{
E0558
:
r##"
The `export_name` attribute was malformed.
Erroneous code example:
```ignore (error-emitted-at-codegen-which-cannot-be-handled-by-compile_fail)
#[export_name] // error: export_name attribute has invalid format
pub fn something() {}
fn main() {}
```
The `export_name` attribute expects a string in order to determine the name of
the exported symbol. Example:
```
#[export_name = "some_function"] // ok!
pub fn something() {}
fn main() {}
```
"##
,
}
src/librustc_trans_utils/lib.rs
浏览文件 @
5460b887
...
...
@@ -37,7 +37,6 @@
extern
crate
rustc_back
;
extern
crate
rustc_mir
;
extern
crate
rustc_incremental
;
#[macro_use]
extern
crate
syntax
;
extern
crate
syntax_pos
;
extern
crate
rustc_data_structures
;
...
...
@@ -46,7 +45,6 @@
use
rustc
::
ty
::
TyCtxt
;
pub
mod
diagnostics
;
pub
mod
link
;
pub
mod
trans_crate
;
pub
mod
symbol_names
;
...
...
src/librustc_trans_utils/symbol_names.rs
浏览文件 @
5460b887
...
...
@@ -120,27 +120,9 @@ pub fn provide(providers: &mut Providers) {
def_symbol_name
,
symbol_name
,
export_name
:
|
tcx
,
id
|
{
tcx
.get_attrs
(
id
)
.iter
()
.fold
(
None
,
|
ia
,
attr
|
{
if
attr
.check_name
(
"export_name"
)
{
if
let
s
@
Some
(
_
)
=
attr
.value_str
()
{
s
}
else
{
struct_span_err!
(
tcx
.sess
,
attr
.span
,
E0558
,
"export_name attribute has invalid format"
)
.span_label
(
attr
.span
,
"did you mean #[export_name=
\"
*
\"
]?"
)
.emit
();
None
}
}
else
{
ia
}
})
},
contains_extern_indicator
:
|
tcx
,
id
|
{
attr
::
contains_name
(
&
tcx
.get_attrs
(
id
),
"no_mangle"
)
||
tcx
.
export_name
(
id
)
.is_some
()
tcx
.
trans_fn_attrs
(
id
)
.export_name
.is_some
()
},
..*
providers
...
...
@@ -287,7 +269,7 @@ fn compute_symbol_name<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, instance: Instance
return
tcx
.item_name
(
def_id
)
.to_string
();
}
if
let
Some
(
name
)
=
tcx
.
export_name
(
def_id
)
{
if
let
Some
(
name
)
=
tcx
.
trans_fn_attrs
(
def_id
)
.export_name
{
// Use provided name
return
name
.to_string
();
}
...
...
src/librustc_trans_utils/trans_crate.rs
浏览文件 @
5460b887
...
...
@@ -233,7 +233,6 @@ fn trans_crate<'a, 'tcx>(
MonoItem
::
Fn
(
inst
)
=>
{
let
def_id
=
inst
.def_id
();
if
def_id
.is_local
()
{
let
_
=
tcx
.export_name
(
def_id
);
let
_
=
tcx
.contains_extern_indicator
(
def_id
);
let
_
=
inst
.def
.is_inline
(
tcx
);
let
_
=
tcx
.trans_fn_attrs
(
def_id
);
...
...
src/librustc_typeck/collect.rs
浏览文件 @
5460b887
...
...
@@ -1777,6 +1777,15 @@ fn trans_fn_attrs<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, id: DefId) -> TransFnAt
_
=>
ia
,
}
});
}
else
if
attr
.check_name
(
"export_name"
)
{
if
let
s
@
Some
(
_
)
=
attr
.value_str
()
{
trans_fn_attrs
.export_name
=
s
;
}
else
{
struct_span_err!
(
tcx
.sess
,
attr
.span
,
E0558
,
"export_name attribute has invalid format"
)
.span_label
(
attr
.span
,
"did you mean #[export_name=
\"
*
\"
]?"
)
.emit
();
}
}
}
...
...
src/librustc_typeck/diagnostics.rs
浏览文件 @
5460b887
...
...
@@ -3774,6 +3774,29 @@ fn main() {}
read://doc.rust-lang.org/reference.html#inline-attributes
"##
,
E0558
:
r##"
The `export_name` attribute was malformed.
Erroneous code example:
```ignore (error-emitted-at-codegen-which-cannot-be-handled-by-compile_fail)
#[export_name] // error: export_name attribute has invalid format
pub fn something() {}
fn main() {}
```
The `export_name` attribute expects a string in order to determine the name of
the exported symbol. Example:
```
#[export_name = "some_function"] // ok!
pub fn something() {}
fn main() {}
```
"##
,
E0559
:
r##"
An unknown field was specified into an enum's structure variant.
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录