Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
2b4f28e5
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,发现更多精彩内容 >>
提交
2b4f28e5
编写于
10月 06, 2015
作者:
N
Nick Cameron
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Misc fixups
上级
3d81f785
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
54 addition
and
26 deletion
+54
-26
src/librustc/middle/astencode.rs
src/librustc/middle/astencode.rs
+31
-6
src/librustc_driver/driver.rs
src/librustc_driver/driver.rs
+1
-1
src/librustc_driver/pretty.rs
src/librustc_driver/pretty.rs
+1
-1
src/librustc_driver/test.rs
src/librustc_driver/test.rs
+4
-3
src/librustc_front/lowering.rs
src/librustc_front/lowering.rs
+10
-8
src/librustc_typeck/coherence/mod.rs
src/librustc_typeck/coherence/mod.rs
+0
-1
src/librustdoc/core.rs
src/librustdoc/core.rs
+1
-1
src/librustdoc/test.rs
src/librustdoc/test.rs
+1
-1
src/test/run-make/execution-engine/test.rs
src/test/run-make/execution-engine/test.rs
+5
-4
未找到文件。
src/librustc/middle/astencode.rs
浏览文件 @
2b4f28e5
...
...
@@ -54,8 +54,9 @@
#[cfg(test)]
use
std
::
io
::
Cursor
;
#[cfg(test)]
use
syntax
::
parse
;
#[cfg(test)]
use
syntax
::
ast
::
NodeId
;
#[cfg(test)]
use
rustc_front
::
print
::
pprust
;
#[cfg(test)]
use
rustc_front
::
lowering
::
lower_item
;
#[cfg(test)]
use
rustc_front
::
lowering
::
{
lower_item
,
LoweringContext
}
;
struct
DecodeContext
<
'a
,
'b
,
'tcx
:
'a
>
{
tcx
:
&
'a
ty
::
ctxt
<
'tcx
>
,
...
...
@@ -1374,6 +1375,22 @@ fn name_of(&self, st: &str) -> ast::Name {
fn
parse_sess
(
&
self
)
->
&
parse
::
ParseSess
{
self
}
}
#[cfg(test)]
struct
FakeNodeIdAssigner
;
#[cfg(test)]
// It should go without sayingt that this may give unexpected results. Avoid
// lowering anything which needs new nodes.
impl
NodeIdAssigner
for
FakeNodeIdAssigner
{
fn
next_node_id
(
&
self
)
->
NodeId
{
0
}
fn
peek_node_id
(
&
self
)
->
NodeId
{
0
}
}
#[cfg(test)]
fn
mk_ctxt
()
->
parse
::
ParseSess
{
parse
::
ParseSess
::
new
()
...
...
@@ -1392,7 +1409,9 @@ fn roundtrip(in_item: P<hir::Item>) {
#[test]
fn
test_basic
()
{
let
cx
=
mk_ctxt
();
roundtrip
(
lower_item
(
&
quote_item!
(
&
cx
,
let
fnia
=
FakeNodeIdAssigner
;
let
lcx
=
LoweringContext
::
new
(
&
fnia
,
None
);
roundtrip
(
lower_item
(
&
lcx
,
&
quote_item!
(
&
cx
,
fn
foo
()
{}
)
.unwrap
()));
}
...
...
@@ -1400,7 +1419,9 @@ fn foo() {}
#[test]
fn
test_smalltalk
()
{
let
cx
=
mk_ctxt
();
roundtrip
(
lower_item
(
&
quote_item!
(
&
cx
,
let
fnia
=
FakeNodeIdAssigner
;
let
lcx
=
LoweringContext
::
new
(
&
fnia
,
None
);
roundtrip
(
lower_item
(
&
lcx
,
&
quote_item!
(
&
cx
,
fn
foo
()
->
isize
{
3
+
4
}
// first smalltalk program ever executed.
)
.unwrap
()));
}
...
...
@@ -1408,7 +1429,9 @@ fn foo() -> isize { 3 + 4 } // first smalltalk program ever executed.
#[test]
fn
test_more
()
{
let
cx
=
mk_ctxt
();
roundtrip
(
lower_item
(
&
quote_item!
(
&
cx
,
let
fnia
=
FakeNodeIdAssigner
;
let
lcx
=
LoweringContext
::
new
(
&
fnia
,
None
);
roundtrip
(
lower_item
(
&
lcx
,
&
quote_item!
(
&
cx
,
fn
foo
(
x
:
usize
,
y
:
usize
)
->
usize
{
let
z
=
x
+
y
;
return
z
;
...
...
@@ -1425,10 +1448,12 @@ fn eq_int(a: isize, b: isize) -> bool { a == b }
return
alist
{
eq_fn
:
eq_int
,
data
:
Vec
::
new
()};
}
)
.unwrap
();
let
hir_item
=
lower_item
(
&
item
);
let
fnia
=
FakeNodeIdAssigner
;
let
lcx
=
LoweringContext
::
new
(
&
fnia
,
None
);
let
hir_item
=
lower_item
(
&
lcx
,
&
item
);
let
item_in
=
InlinedItemRef
::
Item
(
&
hir_item
);
let
item_out
=
simplify_ast
(
item_in
);
let
item_exp
=
InlinedItem
::
Item
(
lower_item
(
&
quote_item!
(
&
cx
,
let
item_exp
=
InlinedItem
::
Item
(
lower_item
(
&
lcx
,
&
quote_item!
(
&
cx
,
fn
new_int_alist
<
B
>
()
->
alist
<
isize
,
B
>
{
return
alist
{
eq_fn
:
eq_int
,
data
:
Vec
::
new
()};
}
...
...
src/librustc_driver/driver.rs
浏览文件 @
2b4f28e5
...
...
@@ -112,7 +112,7 @@ pub fn compile_input(sess: Session,
let
expanded_crate
=
assign_node_ids
(
&
sess
,
expanded_crate
);
// Lower ast -> hir.
let
lcx
=
LoweringContext
::
new
(
&
sess
,
&
expanded_crate
);
let
lcx
=
LoweringContext
::
new
(
&
sess
,
Some
(
&
expanded_crate
)
);
let
mut
hir_forest
=
time
(
sess
.time_passes
(),
"lowering ast -> hir"
,
||
hir_map
::
Forest
::
new
(
lower_crate
(
&
lcx
,
&
expanded_crate
)));
...
...
src/librustc_driver/pretty.rs
浏览文件 @
2b4f28e5
...
...
@@ -670,7 +670,7 @@ pub fn pretty_print_input(sess: Session,
// There is some twisted, god-forsaken tangle of lifetimes here which makes
// the ordering of stuff super-finicky.
let
mut
hir_forest
;
let
lcx
=
LoweringContext
::
new
(
&
sess
,
&
krate
);
let
lcx
=
LoweringContext
::
new
(
&
sess
,
Some
(
&
krate
)
);
let
arenas
=
ty
::
CtxtArenas
::
new
();
let
ast_map
=
if
compute_ast_map
{
hir_forest
=
hir_map
::
Forest
::
new
(
lower_crate
(
&
lcx
,
&
krate
));
...
...
src/librustc_driver/test.rs
浏览文件 @
2b4f28e5
...
...
@@ -38,7 +38,7 @@
use
syntax
::
parse
::
token
;
use
syntax
::
feature_gate
::
UnstableFeatures
;
use
rustc_front
::
lowering
::
lower_crate
;
use
rustc_front
::
lowering
::
{
lower_crate
,
LoweringContext
}
;
use
rustc_front
::
hir
;
struct
Env
<
'a
,
'tcx
:
'a
>
{
...
...
@@ -124,7 +124,8 @@ fn test_env<F>(source_string: &str,
.expect
(
"phase 2 aborted"
);
let
krate
=
driver
::
assign_node_ids
(
&
sess
,
krate
);
let
mut
hir_forest
=
hir_map
::
Forest
::
new
(
lower_crate
(
&
krate
));
let
lcx
=
LoweringContext
::
new
(
&
sess
,
Some
(
&
krate
));
let
mut
hir_forest
=
hir_map
::
Forest
::
new
(
lower_crate
(
&
lcx
,
&
krate
));
let
arenas
=
ty
::
CtxtArenas
::
new
();
let
ast_map
=
driver
::
make_map
(
&
sess
,
&
mut
hir_forest
);
let
krate
=
ast_map
.krate
();
...
...
@@ -135,7 +136,7 @@ fn test_env<F>(source_string: &str,
resolve
::
resolve_crate
(
&
sess
,
&
ast_map
,
resolve
::
MakeGlobMap
::
No
);
let
named_region_map
=
resolve_lifetime
::
krate
(
&
sess
,
krate
,
&
def_map
);
let
region_map
=
region
::
resolve_crate
(
&
sess
,
krate
);
ty
::
ctxt
::
create_and_enter
(
sess
,
ty
::
ctxt
::
create_and_enter
(
&
sess
,
&
arenas
,
def_map
,
named_region_map
,
...
...
src/librustc_front/lowering.rs
浏览文件 @
2b4f28e5
...
...
@@ -80,14 +80,16 @@ pub struct LoweringContext<'a> {
}
impl
<
'a
,
'hir
>
LoweringContext
<
'a
>
{
pub
fn
new
(
id_assigner
:
&
'a
NodeIdAssigner
,
c
:
&
Crate
)
->
LoweringContext
<
'a
>
{
let
crate_root
=
if
std_inject
::
no_core
(
c
)
{
None
}
else
if
std_inject
::
no_std
(
c
)
{
Some
(
"core"
)
}
else
{
Some
(
"std"
)
};
pub
fn
new
(
id_assigner
:
&
'a
NodeIdAssigner
,
c
:
Option
<&
Crate
>
)
->
LoweringContext
<
'a
>
{
let
crate_root
=
c
.and_then
(|
c
|
{
if
std_inject
::
no_core
(
c
)
{
None
}
else
if
std_inject
::
no_std
(
c
)
{
Some
(
"core"
)
}
else
{
Some
(
"std"
)
}
});
LoweringContext
{
crate_root
:
crate_root
,
...
...
src/librustc_typeck/coherence/mod.rs
浏览文件 @
2b4f28e5
...
...
@@ -38,7 +38,6 @@
use
std
::
rc
::
Rc
;
use
syntax
::
codemap
::
Span
;
use
syntax
::
parse
::
token
;
use
syntax
::
ast
::
NodeIdAssigner
;
use
util
::
nodemap
::{
DefIdMap
,
FnvHashMap
};
use
rustc
::
front
::
map
as
hir_map
;
use
rustc
::
front
::
map
::
NodeItem
;
...
...
src/librustdoc/core.rs
浏览文件 @
2b4f28e5
...
...
@@ -135,7 +135,7 @@ pub fn run_core(search_paths: SearchPaths, cfgs: Vec<String>, externs: Externs,
let
krate
=
driver
::
assign_node_ids
(
&
sess
,
krate
);
// Lower ast -> hir.
let
lcx
=
LoweringContext
::
new
(
&
sess
,
&
krate
);
let
lcx
=
LoweringContext
::
new
(
&
sess
,
Some
(
&
krate
)
);
let
mut
hir_forest
=
hir_map
::
Forest
::
new
(
lower_crate
(
&
lcx
,
&
krate
));
let
arenas
=
ty
::
CtxtArenas
::
new
();
let
hir_map
=
driver
::
make_map
(
&
sess
,
&
mut
hir_forest
);
...
...
src/librustdoc/test.rs
浏览文件 @
2b4f28e5
...
...
@@ -83,7 +83,7 @@ pub fn run(input: &str,
"rustdoc-test"
,
None
)
.expect
(
"phase_2_configure_and_expand aborted in rustdoc!"
);
let
krate
=
driver
::
assign_node_ids
(
&
sess
,
krate
);
let
lcx
=
LoweringContext
::
new
(
&
sess
,
&
krate
);
let
lcx
=
LoweringContext
::
new
(
&
sess
,
Some
(
&
krate
)
);
let
krate
=
lower_crate
(
&
lcx
,
&
krate
);
let
opts
=
scrape_test_config
(
&
krate
);
...
...
src/test/run-make/execution-engine/test.rs
浏览文件 @
2b4f28e5
...
...
@@ -31,7 +31,7 @@
use
rustc
::
session
::
config
::{
self
,
basic_options
,
build_configuration
,
Input
,
Options
};
use
rustc
::
session
::
build_session
;
use
rustc_driver
::
driver
;
use
rustc_front
::
lowering
::
lower_crate
;
use
rustc_front
::
lowering
::
{
lower_crate
,
LoweringContext
}
;
use
rustc_resolve
::
MakeGlobMap
;
use
libc
::
c_void
;
...
...
@@ -223,12 +223,13 @@ fn compile_program(input: &str, sysroot: PathBuf)
.expect
(
"phase_2 returned `None`"
);
let
krate
=
driver
::
assign_node_ids
(
&
sess
,
krate
);
let
mut
hir_forest
=
ast_map
::
Forest
::
new
(
lower_crate
(
&
krate
));
let
lcx
=
LoweringContext
::
new
(
&
sess
,
Some
(
&
krate
));
let
mut
hir_forest
=
ast_map
::
Forest
::
new
(
lower_crate
(
&
lcx
,
&
krate
));
let
arenas
=
ty
::
CtxtArenas
::
new
();
let
ast_map
=
driver
::
make_map
(
&
sess
,
&
mut
hir_forest
);
driver
::
phase_3_run_analysis_passes
(
sess
,
ast_map
,
&
arenas
,
id
,
MakeGlobMap
::
No
,
|
tcx
,
analysis
|
{
&
sess
,
ast_map
,
&
arenas
,
id
,
MakeGlobMap
::
No
,
|
tcx
,
analysis
|
{
let
trans
=
driver
::
phase_4_translate_to_llvm
(
tcx
,
analysis
);
...
...
@@ -246,7 +247,7 @@ fn compile_program(input: &str, sysroot: PathBuf)
let
modp
=
llmod
as
usize
;
(
modp
,
deps
)
})
.1
})
})
.unwrap
();
match
handle
.join
()
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录