Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
ae02bf70
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,发现更多精彩内容 >>
提交
ae02bf70
编写于
5月 14, 2013
作者:
J
John Clements
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
removed some interner fields
上级
15370569
变更
18
隐藏空白更改
内联
并排
Showing
18 changed file
with
66 addition
and
75 deletion
+66
-75
src/librustc/driver/driver.rs
src/librustc/driver/driver.rs
+5
-4
src/librustc/driver/session.rs
src/librustc/driver/session.rs
+4
-3
src/librustc/front/test.rs
src/librustc/front/test.rs
+4
-3
src/librustc/metadata/encoder.rs
src/librustc/metadata/encoder.rs
+3
-3
src/librustc/middle/astencode.rs
src/librustc/middle/astencode.rs
+8
-7
src/librustc/middle/privacy.rs
src/librustc/middle/privacy.rs
+11
-21
src/librustc/middle/region.rs
src/librustc/middle/region.rs
+5
-4
src/librustc/middle/resolve.rs
src/librustc/middle/resolve.rs
+3
-3
src/librustc/middle/trans/base.rs
src/librustc/middle/trans/base.rs
+7
-6
src/librustc/middle/trans/foreign.rs
src/librustc/middle/trans/foreign.rs
+2
-2
src/librustc/middle/trans/type_use.rs
src/librustc/middle/trans/type_use.rs
+2
-1
src/librustc/middle/ty.rs
src/librustc/middle/ty.rs
+5
-4
src/librustc/middle/typeck/check/mod.rs
src/librustc/middle/typeck/check/mod.rs
+3
-2
src/librustc/util/ppaux.rs
src/librustc/util/ppaux.rs
+2
-1
src/librusti/rusti.rc
src/librusti/rusti.rc
+1
-1
src/libsyntax/ext/expand.rs
src/libsyntax/ext/expand.rs
+1
-1
src/libsyntax/parse/lexer.rs
src/libsyntax/parse/lexer.rs
+0
-3
src/libsyntax/parse/mod.rs
src/libsyntax/parse/mod.rs
+0
-6
未找到文件。
src/librustc/driver/driver.rs
浏览文件 @
ae02bf70
...
...
@@ -39,6 +39,7 @@
use
syntax
::
codemap
;
use
syntax
::
diagnostic
;
use
syntax
::
parse
;
use
syntax
::
parse
::
token
;
use
syntax
::
print
::{
pp
,
pprust
};
use
syntax
;
...
...
@@ -230,7 +231,7 @@ pub fn compile_rest(sess: Session,
sess
.filesearch
,
session
::
sess_os_to_meta_os
(
sess
.targ_cfg.os
),
sess
.opts.is_static
,
sess
.parse_sess.interner
));
token
::
get_ident_interner
()
));
let
lang_items
=
time
(
time_passes
,
~
"language item collection"
,
||
middle
::
lang_items
::
collect_language_items
(
crate
,
sess
));
...
...
@@ -455,7 +456,7 @@ fn ann_identified_post(node: pprust::ann_node) {
let
is_expanded
=
upto
!=
cu_parse
;
let
src
=
sess
.codemap
.get_filemap
(
source_name
(
input
))
.src
;
do
io
::
with_str_reader
(
*
src
)
|
rdr
|
{
pprust
::
print_crate
(
sess
.codemap
,
sess
.parse_sess.interner
,
pprust
::
print_crate
(
sess
.codemap
,
token
::
get_ident_interner
()
,
sess
.span_diagnostic
,
crate
.unwrap
(),
source_name
(
input
),
rdr
,
io
::
stdout
(),
ann
,
is_expanded
);
...
...
@@ -754,7 +755,7 @@ pub fn build_session_(sopts: @session::options,
let
target_cfg
=
build_target_config
(
sopts
,
demitter
);
let
p_s
=
parse
::
new_parse_sess_special_handler
(
span_diagnostic_handler
,
cm
);
let
cstore
=
@
mut
cstore
::
mk_cstore
(
p_s
.interner
);
let
cstore
=
@
mut
cstore
::
mk_cstore
(
token
::
get_ident_interner
()
);
let
filesearch
=
filesearch
::
mk_filesearch
(
&
sopts
.maybe_sysroot
,
sopts
.target_triple
,
...
...
@@ -963,7 +964,7 @@ pub fn early_error(emitter: diagnostic::Emitter, msg: ~str) -> ! {
pub
fn
list_metadata
(
sess
:
Session
,
path
:
&
Path
,
out
:
@
io
::
Writer
)
{
metadata
::
loader
::
list_file_metadata
(
sess
.parse_sess.interner
,
token
::
get_ident_interner
()
,
session
::
sess_os_to_meta_os
(
sess
.targ_cfg.os
),
path
,
out
);
}
...
...
src/librustc/driver/session.rs
浏览文件 @
ae02bf70
...
...
@@ -26,6 +26,7 @@
use
syntax
::
parse
::
ParseSess
;
use
syntax
::{
ast
,
codemap
};
use
syntax
::
abi
;
use
syntax
::
parse
::
token
;
use
syntax
;
use
core
::
hashmap
::
HashMap
;
...
...
@@ -294,13 +295,13 @@ pub fn debug_borrows(@self) -> bool {
}
pub
fn
str_of
(
@
self
,
id
:
ast
::
ident
)
->
@~
str
{
self
.parse_sess.interner
.get
(
id
)
token
::
get_ident_interner
()
.get
(
id
)
}
pub
fn
ident_of
(
@
self
,
st
:
&
str
)
->
ast
::
ident
{
self
.parse_sess.interner
.intern
(
st
)
token
::
get_ident_interner
()
.intern
(
st
)
}
pub
fn
intr
(
@
self
)
->
@
syntax
::
parse
::
token
::
ident_interner
{
self
.parse_sess.interner
token
::
get_ident_interner
()
}
}
...
...
src/librustc/front/test.rs
浏览文件 @
ae02bf70
...
...
@@ -22,6 +22,7 @@
use
syntax
::
codemap
;
use
syntax
::
ext
::
base
::
ExtCtxt
;
use
syntax
::
fold
;
use
syntax
::
parse
::
token
;
use
syntax
::
print
::
pprust
;
use
syntax
::{
ast
,
ast_util
};
...
...
@@ -143,7 +144,7 @@ fn fold_item(cx: @mut TestCtxt, i: @ast::item, fld: @fold::ast_fold)
->
Option
<@
ast
::
item
>
{
cx
.path
.push
(
i
.ident
);
debug!
(
"current path: %s"
,
ast_util
::
path_name_i
(
copy
cx
.path
,
cx
.sess.parse_sess.interner
));
ast_util
::
path_name_i
(
copy
cx
.path
,
token
::
get_ident_interner
()
));
if
is_test_fn
(
cx
,
i
)
||
is_bench_fn
(
i
)
{
match
i
.node
{
...
...
@@ -412,12 +413,12 @@ fn mk_test_desc_and_fn_rec(cx: &TestCtxt, test: &Test) -> @ast::expr {
let
ext_cx
=
cx
.ext_cx
;
debug!
(
"encoding %s"
,
ast_util
::
path_name_i
(
path
,
cx
.sess.parse_sess.interner
));
token
::
get_ident_interner
()
));
let
name_lit
:
ast
::
lit
=
nospan
(
ast
::
lit_str
(
@
ast_util
::
path_name_i
(
path
,
cx
.sess.parse_sess.interner
)));
token
::
get_ident_interner
()
)));
let
name_expr
=
@
ast
::
expr
{
id
:
cx
.sess
.next_node_id
(),
...
...
src/librustc/metadata/encoder.rs
浏览文件 @
ae02bf70
...
...
@@ -43,6 +43,7 @@
use
syntax
::
opt_vec
;
use
syntax
::
parse
::
token
::
special_idents
;
use
syntax
::{
ast_util
,
visit
};
use
syntax
::
parse
::
token
;
use
syntax
;
use
writer
=
extra
::
ebml
::
writer
;
...
...
@@ -142,7 +143,7 @@ fn add_to_index(ecx: @EncodeContext,
index
.push
(
entry
{
val
:
ast_util
::
path_name_i
(
full_path
,
ecx
.tcx.sess.parse_sess.interner
),
token
::
get_ident_interner
()
),
pos
:
ebml_w
.writer
.tell
()
});
}
...
...
@@ -485,8 +486,7 @@ fn encode_info_for_mod(ecx: @EncodeContext,
(%?/%?)"
,
*
ecx
.tcx.sess
.str_of
(
ident
),
did
,
ast_map
::
node_id_to_str
(
ecx
.tcx.items
,
did
,
ecx
.tcx
.sess.parse_sess.interner
));
ast_map
::
node_id_to_str
(
ecx
.tcx.items
,
did
,
token
::
get_ident_interner
()));
ebml_w
.start_tag
(
tag_mod_impl
);
ebml_w
.wr_str
(
def_to_str
(
local_def
(
did
)));
...
...
src/librustc/middle/astencode.rs
浏览文件 @
ae02bf70
...
...
@@ -41,6 +41,7 @@
use
syntax
::
codemap
;
use
syntax
::
fold
::
*
;
use
syntax
::
fold
;
use
syntax
::
parse
::
token
;
use
syntax
;
use
writer
=
extra
::
ebml
::
writer
;
...
...
@@ -86,7 +87,7 @@ pub fn encode_inlined_item(ecx: @e::EncodeContext,
ii
:
ast
::
inlined_item
,
maps
:
Maps
)
{
debug!
(
"> Encoding inlined item: %s::%s (%u)"
,
ast_map
::
path_to_str
(
path
,
ecx
.tcx.sess.parse_sess.interner
),
ast_map
::
path_to_str
(
path
,
token
::
get_ident_interner
()
),
*
ecx
.tcx.sess
.str_of
(
ii
.ident
()),
ebml_w
.writer
.tell
());
...
...
@@ -99,7 +100,7 @@ pub fn encode_inlined_item(ecx: @e::EncodeContext,
ebml_w
.end_tag
();
debug!
(
"< Encoded inlined fn: %s::%s (%u)"
,
ast_map
::
path_to_str
(
path
,
ecx
.tcx.sess.parse_sess.interner
),
ast_map
::
path_to_str
(
path
,
token
::
get_ident_interner
()
),
*
ecx
.tcx.sess
.str_of
(
ii
.ident
()),
ebml_w
.writer
.tell
());
}
...
...
@@ -119,7 +120,7 @@ pub fn decode_inlined_item(cdata: @cstore::crate_metadata,
None
=>
None
,
Some
(
ast_doc
)
=>
{
debug!
(
"> Decoding inlined fn: %s::?"
,
ast_map
::
path_to_str
(
path
,
t
cx
.sess.parse_sess.interner
));
ast_map
::
path_to_str
(
path
,
t
oken
::
get_ident_interner
()
));
let
mut
ast_dsr
=
reader
::
Decoder
(
ast_doc
);
let
from_id_range
=
Decodable
::
decode
(
&
mut
ast_dsr
);
let
to_id_range
=
reserve_id_range
(
dcx
.tcx.sess
,
from_id_range
);
...
...
@@ -132,7 +133,7 @@ pub fn decode_inlined_item(cdata: @cstore::crate_metadata,
let
ii
=
renumber_ast
(
xcx
,
raw_ii
);
debug!
(
"Fn named: %s"
,
*
tcx
.sess
.str_of
(
ii
.ident
()));
debug!
(
"< Decoded inlined fn: %s::%s"
,
ast_map
::
path_to_str
(
path
,
t
cx
.sess.parse_sess.interner
),
ast_map
::
path_to_str
(
path
,
t
oken
::
get_ident_interner
()
),
*
tcx
.sess
.str_of
(
ii
.ident
()));
ast_map
::
map_decoded_item
(
tcx
.sess
.diagnostic
(),
dcx
.tcx.items
,
path
,
&
ii
);
...
...
@@ -1167,7 +1168,7 @@ fn call_site(&self) -> span {
}
}
fn
ident_of
(
&
self
,
st
:
&
str
)
->
ast
::
ident
{
self
.interner
.intern
(
st
)
token
::
get_ident_interner
()
.intern
(
st
)
}
}
...
...
@@ -1236,9 +1237,9 @@ fn new_int_alist<B:Copy>() -> alist<int, B> {
match
(
item_out
,
item_exp
)
{
(
ast
::
ii_item
(
item_out
),
ast
::
ii_item
(
item_exp
))
=>
{
assert
!
(
pprust
::
item_to_str
(
item_out
,
ext_cx
.parse_sess
()
.interner
)
token
::
get_ident_interner
()
)
==
pprust
::
item_to_str
(
item_exp
,
ext_cx
.parse_sess
()
.interner
));
token
::
get_ident_interner
()
));
}
_
=>
fail
!
()
}
...
...
src/librustc/middle/privacy.rs
浏览文件 @
ae02bf70
...
...
@@ -35,6 +35,7 @@
use
syntax
::
ast_util
::{
variant_visibility_to_privacy
,
visibility_to_privacy
};
use
syntax
::
attr
;
use
syntax
::
codemap
::
span
;
use
syntax
::
parse
::
token
;
use
syntax
::
visit
;
pub
fn
check_crate
(
tcx
:
ty
::
ctxt
,
...
...
@@ -120,7 +121,7 @@ pub fn check_crate(tcx: ty::ctxt,
ast_map
::
node_id_to_str
(
tcx
.items
,
method_id
,
tcx
.sess.parse_sess.interner
)));
token
::
get_ident_interner
()
)));
}
None
=>
{
tcx
.sess
.span_bug
(
span
,
"method not found in
\
...
...
@@ -184,7 +185,7 @@ pub fn check_crate(tcx: ty::ctxt,
ast_map
::
node_id_to_str
(
tcx
.items
,
method_id
,
tcx
.sess.parse_sess.interner
)));
token
::
get_ident_interner
()
)));
}
None
=>
{
tcx
.sess
.span_bug
(
span
,
"method not found in
\
...
...
@@ -216,9 +217,7 @@ pub fn check_crate(tcx: ty::ctxt,
ast_map
::
node_id_to_str
(
tcx
.items
,
item_id
,
tcx
.sess
.parse_sess
.interner
)));
token
::
get_ident_interner
())));
}
None
=>
{
tcx
.sess
.span_bug
(
span
,
"item not found in AST map?!"
);
...
...
@@ -236,8 +235,8 @@ pub fn check_crate(tcx: ty::ctxt,
if
field
.ident
!=
ident
{
loop
;
}
if
field
.vis
==
private
{
tcx
.sess
.span_err
(
span
,
fmt!
(
"field `%s` is private"
,
*
t
cx
.sess.parse_sess.interner
.get
(
ident
)));
*
t
oken
::
get_ident_interner
()
.get
(
ident
)));
}
break
;
}
...
...
@@ -257,9 +256,7 @@ pub fn check_crate(tcx: ty::ctxt,
!
privileged_items
.contains
(
&
(
container_id
.node
)))
{
tcx
.sess
.span_err
(
span
,
fmt!
(
"method `%s` is private"
,
*
tcx
.sess
.parse_sess
.interner
*
token
::
get_ident_interner
()
.get
(
*
name
)));
}
}
else
{
...
...
@@ -268,7 +265,7 @@ pub fn check_crate(tcx: ty::ctxt,
if
visibility
!=
public
{
tcx
.sess
.span_err
(
span
,
fmt!
(
"method `%s` is private"
,
*
t
cx
.sess.parse_sess.interner
*
t
oken
::
get_ident_interner
()
.get
(
*
name
)));
}
}
...
...
@@ -289,9 +286,7 @@ pub fn check_crate(tcx: ty::ctxt,
!
privileged_items
.contains
(
&
def_id
.node
)
{
tcx
.sess
.span_err
(
span
,
fmt!
(
"function `%s` is private"
,
*
tcx
.sess
.parse_sess
.interner
*
token
::
get_ident_interner
()
.get
(
copy
*
path
.idents
.last
())));
...
...
@@ -300,9 +295,7 @@ pub fn check_crate(tcx: ty::ctxt,
def_id
)
!=
public
{
tcx
.sess
.span_err
(
span
,
fmt!
(
"function `%s` is private"
,
*
tcx
.sess
.parse_sess
.interner
*
token
::
get_ident_interner
()
.get
(
copy
*
path
.idents
.last
())));
...
...
@@ -350,10 +343,7 @@ pub fn check_crate(tcx: ty::ctxt,
`%s`
\
is
\
private"
,
*
tcx
.sess
.parse_sess
.interner
*
token
::
get_ident_interner
()
.get
(
method
.ident
)));
...
...
src/librustc/middle/region.rs
浏览文件 @
ae02bf70
...
...
@@ -30,6 +30,7 @@
use
syntax
::
ast_map
;
use
syntax
::
codemap
::
span
;
use
syntax
::
print
::
pprust
;
use
syntax
::
parse
::
token
;
use
syntax
::
parse
::
token
::
special_idents
;
use
syntax
::{
ast
,
visit
};
...
...
@@ -595,7 +596,7 @@ pub fn add_rp(&mut self, id: ast::node_id, variance: region_variance) {
debug!
(
"add_rp() variance for %s: %? == %? ^ %?"
,
ast_map
::
node_id_to_str
(
self
.ast_map
,
id
,
self
.sess.parse_sess.interner
),
token
::
get_ident_interner
()
),
joined_variance
,
old_variance
,
variance
);
if
Some
(
joined_variance
)
!=
old_variance
{
...
...
@@ -614,9 +615,9 @@ pub fn add_dep(&mut self, from: ast::node_id) {
debug!
(
"add dependency from %d -> %d (%s -> %s) with variance %?"
,
from
,
self
.item_id
,
ast_map
::
node_id_to_str
(
self
.ast_map
,
from
,
self
.sess.parse_sess.interner
),
token
::
get_ident_interner
()
),
ast_map
::
node_id_to_str
(
self
.ast_map
,
self
.item_id
,
self
.sess.parse_sess.interner
),
token
::
get_ident_interner
()
),
copy
self
.ambient_variance
);
let
vec
=
match
self
.dep_map
.find
(
&
from
)
{
Some
(
&
vec
)
=>
vec
,
...
...
@@ -951,7 +952,7 @@ pub fn determine_rp_in_crate(sess: Session,
debug!
(
"item %? (%s) is parameterized with variance %?"
,
key
,
ast_map
::
node_id_to_str
(
ast_map
,
key
,
sess
.parse_sess.interner
),
token
::
get_ident_interner
()
),
value
);
}
"----"
...
...
src/librustc/middle/resolve.rs
浏览文件 @
ae02bf70
...
...
@@ -28,6 +28,7 @@
use
syntax
::
ast_util
::{
Privacy
,
Public
,
Private
};
use
syntax
::
ast_util
::{
variant_visibility_to_privacy
,
visibility_to_privacy
};
use
syntax
::
attr
::{
attr_metas
,
contains_name
};
use
syntax
::
parse
::
token
;
use
syntax
::
parse
::
token
::
ident_interner
;
use
syntax
::
parse
::
token
::
special_idents
;
use
syntax
::
print
::
pprust
::
path_to_str
;
...
...
@@ -805,8 +806,7 @@ pub fn Resolver(session: Session,
self_ident
:
special_idents
::
self_
,
type_self_ident
:
special_idents
::
type_self
,
primitive_type_table
:
@
PrimitiveTypeTable
(
session
.
parse_sess.interner
),
primitive_type_table
:
@
PrimitiveTypeTable
(
token
::
get_ident_interner
()),
namespaces
:
~
[
TypeNS
,
ValueNS
],
...
...
@@ -2942,7 +2942,7 @@ pub fn resolve_module_prefix(@mut self,
module_
:
@
mut
Module
,
module_path
:
&
[
ident
])
->
ResolveResult
<
ModulePrefixResult
>
{
let
interner
=
self
.session.parse_sess.interner
;
let
interner
=
token
::
get_ident_interner
()
;
// Start at the current module if we see `self` or `super`, or at the
// top of the crate otherwise.
...
...
src/librustc/middle/trans/base.rs
浏览文件 @
ae02bf70
...
...
@@ -78,7 +78,8 @@
use
syntax
::
ast_util
::{
local_def
,
path_to_ident
};
use
syntax
::
attr
;
use
syntax
::
codemap
::
span
;
use
syntax
::
parse
::
token
::
special_idents
;
use
syntax
::
parse
::
token
;
use
syntax
::
parse
::
token
::{
special_idents
};
use
syntax
::
print
::
pprust
::
stmt_to_str
;
use
syntax
::
visit
;
use
syntax
::{
ast
,
ast_util
,
codemap
,
ast_map
};
...
...
@@ -2257,10 +2258,10 @@ pub fn register_fn_fuller(ccx: @CrateContext,
->
ValueRef
{
debug!
(
"register_fn_fuller creating fn for item %d with path %s"
,
node_id
,
ast_map
::
path_to_str
(
path
,
ccx
.sess.parse_sess.interner
));
ast_map
::
path_to_str
(
path
,
token
::
get_ident_interner
()
));
let
ps
=
if
attr
::
attrs_contains_name
(
attrs
,
"no_mangle"
)
{
path_elt_to_str
(
*
path
.last
(),
ccx
.sess.parse_sess.interner
)
path_elt_to_str
(
*
path
.last
(),
token
::
get_ident_interner
()
)
}
else
{
mangle_exported_name
(
ccx
,
/*bad*/
copy
path
,
node_type
)
};
...
...
@@ -2504,7 +2505,7 @@ pub fn get_item_val(ccx: @CrateContext, id: ast::node_id) -> ValueRef {
}
ast
::
foreign_item_const
(
*
)
=>
{
let
typ
=
ty
::
node_id_to_type
(
tcx
,
ni
.id
);
let
ident
=
ccx
.sess.parse_sess.interner
.get
(
ni
.ident
);
let
ident
=
token
::
get_ident_interner
()
.get
(
ni
.ident
);
let
g
=
do
str
::
as_c_str
(
*
ident
)
|
buf
|
{
unsafe
{
llvm
::
LLVMAddGlobal
(
ccx
.llmod
,
...
...
@@ -3069,7 +3070,7 @@ pub fn trans_crate(sess: session::Session,
lib
::
llvm
::
associate_type
(
tn
,
@
"tydesc"
,
tydesc_type
);
let
crate_map
=
decl_crate_map
(
sess
,
link_meta
,
llmod
);
let
dbg_cx
=
if
sess
.opts.debuginfo
{
Some
(
debuginfo
::
mk_ctxt
(
copy
llmod_id
,
sess
.parse_sess.interner
))
Some
(
debuginfo
::
mk_ctxt
(
copy
llmod_id
,
token
::
get_ident_interner
()
))
}
else
{
None
};
...
...
@@ -3104,7 +3105,7 @@ pub fn trans_crate(sess: session::Session,
lltypes
:
@
mut
HashMap
::
new
(),
llsizingtypes
:
@
mut
HashMap
::
new
(),
adt_reprs
:
@
mut
HashMap
::
new
(),
names
:
new_namegen
(
sess
.parse_sess.interner
),
names
:
new_namegen
(
token
::
get_ident_interner
()
),
next_addrspace
:
new_addrspace_gen
(),
symbol_hasher
:
symbol_hasher
,
type_hashcodes
:
@
mut
HashMap
::
new
(),
...
...
src/librustc/middle/trans/foreign.rs
浏览文件 @
ae02bf70
...
...
@@ -41,6 +41,7 @@
use
syntax
::{
attr
,
ast_map
};
use
syntax
::
opt_vec
;
use
syntax
::
parse
::
token
::
special_idents
;
use
syntax
::
parse
::
token
;
use
syntax
::
abi
::{
X86
,
X86_64
,
Arm
,
Mips
};
use
syntax
::
abi
::{
RustIntrinsic
,
Rust
,
Stdcall
,
Fastcall
,
Cdecl
,
Aapcs
,
C
};
...
...
@@ -343,8 +344,7 @@ pub fn trans_foreign_mod(ccx: @CrateContext,
}
}
ast
::
foreign_item_const
(
*
)
=>
{
let
ident
=
ccx
.sess.parse_sess.interner
.get
(
foreign_item
.ident
);
let
ident
=
token
::
get_ident_interner
()
.get
(
foreign_item
.ident
);
ccx
.item_symbols
.insert
(
foreign_item
.id
,
copy
*
ident
);
}
}
...
...
src/librustc/middle/trans/type_use.rs
浏览文件 @
ae02bf70
...
...
@@ -42,6 +42,7 @@
use
syntax
::
ast
::
*
;
use
syntax
::
ast_map
;
use
syntax
::
ast_util
;
use
syntax
::
parse
::
token
;
use
syntax
::
visit
;
pub
type
type_uses
=
uint
;
// Bitmask
...
...
@@ -170,7 +171,7 @@ pub fn type_uses_for(ccx: @CrateContext, fn_id: def_id, n_tps: uint)
ast_map
::
node_id_to_str
(
ccx
.tcx.items
,
fn_id_loc
.node
,
ccx
.tcx.sess.parse_sess.interner
)));
token
::
get_ident_interner
()
)));
}
}
let
Context
{
uses
,
_
}
=
cx
;
...
...
src/librustc/middle/ty.rs
浏览文件 @
ae02bf70
...
...
@@ -43,6 +43,7 @@
use
syntax
::
attr
;
use
syntax
::
codemap
::
span
;
use
syntax
::
codemap
;
use
syntax
::
parse
::
token
;
use
syntax
::
parse
::
token
::
special_idents
;
use
syntax
::{
ast
,
ast_map
};
use
syntax
::
opt_vec
::
OptVec
;
...
...
@@ -2819,7 +2820,7 @@ pub fn node_id_to_trait_ref(cx: ctxt, id: ast::node_id) -> @ty::TraitRef {
None
=>
cx
.sess
.bug
(
fmt!
(
"node_id_to_trait_ref: no trait ref for node `%s`"
,
ast_map
::
node_id_to_str
(
cx
.items
,
id
,
cx
.sess.parse_sess.interner
)))
token
::
get_ident_interner
()
)))
}
}
...
...
@@ -2830,7 +2831,7 @@ pub fn node_id_to_type(cx: ctxt, id: ast::node_id) -> t {
None
=>
cx
.sess
.bug
(
fmt!
(
"node_id_to_type: no type for node `%s`"
,
ast_map
::
node_id_to_str
(
cx
.items
,
id
,
cx
.sess.parse_sess.interner
)))
token
::
get_ident_interner
()
)))
}
}
...
...
@@ -3821,7 +3822,7 @@ pub fn substd_enum_variants(cx: ctxt,
}
pub
fn
item_path_str
(
cx
:
ctxt
,
id
:
ast
::
def_id
)
->
~
str
{
ast_map
::
path_to_str
(
item_path
(
cx
,
id
),
cx
.sess.parse_sess.interner
)
ast_map
::
path_to_str
(
item_path
(
cx
,
id
),
token
::
get_ident_interner
()
)
}
pub
enum
DtorKind
{
...
...
@@ -4107,7 +4108,7 @@ pub fn lookup_struct_fields(cx: ctxt, did: ast::def_id) -> ~[field_ty] {
cx
.sess
.bug
(
fmt!
(
"struct ID not bound to an item: %s"
,
ast_map
::
node_id_to_str
(
cx
.items
,
did
.node
,
cx
.sess.parse_sess.interner
)));
token
::
get_ident_interner
()
)));
}
}
}
...
...
src/librustc/middle/typeck/check/mod.rs
浏览文件 @
ae02bf70
...
...
@@ -127,6 +127,7 @@
use
syntax
::
codemap
;
use
syntax
::
opt_vec
::
OptVec
;
use
syntax
::
opt_vec
;
use
syntax
::
parse
::
token
;
use
syntax
::
parse
::
token
::
special_idents
;
use
syntax
::
print
::
pprust
;
use
syntax
::
visit
;
...
...
@@ -815,7 +816,7 @@ pub fn node_ty(&self, id: ast::node_id) -> ty::t {
fmt!
(
"no type for node %d: %s in fcx %s"
,
id
,
ast_map
::
node_id_to_str
(
self
.tcx
()
.items
,
id
,
self
.tcx
()
.sess.parse_sess.interner
),
token
::
get_ident_interner
()
),
self
.tag
()));
}
}
...
...
@@ -829,7 +830,7 @@ pub fn node_ty_substs(&self, id: ast::node_id) -> ty::substs {
fmt!
(
"no type substs for node %d: %s in fcx %s"
,
id
,
ast_map
::
node_id_to_str
(
self
.tcx
()
.items
,
id
,
self
.tcx
()
.sess.parse_sess.interner
),
token
::
get_ident_interner
()
),
self
.tag
()));
}
}
...
...
src/librustc/util/ppaux.rs
浏览文件 @
ae02bf70
...
...
@@ -28,6 +28,7 @@
use
syntax
::
abi
::
AbiSet
;
use
syntax
::
ast_map
;
use
syntax
::
codemap
::
span
;
use
syntax
::
parse
::
token
;
use
syntax
::
print
::
pprust
;
use
syntax
::{
ast
,
ast_util
};
...
...
@@ -200,7 +201,7 @@ pub fn re_scope_id_to_str(cx: ctxt, node_id: ast::node_id) -> ~str {
_
=>
{
cx
.sess
.bug
(
fmt!
(
"re_scope refers to %s"
,
ast_map
::
node_id_to_str
(
cx
.items
,
node_id
,
cx
.sess.parse_sess.interner
)))
}
token
::
get_ident_interner
()
)))
}
}
}
...
...
src/librusti/rusti.rc
浏览文件 @
ae02bf70
...
...
@@ -174,7 +174,7 @@ fn run(repl: Repl, input: ~str) -> Repl {
_ => fail!()
};
debug!("recording input into repl history");
record(repl, blk,
sess.parse_sess.interner
)
record(repl, blk,
token::get_ident_interner()
)
}
// Compiles a crate given by the filename as a library if the compiled
...
...
src/libsyntax/ext/expand.rs
浏览文件 @
ae02bf70
...
...
@@ -849,7 +849,7 @@ fn renaming () {
};
let
table
=
@
mut
new_sctable
();
let
a_name
=
100
;
// enforced by testing_interner
let
a2_name
=
sess
.interner
.gensym
(
"a2"
)
.name
;
let
a2_name
=
get_ident_interner
()
.gensym
(
"a2"
)
.name
;
let
renamer
=
new_ident_renamer
(
ast
::
ident
{
name
:
a_name
,
ctxt
:
empty_ctxt
},
a2_name
,
table
);
let
renamed_ast
=
fun_to_ident_folder
(
renamer
)
.fold_item
(
item_ast
)
.get
();
...
...
src/libsyntax/parse/lexer.rs
浏览文件 @
ae02bf70
...
...
@@ -31,7 +31,6 @@ pub trait reader {
fn
next_token
(
@
mut
self
)
->
TokenAndSpan
;
fn
fatal
(
@
mut
self
,
~
str
)
->
!
;
fn
span_diag
(
@
mut
self
)
->
@
span_handler
;
fn
interner
(
@
mut
self
)
->
@
token
::
ident_interner
;
fn
peek
(
@
mut
self
)
->
TokenAndSpan
;
fn
dup
(
@
mut
self
)
->
@
reader
;
}
...
...
@@ -122,7 +121,6 @@ fn fatal(@mut self, m: ~str) -> ! {
self
.span_diagnostic
.span_fatal
(
copy
self
.peek_span
,
m
)
}
fn
span_diag
(
@
mut
self
)
->
@
span_handler
{
self
.span_diagnostic
}
fn
interner
(
@
mut
self
)
->
@
token
::
ident_interner
{
get_ident_interner
()
}
fn
peek
(
@
mut
self
)
->
TokenAndSpan
{
TokenAndSpan
{
tok
:
copy
self
.peek_tok
,
...
...
@@ -139,7 +137,6 @@ fn fatal(@mut self, m: ~str) -> ! {
self
.sp_diag
.span_fatal
(
copy
self
.cur_span
,
m
);
}
fn
span_diag
(
@
mut
self
)
->
@
span_handler
{
self
.sp_diag
}
fn
interner
(
@
mut
self
)
->
@
token
::
ident_interner
{
get_ident_interner
()
}
fn
peek
(
@
mut
self
)
->
TokenAndSpan
{
TokenAndSpan
{
tok
:
copy
self
.cur_tok
,
...
...
src/libsyntax/parse/mod.rs
浏览文件 @
ae02bf70
...
...
@@ -43,14 +43,10 @@
pub
mod
obsolete
;
// info about a parsing session.
// This structure and the reader both have
// an interner associated with them. If they're
// not the same, bad things can happen.
pub
struct
ParseSess
{
cm
:
@
codemap
::
CodeMap
,
// better be the same as the one in the reader!
next_id
:
node_id
,
span_diagnostic
:
@
span_handler
,
// better be the same as the one in the reader!
interner
:
@
ident_interner
,
}
pub
fn
new_parse_sess
(
demitter
:
Option
<
Emitter
>
)
->
@
mut
ParseSess
{
...
...
@@ -59,7 +55,6 @@ pub fn new_parse_sess(demitter: Option<Emitter>) -> @mut ParseSess {
cm
:
cm
,
next_id
:
1
,
span_diagnostic
:
mk_span_handler
(
mk_handler
(
demitter
),
cm
),
interner
:
get_ident_interner
(),
}
}
...
...
@@ -70,7 +65,6 @@ pub fn new_parse_sess_special_handler(sh: @span_handler,
cm
:
cm
,
next_id
:
1
,
span_diagnostic
:
sh
,
interner
:
get_ident_interner
(),
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录