Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
e534b565
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,发现更多精彩内容 >>
提交
e534b565
编写于
1月 31, 2014
作者:
P
Patrick Walton
提交者:
Huon Wilson
2月 02, 2014
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
librustc: Remove uses of `token::ident_to_str()` from librustc
上级
344040d4
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
42 addition
and
20 deletion
+42
-20
src/librustc/front/feature_gate.rs
src/librustc/front/feature_gate.rs
+2
-1
src/librustc/metadata/decoder.rs
src/librustc/metadata/decoder.rs
+7
-2
src/librustc/metadata/encoder.rs
src/librustc/metadata/encoder.rs
+3
-4
src/librustc/middle/borrowck/mod.rs
src/librustc/middle/borrowck/mod.rs
+2
-1
src/librustc/middle/dead.rs
src/librustc/middle/dead.rs
+2
-1
src/librustc/middle/privacy.rs
src/librustc/middle/privacy.rs
+24
-10
src/librustc/util/ppaux.rs
src/librustc/util/ppaux.rs
+2
-1
未找到文件。
src/librustc/front/feature_gate.rs
浏览文件 @
e534b565
...
...
@@ -98,7 +98,8 @@ fn has_feature(&self, feature: &str) -> bool {
impl
Visitor
<
()
>
for
Context
{
fn
visit_ident
(
&
mut
self
,
sp
:
Span
,
id
:
ast
::
Ident
,
_
:
())
{
let
s
=
token
::
ident_to_str
(
&
id
);
let
string
=
token
::
get_ident
(
id
.name
);
let
s
=
string
.get
();
if
!
s
.is_ascii
()
{
self
.gate_feature
(
"non_ascii_idents"
,
sp
,
...
...
src/librustc/metadata/decoder.rs
浏览文件 @
e534b565
...
...
@@ -1142,8 +1142,13 @@ fn list_crate_deps(data: &[u8], out: &mut io::Writer) {
let
r
=
get_crate_deps
(
data
);
for
dep
in
r
.iter
()
{
write!
(
out
,
"{} {}-{}-{}
\n
"
,
dep
.cnum
,
token
::
ident_to_str
(
&
dep
.name
),
dep
.hash
,
dep
.vers
);
let
string
=
token
::
get_ident
(
dep
.name.name
);
write!
(
out
,
"{} {}-{}-{}
\n
"
,
dep
.cnum
,
string
.get
(),
dep
.hash
,
dep
.vers
);
}
write!
(
out
,
"
\n
"
);
...
...
src/librustc/metadata/encoder.rs
浏览文件 @
e534b565
...
...
@@ -1350,11 +1350,10 @@ fn my_visit_foreign_item(ni: &ForeignItem,
index
:
@
RefCell
<~
[
entry
<
i64
>
]
>
)
{
match
items
.get
(
ni
.id
)
{
ast_map
::
NodeForeignItem
(
_
,
abi
,
_
,
pt
)
=>
{
let
string
=
token
::
get_ident
(
ni
.ident.name
);
debug!
(
"writing foreign item {}::{}"
,
ast_map
::
path_to_str
(
*
pt
,
token
::
get_ident_interner
()),
token
::
ident_to_str
(
&
ni
.ident
));
ast_map
::
path_to_str
(
*
pt
,
token
::
get_ident_interner
()),
string
.get
());
let
mut
ebml_w
=
unsafe
{
ebml_w
.unsafe_clone
()
...
...
src/librustc/middle/borrowck/mod.rs
浏览文件 @
e534b565
...
...
@@ -774,7 +774,8 @@ pub fn append_loan_path_to_str(&self,
match
pat
.node
{
ast
::
PatIdent
(
_
,
ref
path
,
_
)
=>
{
let
ident
=
ast_util
::
path_to_ident
(
path
);
out
.push_str
(
token
::
ident_to_str
(
&
ident
));
let
string
=
token
::
get_ident
(
ident
.name
);
out
.push_str
(
string
.get
());
}
_
=>
{
self
.tcx.sess
.bug
(
...
...
src/librustc/middle/dead.rs
浏览文件 @
e534b565
...
...
@@ -360,9 +360,10 @@ fn symbol_is_live(&mut self, id: ast::NodeId,
fn
warn_dead_code
(
&
mut
self
,
id
:
ast
::
NodeId
,
span
:
codemap
::
Span
,
ident
:
&
ast
::
Ident
)
{
let
string
=
token
::
get_ident
(
ident
.name
);
self
.tcx.sess
.add_lint
(
DeadCode
,
id
,
span
,
format!
(
"code is never used: `{}`"
,
token
::
ident_to_str
(
ident
)));
string
.get
(
)));
}
}
...
...
src/librustc/middle/privacy.rs
浏览文件 @
e534b565
...
...
@@ -530,8 +530,10 @@ fn ensure_public(&self, span: Span, to_check: ast::DefId,
ast
::
ItemTrait
(
..
)
=>
"trait"
,
_
=>
return
false
,
};
let
msg
=
format!
(
"{} `{}` is private"
,
desc
,
token
::
ident_to_str
(
&
item
.ident
));
let
string
=
token
::
get_ident
(
item
.ident.name
);
let
msg
=
format!
(
"{} `{}` is private"
,
desc
,
string
.get
());
self
.tcx.sess
.span_note
(
span
,
msg
);
}
Some
(
..
)
|
None
=>
{}
...
...
@@ -588,8 +590,10 @@ fn check_field(&mut self, span: Span, id: ast::DefId, ident: ast::Ident,
if
struct_vis
!=
ast
::
Public
&&
field
.vis
==
ast
::
Public
{
break
}
if
!
is_local
(
field
.id
)
||
!
self
.private_accessible
(
field
.id.node
)
{
self
.tcx.sess
.span_err
(
span
,
format!
(
"field `{}` is private"
,
token
::
ident_to_str
(
&
ident
)));
let
string
=
token
::
get_ident
(
ident
.name
);
self
.tcx.sess
.span_err
(
span
,
format!
(
"field `{}` is private"
,
string
.get
()))
}
break
;
}
...
...
@@ -603,8 +607,11 @@ fn check_static_method(&mut self, span: Span, method_id: ast::DefId,
let
method_id
=
ty
::
method
(
self
.tcx
,
method_id
)
.provided_source
.unwrap_or
(
method_id
);
self
.ensure_public
(
span
,
method_id
,
None
,
format!
(
"method `{}`"
,
token
::
ident_to_str
(
name
)));
let
string
=
token
::
get_ident
(
name
.name
);
self
.ensure_public
(
span
,
method_id
,
None
,
format!
(
"method `{}`"
,
string
.get
()));
}
// Checks that a path is in scope.
...
...
@@ -617,10 +624,17 @@ fn check_path(&mut self, span: Span, path_id: ast::NodeId, path: &ast::Path) {
match
*
self
.last_private_map
.get
(
&
path_id
)
{
resolve
::
AllPublic
=>
{},
resolve
::
DependsOn
(
def
)
=>
{
let
name
=
token
::
ident_to_str
(
&
path
.segments
.last
()
.unwrap
()
.identifier
);
self
.ensure_public
(
span
,
def
,
Some
(
origdid
),
format!
(
"{} `{}`"
,
tyname
,
name
));
let
name
=
token
::
get_ident
(
path
.segments
.last
()
.unwrap
()
.identifier
.name
);
self
.ensure_public
(
span
,
def
,
Some
(
origdid
),
format!
(
"{} `{}`"
,
tyname
,
name
.get
()));
}
}
};
...
...
src/librustc/util/ppaux.rs
浏览文件 @
e534b565
...
...
@@ -824,7 +824,8 @@ fn repr(&self, tcx: ctxt) -> ~str {
impl
Repr
for
ast
::
Ident
{
fn
repr
(
&
self
,
_
tcx
:
ctxt
)
->
~
str
{
token
::
ident_to_str
(
self
)
.to_owned
()
let
string
=
token
::
get_ident
(
self
.name
);
string
.get
()
.to_str
()
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录