Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
2628f3cc
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,发现更多精彩内容 >>
提交
2628f3cc
编写于
3月 22, 2016
作者:
J
Jorge Aparicio
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix alignment
上级
bd71d11a
变更
34
展开全部
隐藏空白更改
内联
并排
Showing
34 changed file
with
464 addition
and
479 deletion
+464
-479
src/compiletest/compiletest.rs
src/compiletest/compiletest.rs
+4
-4
src/librustc/middle/def_id.rs
src/librustc/middle/def_id.rs
+1
-1
src/librustc/middle/infer/combine.rs
src/librustc/middle/infer/combine.rs
+8
-10
src/librustc/middle/infer/sub.rs
src/librustc/middle/infer/sub.rs
+2
-2
src/librustc/middle/traits/select.rs
src/librustc/middle/traits/select.rs
+8
-8
src/librustc/middle/ty/relate.rs
src/librustc/middle/ty/relate.rs
+7
-7
src/librustc/mir/repr.rs
src/librustc/mir/repr.rs
+2
-2
src/librustc/util/ppaux.rs
src/librustc/util/ppaux.rs
+5
-5
src/librustc_back/target/mod.rs
src/librustc_back/target/mod.rs
+1
-1
src/librustc_borrowck/borrowck/mir/graphviz.rs
src/librustc_borrowck/borrowck/mir/graphviz.rs
+21
-21
src/librustc_driver/driver.rs
src/librustc_driver/driver.rs
+16
-16
src/librustc_front/print/pprust.rs
src/librustc_front/print/pprust.rs
+53
-53
src/librustc_mir/graphviz.rs
src/librustc_mir/graphviz.rs
+5
-5
src/librustc_trans/back/archive.rs
src/librustc_trans/back/archive.rs
+2
-2
src/librustc_trans/trans/consts.rs
src/librustc_trans/trans/consts.rs
+1
-1
src/librustc_typeck/astconv.rs
src/librustc_typeck/astconv.rs
+4
-4
src/librustc_typeck/check/dropck.rs
src/librustc_typeck/check/dropck.rs
+5
-6
src/librustc_typeck/lib.rs
src/librustc_typeck/lib.rs
+4
-8
src/librustdoc/html/format.rs
src/librustdoc/html/format.rs
+13
-14
src/librustdoc/html/highlight.rs
src/librustdoc/html/highlight.rs
+2
-3
src/librustdoc/html/render.rs
src/librustdoc/html/render.rs
+136
-137
src/librustdoc/html/toc.rs
src/librustdoc/html/toc.rs
+4
-4
src/libstd/sys/common/net.rs
src/libstd/sys/common/net.rs
+6
-6
src/libstd/sys/unix/ext/net.rs
src/libstd/sys/unix/ext/net.rs
+5
-5
src/libstd/sys/unix/os.rs
src/libstd/sys/unix/os.rs
+6
-6
src/libstd/sys/unix/process.rs
src/libstd/sys/unix/process.rs
+1
-1
src/libstd/sys/windows/fs.rs
src/libstd/sys/windows/fs.rs
+1
-1
src/libstd/sys/windows/process.rs
src/libstd/sys/windows/process.rs
+2
-2
src/libsyntax/codemap.rs
src/libsyntax/codemap.rs
+65
-65
src/libsyntax/errors/emitter.rs
src/libsyntax/errors/emitter.rs
+12
-12
src/libsyntax/parse/parser.rs
src/libsyntax/parse/parser.rs
+21
-20
src/libsyntax/print/pprust.rs
src/libsyntax/print/pprust.rs
+35
-41
src/tools/error_index_generator/main.rs
src/tools/error_index_generator/main.rs
+2
-2
src/tools/rustbook/build.rs
src/tools/rustbook/build.rs
+4
-4
未找到文件。
src/compiletest/compiletest.rs
浏览文件 @
2628f3cc
...
@@ -312,10 +312,10 @@ fn collect_tests_from_dir(config: &Config,
...
@@ -312,10 +312,10 @@ fn collect_tests_from_dir(config: &Config,
}
else
if
file_path
.is_dir
()
{
}
else
if
file_path
.is_dir
()
{
let
relative_file_path
=
relative_dir_path
.join
(
file
.file_name
());
let
relative_file_path
=
relative_dir_path
.join
(
file
.file_name
());
collect_tests_from_dir
(
config
,
collect_tests_from_dir
(
config
,
base
,
base
,
&
file_path
,
&
file_path
,
&
relative_file_path
,
relative_file_path
,
tests
)
?
;
tests
)
?
;
}
}
}
}
Ok
(())
Ok
(())
...
...
src/librustc/middle/def_id.rs
浏览文件 @
2628f3cc
...
@@ -56,7 +56,7 @@ pub struct DefId {
...
@@ -56,7 +56,7 @@ pub struct DefId {
impl
fmt
::
Debug
for
DefId
{
impl
fmt
::
Debug
for
DefId
{
fn
fmt
(
&
self
,
f
:
&
mut
fmt
::
Formatter
)
->
fmt
::
Result
{
fn
fmt
(
&
self
,
f
:
&
mut
fmt
::
Formatter
)
->
fmt
::
Result
{
write!
(
f
,
"DefId {{ krate: {:?}, node: {:?}"
,
write!
(
f
,
"DefId {{ krate: {:?}, node: {:?}"
,
self
.krate
,
self
.index
)
?
;
self
.krate
,
self
.index
)
?
;
// Unfortunately, there seems to be no way to attempt to print
// Unfortunately, there seems to be no way to attempt to print
// a path for a def-id, so I'll just make a best effort for now
// a path for a def-id, so I'll just make a best effort for now
...
...
src/librustc/middle/infer/combine.rs
浏览文件 @
2628f3cc
...
@@ -71,9 +71,9 @@ pub fn super_combine_tys<'a,'tcx:'a,R>(infcx: &InferCtxt<'a, 'tcx>,
...
@@ -71,9 +71,9 @@ pub fn super_combine_tys<'a,'tcx:'a,R>(infcx: &InferCtxt<'a, 'tcx>,
// Relate integral variables to other types
// Relate integral variables to other types
(
&
ty
::
TyInfer
(
ty
::
IntVar
(
a_id
)),
&
ty
::
TyInfer
(
ty
::
IntVar
(
b_id
)))
=>
{
(
&
ty
::
TyInfer
(
ty
::
IntVar
(
a_id
)),
&
ty
::
TyInfer
(
ty
::
IntVar
(
b_id
)))
=>
{
infcx
.int_unification_table
infcx
.int_unification_table
.borrow_mut
()
.borrow_mut
()
.unify_var_var
(
a_id
,
b_id
)
.unify_var_var
(
a_id
,
b_id
)
.map_err
(|
e
|
int_unification_error
(
a_is_expected
,
e
))
?
;
.map_err
(|
e
|
int_unification_error
(
a_is_expected
,
e
))
?
;
Ok
(
a
)
Ok
(
a
)
}
}
(
&
ty
::
TyInfer
(
ty
::
IntVar
(
v_id
)),
&
ty
::
TyInt
(
v
))
=>
{
(
&
ty
::
TyInfer
(
ty
::
IntVar
(
v_id
)),
&
ty
::
TyInt
(
v
))
=>
{
...
@@ -92,9 +92,9 @@ pub fn super_combine_tys<'a,'tcx:'a,R>(infcx: &InferCtxt<'a, 'tcx>,
...
@@ -92,9 +92,9 @@ pub fn super_combine_tys<'a,'tcx:'a,R>(infcx: &InferCtxt<'a, 'tcx>,
// Relate floating-point variables to other types
// Relate floating-point variables to other types
(
&
ty
::
TyInfer
(
ty
::
FloatVar
(
a_id
)),
&
ty
::
TyInfer
(
ty
::
FloatVar
(
b_id
)))
=>
{
(
&
ty
::
TyInfer
(
ty
::
FloatVar
(
a_id
)),
&
ty
::
TyInfer
(
ty
::
FloatVar
(
b_id
)))
=>
{
infcx
.float_unification_table
infcx
.float_unification_table
.borrow_mut
()
.borrow_mut
()
.unify_var_var
(
a_id
,
b_id
)
.unify_var_var
(
a_id
,
b_id
)
.map_err
(|
e
|
float_unification_error
(
relation
.a_is_expected
(),
e
))
?
;
.map_err
(|
e
|
float_unification_error
(
relation
.a_is_expected
(),
e
))
?
;
Ok
(
a
)
Ok
(
a
)
}
}
(
&
ty
::
TyInfer
(
ty
::
FloatVar
(
v_id
)),
&
ty
::
TyFloat
(
v
))
=>
{
(
&
ty
::
TyInfer
(
ty
::
FloatVar
(
v_id
)),
&
ty
::
TyFloat
(
v
))
=>
{
...
@@ -123,8 +123,7 @@ fn unify_integral_variable<'a,'tcx>(infcx: &InferCtxt<'a,'tcx>,
...
@@ -123,8 +123,7 @@ fn unify_integral_variable<'a,'tcx>(infcx: &InferCtxt<'a,'tcx>,
val
:
ty
::
IntVarValue
)
val
:
ty
::
IntVarValue
)
->
RelateResult
<
'tcx
,
Ty
<
'tcx
>>
->
RelateResult
<
'tcx
,
Ty
<
'tcx
>>
{
{
infcx
infcx
.int_unification_table
.int_unification_table
.borrow_mut
()
.borrow_mut
()
.unify_var_value
(
vid
,
val
)
.unify_var_value
(
vid
,
val
)
.map_err
(|
e
|
int_unification_error
(
vid_is_expected
,
e
))
?
;
.map_err
(|
e
|
int_unification_error
(
vid_is_expected
,
e
))
?
;
...
@@ -140,8 +139,7 @@ fn unify_float_variable<'a,'tcx>(infcx: &InferCtxt<'a,'tcx>,
...
@@ -140,8 +139,7 @@ fn unify_float_variable<'a,'tcx>(infcx: &InferCtxt<'a,'tcx>,
val
:
ast
::
FloatTy
)
val
:
ast
::
FloatTy
)
->
RelateResult
<
'tcx
,
Ty
<
'tcx
>>
->
RelateResult
<
'tcx
,
Ty
<
'tcx
>>
{
{
infcx
infcx
.float_unification_table
.float_unification_table
.borrow_mut
()
.borrow_mut
()
.unify_var_value
(
vid
,
val
)
.unify_var_value
(
vid
,
val
)
.map_err
(|
e
|
float_unification_error
(
vid_is_expected
,
e
))
?
;
.map_err
(|
e
|
float_unification_error
(
vid_is_expected
,
e
))
?
;
...
...
src/librustc/middle/infer/sub.rs
浏览文件 @
2628f3cc
...
@@ -76,8 +76,8 @@ fn tys(&mut self, a: Ty<'tcx>, b: Ty<'tcx>) -> RelateResult<'tcx, Ty<'tcx>> {
...
@@ -76,8 +76,8 @@ fn tys(&mut self, a: Ty<'tcx>, b: Ty<'tcx>) -> RelateResult<'tcx, Ty<'tcx>> {
}
}
(
&
ty
::
TyInfer
(
TyVar
(
a_id
)),
_
)
=>
{
(
&
ty
::
TyInfer
(
TyVar
(
a_id
)),
_
)
=>
{
self
.fields
self
.fields
.switch_expected
()
.switch_expected
()
.instantiate
(
b
,
SupertypeOf
,
a_id
)
?
;
.instantiate
(
b
,
SupertypeOf
,
a_id
)
?
;
Ok
(
a
)
Ok
(
a
)
}
}
(
_
,
&
ty
::
TyInfer
(
TyVar
(
b_id
)))
=>
{
(
_
,
&
ty
::
TyInfer
(
TyVar
(
b_id
)))
=>
{
...
...
src/librustc/middle/traits/select.rs
浏览文件 @
2628f3cc
...
@@ -1038,15 +1038,15 @@ fn assemble_candidates<'o>(&mut self,
...
@@ -1038,15 +1038,15 @@ fn assemble_candidates<'o>(&mut self,
// For other types, we'll use the builtin rules.
// For other types, we'll use the builtin rules.
self
.assemble_builtin_bound_candidates
(
ty
::
BoundCopy
,
self
.assemble_builtin_bound_candidates
(
ty
::
BoundCopy
,
obligation
,
obligation
,
&
mut
candidates
)
?
;
&
mut
candidates
)
?
;
}
}
Some
(
bound
@
ty
::
BoundSized
)
=>
{
Some
(
bound
@
ty
::
BoundSized
)
=>
{
// Sized is never implementable by end-users, it is
// Sized is never implementable by end-users, it is
// always automatically computed.
// always automatically computed.
self
.assemble_builtin_bound_candidates
(
bound
,
self
.assemble_builtin_bound_candidates
(
bound
,
obligation
,
obligation
,
&
mut
candidates
)
?
;
&
mut
candidates
)
?
;
}
}
None
if
self
.tcx
()
.lang_items
.unsize_trait
()
==
None
if
self
.tcx
()
.lang_items
.unsize_trait
()
==
...
@@ -2422,8 +2422,8 @@ fn confirm_fn_pointer_candidate(&mut self,
...
@@ -2422,8 +2422,8 @@ fn confirm_fn_pointer_candidate(&mut self,
.map_bound
(|(
trait_ref
,
_
)|
trait_ref
);
.map_bound
(|(
trait_ref
,
_
)|
trait_ref
);
self
.confirm_poly_trait_refs
(
obligation
.cause
.clone
(),
self
.confirm_poly_trait_refs
(
obligation
.cause
.clone
(),
obligation
.predicate
.to_poly_trait_ref
(),
obligation
.predicate
.to_poly_trait_ref
(),
trait_ref
)
?
;
trait_ref
)
?
;
Ok
(
self_ty
)
Ok
(
self_ty
)
}
}
...
@@ -2450,8 +2450,8 @@ fn confirm_closure_candidate(&mut self,
...
@@ -2450,8 +2450,8 @@ fn confirm_closure_candidate(&mut self,
obligations
);
obligations
);
self
.confirm_poly_trait_refs
(
obligation
.cause
.clone
(),
self
.confirm_poly_trait_refs
(
obligation
.cause
.clone
(),
obligation
.predicate
.to_poly_trait_ref
(),
obligation
.predicate
.to_poly_trait_ref
(),
trait_ref
)
?
;
trait_ref
)
?
;
Ok
(
VtableClosureData
{
Ok
(
VtableClosureData
{
closure_def_id
:
closure_def_id
,
closure_def_id
:
closure_def_id
,
...
...
src/librustc/middle/ty/relate.rs
浏览文件 @
2628f3cc
...
@@ -167,9 +167,9 @@ pub fn relate_substs<'a,'tcx:'a,R>(relation: &mut R,
...
@@ -167,9 +167,9 @@ pub fn relate_substs<'a,'tcx:'a,R>(relation: &mut R,
let
b_regions
=
b
.get_slice
(
space
);
let
b_regions
=
b
.get_slice
(
space
);
let
r_variances
=
variances
.map
(|
v
|
v
.regions
.get_slice
(
space
));
let
r_variances
=
variances
.map
(|
v
|
v
.regions
.get_slice
(
space
));
let
regions
=
relate_region_params
(
relation
,
let
regions
=
relate_region_params
(
relation
,
r_variances
,
r_variances
,
a_regions
,
a_regions
,
b_regions
)
?
;
b_regions
)
?
;
substs
.mut_regions
()
.replace
(
space
,
regions
);
substs
.mut_regions
()
.replace
(
space
,
regions
);
}
}
}
}
...
@@ -261,8 +261,8 @@ fn relate<R>(relation: &mut R,
...
@@ -261,8 +261,8 @@ fn relate<R>(relation: &mut R,
}
}
let
inputs
=
relate_arg_vecs
(
relation
,
let
inputs
=
relate_arg_vecs
(
relation
,
&
a
.inputs
,
&
a
.inputs
,
&
b
.inputs
)
?
;
&
b
.inputs
)
?
;
let
output
=
match
(
a
.output
,
b
.output
)
{
let
output
=
match
(
a
.output
,
b
.output
)
{
(
ty
::
FnConverging
(
a_ty
),
ty
::
FnConverging
(
b_ty
))
=>
(
ty
::
FnConverging
(
a_ty
),
ty
::
FnConverging
(
b_ty
))
=>
...
@@ -557,8 +557,8 @@ pub fn super_relate_tys<'a,'tcx:'a,R>(relation: &mut R,
...
@@ -557,8 +557,8 @@ pub fn super_relate_tys<'a,'tcx:'a,R>(relation: &mut R,
{
{
if
as_
.len
()
==
bs
.len
()
{
if
as_
.len
()
==
bs
.len
()
{
let
ts
=
as_
.iter
()
.zip
(
bs
)
let
ts
=
as_
.iter
()
.zip
(
bs
)
.map
(|(
a
,
b
)|
relation
.relate
(
a
,
b
))
.map
(|(
a
,
b
)|
relation
.relate
(
a
,
b
))
.collect
::
<
Result
<
_
,
_
>>
()
?
;
.collect
::
<
Result
<
_
,
_
>>
()
?
;
Ok
(
tcx
.mk_tup
(
ts
))
Ok
(
tcx
.mk_tup
(
ts
))
}
else
if
!
(
as_
.is_empty
()
||
bs
.is_empty
())
{
}
else
if
!
(
as_
.is_empty
()
||
bs
.is_empty
())
{
Err
(
TypeError
::
TupleSize
(
Err
(
TypeError
::
TupleSize
(
...
...
src/librustc/mir/repr.rs
浏览文件 @
2628f3cc
...
@@ -809,8 +809,8 @@ fn fmt_tuple(fmt: &mut Formatter, lvs: &[Operand]) -> fmt::Result {
...
@@ -809,8 +809,8 @@ fn fmt_tuple(fmt: &mut Formatter, lvs: &[Operand]) -> fmt::Result {
let
variant_def
=
&
adt_def
.variants
[
variant
];
let
variant_def
=
&
adt_def
.variants
[
variant
];
ppaux
::
parameterized
(
fmt
,
substs
,
variant_def
.did
,
ppaux
::
parameterized
(
fmt
,
substs
,
variant_def
.did
,
ppaux
::
Ns
::
Value
,
&
[],
ppaux
::
Ns
::
Value
,
&
[],
|
tcx
|
{
|
tcx
|
{
tcx
.lookup_item_type
(
variant_def
.did
)
.generics
tcx
.lookup_item_type
(
variant_def
.did
)
.generics
})
?
;
})
?
;
...
...
src/librustc/util/ppaux.rs
浏览文件 @
2628f3cc
...
@@ -123,8 +123,8 @@ pub fn parameterized<GG>(f: &mut fmt::Formatter,
...
@@ -123,8 +123,8 @@ pub fn parameterized<GG>(f: &mut fmt::Formatter,
for
projection
in
projections
{
for
projection
in
projections
{
start_or_continue
(
f
,
"<"
,
", "
)
?
;
start_or_continue
(
f
,
"<"
,
", "
)
?
;
write!
(
f
,
"{}={}"
,
write!
(
f
,
"{}={}"
,
projection
.projection_ty.item_name
,
projection
.projection_ty.item_name
,
projection
.ty
)
?
;
projection
.ty
)
?
;
}
}
return
start_or_continue
(
f
,
""
,
">"
);
return
start_or_continue
(
f
,
""
,
">"
);
}
}
...
@@ -201,8 +201,8 @@ pub fn parameterized<GG>(f: &mut fmt::Formatter,
...
@@ -201,8 +201,8 @@ pub fn parameterized<GG>(f: &mut fmt::Formatter,
for
projection
in
projections
{
for
projection
in
projections
{
start_or_continue
(
f
,
"<"
,
", "
)
?
;
start_or_continue
(
f
,
"<"
,
", "
)
?
;
write!
(
f
,
"{}={}"
,
write!
(
f
,
"{}={}"
,
projection
.projection_ty.item_name
,
projection
.projection_ty.item_name
,
projection
.ty
)
?
;
projection
.ty
)
?
;
}
}
start_or_continue
(
f
,
""
,
">"
)
?
;
start_or_continue
(
f
,
""
,
">"
)
?
;
...
@@ -865,7 +865,7 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
...
@@ -865,7 +865,7 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!
(
f
,
"{} {{"
,
bare_fn
.sig
.0
)
?
;
write!
(
f
,
"{} {{"
,
bare_fn
.sig
.0
)
?
;
parameterized
(
f
,
substs
,
def_id
,
Ns
::
Value
,
&
[],
parameterized
(
f
,
substs
,
def_id
,
Ns
::
Value
,
&
[],
|
tcx
|
tcx
.lookup_item_type
(
def_id
)
.generics
)
?
;
|
tcx
|
tcx
.lookup_item_type
(
def_id
)
.generics
)
?
;
write!
(
f
,
"}}"
)
write!
(
f
,
"}}"
)
}
}
TyFnPtr
(
ref
bare_fn
)
=>
{
TyFnPtr
(
ref
bare_fn
)
=>
{
...
...
src/librustc_back/target/mod.rs
浏览文件 @
2628f3cc
...
@@ -468,7 +468,7 @@ fn load_file(path: &Path) -> Result<Target, String> {
...
@@ -468,7 +468,7 @@ fn load_file(path: &Path) -> Result<Target, String> {
let
mut
contents
=
Vec
::
new
();
let
mut
contents
=
Vec
::
new
();
f
.read_to_end
(
&
mut
contents
)
.map_err
(|
e
|
e
.to_string
())
?
;
f
.read_to_end
(
&
mut
contents
)
.map_err
(|
e
|
e
.to_string
())
?
;
let
obj
=
json
::
from_reader
(
&
mut
&
contents
[
..
])
let
obj
=
json
::
from_reader
(
&
mut
&
contents
[
..
])
.map_err
(|
e
|
e
.to_string
())
?
;
.map_err
(|
e
|
e
.to_string
())
?
;
Ok
(
Target
::
from_json
(
obj
))
Ok
(
Target
::
from_json
(
obj
))
}
}
...
...
src/librustc_borrowck/borrowck/mir/graphviz.rs
浏览文件 @
2628f3cc
...
@@ -124,15 +124,15 @@ fn chunked_present_left<W:io::Write>(w: &mut W,
...
@@ -124,15 +124,15 @@ fn chunked_present_left<W:io::Write>(w: &mut W,
write!
(
w
,
"</td><td></td><td></td></tr>"
)
?
;
write!
(
w
,
"</td><td></td><td></td></tr>"
)
?
;
}
}
write!
(
w
,
"<tr><td></td><td {bg} {align}>{objs:?}"
,
write!
(
w
,
"<tr><td></td><td {bg} {align}>{objs:?}"
,
bg
=
BG_FLOWCONTENT
,
bg
=
BG_FLOWCONTENT
,
align
=
ALIGN_RIGHT
,
align
=
ALIGN_RIGHT
,
objs
=
c
)
?
;
objs
=
c
)
?
;
seen_one
=
true
;
seen_one
=
true
;
}
}
if
!
seen_one
{
if
!
seen_one
{
write!
(
w
,
"<tr><td></td><td {bg} {align}>[]"
,
write!
(
w
,
"<tr><td></td><td {bg} {align}>[]"
,
bg
=
BG_FLOWCONTENT
,
bg
=
BG_FLOWCONTENT
,
align
=
ALIGN_RIGHT
)
?
;
align
=
ALIGN_RIGHT
)
?
;
}
}
Ok
(())
Ok
(())
}
}
...
@@ -155,18 +155,18 @@ fn chunked_present_left<W:io::Write>(w: &mut W,
...
@@ -155,18 +155,18 @@ fn chunked_present_left<W:io::Write>(w: &mut W,
let
kill
=
flow
.interpret_set
(
flow
.sets
.kill_set_for
(
i
));
let
kill
=
flow
.interpret_set
(
flow
.sets
.kill_set_for
(
i
));
chunked_present_left
(
w
,
&
gen
[
..
],
chunk_size
)
?
;
chunked_present_left
(
w
,
&
gen
[
..
],
chunk_size
)
?
;
write!
(
w
,
" = GEN:</td><td {bg}><FONT {face}>{genbits:?}</FONT></td>
\
write!
(
w
,
" = GEN:</td><td {bg}><FONT {face}>{genbits:?}</FONT></td>
\
<td></td></tr>"
,
<td></td></tr>"
,
bg
=
BG_FLOWCONTENT
,
bg
=
BG_FLOWCONTENT
,
face
=
FACE_MONOSPACE
,
face
=
FACE_MONOSPACE
,
genbits
=
bits_to_string
(
flow
.sets
.gen_set_for
(
i
),
genbits
=
bits_to_string
(
flow
.sets
.gen_set_for
(
i
),
flow
.sets
.bytes_per_block
()))
?
;
flow
.sets
.bytes_per_block
()))
?
;
write!
(
w
,
"<tr><td></td><td {bg} {align}>KILL:</td>
\
write!
(
w
,
"<tr><td></td><td {bg} {align}>KILL:</td>
\
<td {bg}><FONT {face}>{killbits:?}</FONT></td>"
,
<td {bg}><FONT {face}>{killbits:?}</FONT></td>"
,
bg
=
BG_FLOWCONTENT
,
bg
=
BG_FLOWCONTENT
,
align
=
ALIGN_RIGHT
,
align
=
ALIGN_RIGHT
,
face
=
FACE_MONOSPACE
,
face
=
FACE_MONOSPACE
,
killbits
=
bits_to_string
(
flow
.sets
.kill_set_for
(
i
),
killbits
=
bits_to_string
(
flow
.sets
.kill_set_for
(
i
),
flow
.sets
.bytes_per_block
()))
?
;
flow
.sets
.bytes_per_block
()))
?
;
// (chunked_present_right)
// (chunked_present_right)
let
mut
seen_one
=
false
;
let
mut
seen_one
=
false
;
...
@@ -174,19 +174,19 @@ fn chunked_present_left<W:io::Write>(w: &mut W,
...
@@ -174,19 +174,19 @@ fn chunked_present_left<W:io::Write>(w: &mut W,
if
!
seen_one
{
if
!
seen_one
{
// continuation of row; this is fourth <td>
// continuation of row; this is fourth <td>
write!
(
w
,
"<td {bg}>= {kill:?}</td></tr>"
,
write!
(
w
,
"<td {bg}>= {kill:?}</td></tr>"
,
bg
=
BG_FLOWCONTENT
,
bg
=
BG_FLOWCONTENT
,
kill
=
k
)
?
;
kill
=
k
)
?
;
}
else
{
}
else
{
// new row, with indent of three <td>'s
// new row, with indent of three <td>'s
write!
(
w
,
"<tr><td></td><td></td><td></td><td {bg}>{kill:?}</td></tr>"
,
write!
(
w
,
"<tr><td></td><td></td><td></td><td {bg}>{kill:?}</td></tr>"
,
bg
=
BG_FLOWCONTENT
,
bg
=
BG_FLOWCONTENT
,
kill
=
k
)
?
;
kill
=
k
)
?
;
}
}
seen_one
=
true
;
seen_one
=
true
;
}
}
if
!
seen_one
{
if
!
seen_one
{
write!
(
w
,
"<td {bg}>= []</td></tr>"
,
write!
(
w
,
"<td {bg}>= []</td></tr>"
,
bg
=
BG_FLOWCONTENT
)
?
;
bg
=
BG_FLOWCONTENT
)
?
;
}
}
Ok
(())
Ok
(())
...
...
src/librustc_driver/driver.rs
浏览文件 @
2628f3cc
...
@@ -100,10 +100,10 @@ pub fn compile_input(sess: &Session,
...
@@ -100,10 +100,10 @@ pub fn compile_input(sess: &Session,
let
outputs
=
build_output_filenames
(
input
,
outdir
,
output
,
&
krate
.attrs
,
sess
);
let
outputs
=
build_output_filenames
(
input
,
outdir
,
output
,
&
krate
.attrs
,
sess
);
let
id
=
link
::
find_crate_name
(
Some
(
sess
),
&
krate
.attrs
,
input
);
let
id
=
link
::
find_crate_name
(
Some
(
sess
),
&
krate
.attrs
,
input
);
let
expanded_crate
=
phase_2_configure_and_expand
(
sess
,
let
expanded_crate
=
phase_2_configure_and_expand
(
sess
,
&
cstore
,
&
cstore
,
krate
,
krate
,
&
id
[
..
],
&
id
[
..
],
addl_plugins
)
?
;
addl_plugins
)
?
;
(
outputs
,
expanded_crate
,
id
)
(
outputs
,
expanded_crate
,
id
)
};
};
...
@@ -169,12 +169,12 @@ pub fn compile_input(sess: &Session,
...
@@ -169,12 +169,12 @@ pub fn compile_input(sess: &Session,
};
};
phase_3_run_analysis_passes
(
sess
,
phase_3_run_analysis_passes
(
sess
,
&
cstore
,
&
cstore
,
hir_map
,
hir_map
,
&
arenas
,
&
arenas
,
&
id
,
&
id
,
control
.make_glob_map
,
control
.make_glob_map
,
|
tcx
,
mir_map
,
analysis
,
result
|
{
|
tcx
,
mir_map
,
analysis
,
result
|
{
{
{
// Eventually, we will want to track plugins.
// Eventually, we will want to track plugins.
let
_
ignore
=
tcx
.dep_graph
.in_ignore
();
let
_
ignore
=
tcx
.dep_graph
.in_ignore
();
...
@@ -683,8 +683,8 @@ pub fn phase_2_configure_and_expand(sess: &Session,
...
@@ -683,8 +683,8 @@ pub fn phase_2_configure_and_expand(sess: &Session,
})
?
;
})
?
;
time
(
time_passes
,
time
(
time_passes
,
"const fn bodies and arguments"
,
"const fn bodies and arguments"
,
||
const_fn
::
check_crate
(
sess
,
&
krate
))
?
;
||
const_fn
::
check_crate
(
sess
,
&
krate
))
?
;
if
sess
.opts.debugging_opts.input_stats
{
if
sess
.opts.debugging_opts.input_stats
{
println!
(
"Post-expansion node count: {}"
,
count_nodes
(
&
krate
));
println!
(
"Post-expansion node count: {}"
,
count_nodes
(
&
krate
));
...
@@ -781,10 +781,10 @@ pub fn phase_3_run_analysis_passes<'tcx, F, R>(sess: &'tcx Session,
...
@@ -781,10 +781,10 @@ pub fn phase_3_run_analysis_passes<'tcx, F, R>(sess: &'tcx Session,
};
};
let
named_region_map
=
time
(
time_passes
,
let
named_region_map
=
time
(
time_passes
,
"lifetime resolution"
,
"lifetime resolution"
,
||
middle
::
resolve_lifetime
::
krate
(
sess
,
||
middle
::
resolve_lifetime
::
krate
(
sess
,
&
hir_map
,
&
hir_map
,
&
def_map
.borrow
()))
?
;
&
def_map
.borrow
()))
?
;
time
(
time_passes
,
time
(
time_passes
,
"looking for entry point"
,
"looking for entry point"
,
...
...
src/librustc_front/print/pprust.rs
浏览文件 @
2628f3cc
...
@@ -288,13 +288,13 @@ pub fn fun_to_string(decl: &hir::FnDecl,
...
@@ -288,13 +288,13 @@ pub fn fun_to_string(decl: &hir::FnDecl,
to_string
(|
s
|
{
to_string
(|
s
|
{
s
.head
(
""
)
?
;
s
.head
(
""
)
?
;
s
.print_fn
(
decl
,
s
.print_fn
(
decl
,
unsafety
,
unsafety
,
constness
,
constness
,
Abi
::
Rust
,
Abi
::
Rust
,
Some
(
name
),
Some
(
name
),
generics
,
generics
,
opt_explicit_self
,
opt_explicit_self
,
hir
::
Inherited
)
?
;
hir
::
Inherited
)
?
;
s
.end
()
?
;
// Close the head box
s
.end
()
?
;
// Close the head box
s
.end
()
// Close the outer box
s
.end
()
// Close the outer box
})
})
...
@@ -567,13 +567,13 @@ pub fn print_foreign_item(&mut self, item: &hir::ForeignItem) -> io::Result<()>
...
@@ -567,13 +567,13 @@ pub fn print_foreign_item(&mut self, item: &hir::ForeignItem) -> io::Result<()>
hir
::
ForeignItemFn
(
ref
decl
,
ref
generics
)
=>
{
hir
::
ForeignItemFn
(
ref
decl
,
ref
generics
)
=>
{
self
.head
(
""
)
?
;
self
.head
(
""
)
?
;
self
.print_fn
(
decl
,
self
.print_fn
(
decl
,
hir
::
Unsafety
::
Normal
,
hir
::
Unsafety
::
Normal
,
hir
::
Constness
::
NotConst
,
hir
::
Constness
::
NotConst
,
Abi
::
Rust
,
Abi
::
Rust
,
Some
(
item
.name
),
Some
(
item
.name
),
generics
,
generics
,
None
,
None
,
item
.vis
)
?
;
item
.vis
)
?
;
self
.end
()
?
;
// end head-ibox
self
.end
()
?
;
// end head-ibox
word
(
&
mut
self
.s
,
";"
)
?
;
word
(
&
mut
self
.s
,
";"
)
?
;
self
.end
()
// end the outer fn box
self
.end
()
// end the outer fn box
...
@@ -704,13 +704,13 @@ pub fn print_item(&mut self, item: &hir::Item) -> io::Result<()> {
...
@@ -704,13 +704,13 @@ pub fn print_item(&mut self, item: &hir::Item) -> io::Result<()> {
hir
::
ItemFn
(
ref
decl
,
unsafety
,
constness
,
abi
,
ref
typarams
,
ref
body
)
=>
{
hir
::
ItemFn
(
ref
decl
,
unsafety
,
constness
,
abi
,
ref
typarams
,
ref
body
)
=>
{
self
.head
(
""
)
?
;
self
.head
(
""
)
?
;
self
.print_fn
(
decl
,
self
.print_fn
(
decl
,
unsafety
,
unsafety
,
constness
,
constness
,
abi
,
abi
,
Some
(
item
.name
),
Some
(
item
.name
),
typarams
,
typarams
,
None
,
None
,
item
.vis
)
?
;
item
.vis
)
?
;
word
(
&
mut
self
.s
,
" "
)
?
;
word
(
&
mut
self
.s
,
" "
)
?
;
self
.print_block_with_attrs
(
&
body
,
&
item
.attrs
)
?
;
self
.print_block_with_attrs
(
&
body
,
&
item
.attrs
)
?
;
}
}
...
@@ -984,9 +984,9 @@ pub fn print_trait_item(&mut self, ti: &hir::TraitItem) -> io::Result<()> {
...
@@ -984,9 +984,9 @@ pub fn print_trait_item(&mut self, ti: &hir::TraitItem) -> io::Result<()> {
match
ti
.node
{
match
ti
.node
{
hir
::
ConstTraitItem
(
ref
ty
,
ref
default
)
=>
{
hir
::
ConstTraitItem
(
ref
ty
,
ref
default
)
=>
{
self
.print_associated_const
(
ti
.name
,
self
.print_associated_const
(
ti
.name
,
&
ty
,
&
ty
,
default
.as_ref
()
.map
(|
expr
|
&**
expr
),
default
.as_ref
()
.map
(|
expr
|
&**
expr
),
hir
::
Inherited
)
?
;
hir
::
Inherited
)
?
;
}
}
hir
::
MethodTraitItem
(
ref
sig
,
ref
body
)
=>
{
hir
::
MethodTraitItem
(
ref
sig
,
ref
body
)
=>
{
if
body
.is_some
()
{
if
body
.is_some
()
{
...
@@ -1002,8 +1002,8 @@ pub fn print_trait_item(&mut self, ti: &hir::TraitItem) -> io::Result<()> {
...
@@ -1002,8 +1002,8 @@ pub fn print_trait_item(&mut self, ti: &hir::TraitItem) -> io::Result<()> {
}
}
hir
::
TypeTraitItem
(
ref
bounds
,
ref
default
)
=>
{
hir
::
TypeTraitItem
(
ref
bounds
,
ref
default
)
=>
{
self
.print_associated_type
(
ti
.name
,
self
.print_associated_type
(
ti
.name
,
Some
(
bounds
),
Some
(
bounds
),
default
.as_ref
()
.map
(|
ty
|
&**
ty
))
?
;
default
.as_ref
()
.map
(|
ty
|
&**
ty
))
?
;
}
}
}
}
self
.ann
.post
(
self
,
NodeSubItem
(
ti
.id
))
self
.ann
.post
(
self
,
NodeSubItem
(
ti
.id
))
...
@@ -1219,15 +1219,15 @@ fn print_expr_struct(&mut self,
...
@@ -1219,15 +1219,15 @@ fn print_expr_struct(&mut self,
self
.print_path
(
path
,
true
,
0
)
?
;
self
.print_path
(
path
,
true
,
0
)
?
;
word
(
&
mut
self
.s
,
"{"
)
?
;
word
(
&
mut
self
.s
,
"{"
)
?
;
self
.commasep_cmnt
(
Consistent
,
self
.commasep_cmnt
(
Consistent
,
&
fields
[
..
],
&
fields
[
..
],
|
s
,
field
|
{
|
s
,
field
|
{
s
.ibox
(
indent_unit
)
?
;
s
.ibox
(
indent_unit
)
?
;
s
.print_name
(
field
.name.node
)
?
;
s
.print_name
(
field
.name.node
)
?
;
s
.word_space
(
":"
)
?
;
s
.word_space
(
":"
)
?
;
s
.print_expr
(
&
field
.expr
)
?
;
s
.print_expr
(
&
field
.expr
)
?
;
s
.end
()
s
.end
()
},
},
|
f
|
f
.span
)
?
;
|
f
|
f
.span
)
?
;
match
*
wth
{
match
*
wth
{
Some
(
ref
expr
)
=>
{
Some
(
ref
expr
)
=>
{
self
.ibox
(
indent_unit
)
?
;
self
.ibox
(
indent_unit
)
?
;
...
@@ -1760,17 +1760,17 @@ pub fn print_pat(&mut self, pat: &hir::Pat) -> io::Result<()> {
...
@@ -1760,17 +1760,17 @@ pub fn print_pat(&mut self, pat: &hir::Pat) -> io::Result<()> {
self
.nbsp
()
?
;
self
.nbsp
()
?
;
self
.word_space
(
"{"
)
?
;
self
.word_space
(
"{"
)
?
;
self
.commasep_cmnt
(
Consistent
,
self
.commasep_cmnt
(
Consistent
,
&
fields
[
..
],
&
fields
[
..
],
|
s
,
f
|
{
|
s
,
f
|
{
s
.cbox
(
indent_unit
)
?
;
s
.cbox
(
indent_unit
)
?
;
if
!
f
.node.is_shorthand
{
if
!
f
.node.is_shorthand
{
s
.print_name
(
f
.node.name
)
?
;
s
.print_name
(
f
.node.name
)
?
;
s
.word_nbsp
(
":"
)
?
;
s
.word_nbsp
(
":"
)
?
;
}
}
s
.print_pat
(
&
f
.node.pat
)
?
;
s
.print_pat
(
&
f
.node.pat
)
?
;
s
.end
()
s
.end
()
},
},
|
f
|
f
.node.pat.span
)
?
;
|
f
|
f
.node.pat.span
)
?
;
if
etc
{
if
etc
{
if
!
fields
.is_empty
()
{
if
!
fields
.is_empty
()
{
self
.word_space
(
","
)
?
;
self
.word_space
(
","
)
?
;
...
@@ -2261,13 +2261,13 @@ pub fn print_ty_fn(&mut self,
...
@@ -2261,13 +2261,13 @@ pub fn print_ty_fn(&mut self,
},
},
};
};
self
.print_fn
(
decl
,
self
.print_fn
(
decl
,
unsafety
,
unsafety
,
hir
::
Constness
::
NotConst
,
hir
::
Constness
::
NotConst
,
abi
,
abi
,
name
,
name
,
&
generics
,
&
generics
,
opt_explicit_self
,
opt_explicit_self
,
hir
::
Inherited
)
?
;
hir
::
Inherited
)
?
;
self
.end
()
self
.end
()
}
}
...
...
src/librustc_mir/graphviz.rs
浏览文件 @
2628f3cc
...
@@ -65,9 +65,9 @@ pub fn write_node_label<W: Write, INIT, FINI>(block: BasicBlock,
...
@@ -65,9 +65,9 @@ pub fn write_node_label<W: Write, INIT, FINI>(block: BasicBlock,
// Basic block number at the top.
// Basic block number at the top.
write!
(
w
,
r#"<tr><td {attrs} colspan="{colspan}">{blk}</td></tr>"#
,
write!
(
w
,
r#"<tr><td {attrs} colspan="{colspan}">{blk}</td></tr>"#
,
attrs
=
r#"bgcolor="gray" align="center""#
,
attrs
=
r#"bgcolor="gray" align="center""#
,
colspan
=
num_cols
,
colspan
=
num_cols
,
blk
=
block
.index
())
?
;
blk
=
block
.index
())
?
;
init
(
w
)
?
;
init
(
w
)
?
;
...
@@ -145,13 +145,13 @@ fn write_graph_label<W: Write>(tcx: &ty::TyCtxt, nid: NodeId, mir: &Mir, w: &mut
...
@@ -145,13 +145,13 @@ fn write_graph_label<W: Write>(tcx: &ty::TyCtxt, nid: NodeId, mir: &Mir, w: &mut
write!
(
w
,
"mut "
)
?
;
write!
(
w
,
"mut "
)
?
;
}
}
write!
(
w
,
r#"{:?}: {}; // {}<br align="left"/>"#
,
write!
(
w
,
r#"{:?}: {}; // {}<br align="left"/>"#
,
Lvalue
::
Var
(
i
as
u32
),
escape
(
&
var
.ty
),
var
.name
)
?
;
Lvalue
::
Var
(
i
as
u32
),
escape
(
&
var
.ty
),
var
.name
)
?
;
}
}
// Compiler-introduced temporary types.
// Compiler-introduced temporary types.
for
(
i
,
temp
)
in
mir
.temp_decls
.iter
()
.enumerate
()
{
for
(
i
,
temp
)
in
mir
.temp_decls
.iter
()
.enumerate
()
{
write!
(
w
,
r#"let mut {:?}: {};<br align="left"/>"#
,
write!
(
w
,
r#"let mut {:?}: {};<br align="left"/>"#
,
Lvalue
::
Temp
(
i
as
u32
),
escape
(
&
temp
.ty
))
?
;
Lvalue
::
Temp
(
i
as
u32
),
escape
(
&
temp
.ty
))
?
;
}
}
writeln!
(
w
,
">;"
)
writeln!
(
w
,
">;"
)
...
...
src/librustc_trans/back/archive.rs
浏览文件 @
2628f3cc
...
@@ -255,7 +255,7 @@ fn build_with_ar_cmd(&mut self) -> io::Result<()> {
...
@@ -255,7 +255,7 @@ fn build_with_ar_cmd(&mut self) -> io::Result<()> {
// permission bits.
// permission bits.
if
let
Some
(
ref
s
)
=
self
.config.src
{
if
let
Some
(
ref
s
)
=
self
.config.src
{
io
::
copy
(
&
mut
File
::
open
(
s
)
?
,
io
::
copy
(
&
mut
File
::
open
(
s
)
?
,
&
mut
File
::
create
(
&
self
.config.dst
)
?
)
?
;
&
mut
File
::
create
(
&
self
.config.dst
)
?
)
?
;
}
}
if
removals
.len
()
>
0
{
if
removals
.len
()
>
0
{
...
@@ -272,7 +272,7 @@ fn build_with_ar_cmd(&mut self) -> io::Result<()> {
...
@@ -272,7 +272,7 @@ fn build_with_ar_cmd(&mut self) -> io::Result<()> {
}
}
Addition
::
Archive
{
archive
,
archive_name
,
mut
skip
}
=>
{
Addition
::
Archive
{
archive
,
archive_name
,
mut
skip
}
=>
{
self
.add_archive_members
(
&
mut
members
,
archive
,
self
.add_archive_members
(
&
mut
members
,
archive
,
&
archive_name
,
&
mut
*
skip
)
?
;
&
archive_name
,
&
mut
*
skip
)
?
;
}
}
}
}
}
}
...
...
src/librustc_trans/trans/consts.rs
浏览文件 @
2628f3cc
...
@@ -976,7 +976,7 @@ fn const_expr_unadjusted<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
...
@@ -976,7 +976,7 @@ fn const_expr_unadjusted<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
let
method_call
=
ty
::
MethodCall
::
expr
(
e
.id
);
let
method_call
=
ty
::
MethodCall
::
expr
(
e
.id
);
let
method
=
cx
.tcx
()
.tables
.borrow
()
.method_map
[
&
method_call
];
let
method
=
cx
.tcx
()
.tables
.borrow
()
.method_map
[
&
method_call
];
const_fn_call
(
cx
,
method
.def_id
,
method
.substs
.clone
(),
const_fn_call
(
cx
,
method
.def_id
,
method
.substs
.clone
(),
&
arg_vals
,
param_substs
,
trueconst
)
?
&
arg_vals
,
param_substs
,
trueconst
)
?
},
},
hir
::
ExprType
(
ref
e
,
_
)
=>
const_expr
(
cx
,
&
e
,
param_substs
,
fn_args
,
trueconst
)
?
.0
,
hir
::
ExprType
(
ref
e
,
_
)
=>
const_expr
(
cx
,
&
e
,
param_substs
,
fn_args
,
trueconst
)
?
.0
,
hir
::
ExprBlock
(
ref
block
)
=>
{
hir
::
ExprBlock
(
ref
block
)
=>
{
...
...
src/librustc_typeck/astconv.rs
浏览文件 @
2628f3cc
...
@@ -954,10 +954,10 @@ fn ast_type_binding_to_poly_projection_predicate<'tcx>(
...
@@ -954,10 +954,10 @@ fn ast_type_binding_to_poly_projection_predicate<'tcx>(
}
}
let
candidate
=
one_bound_for_assoc_type
(
tcx
,
let
candidate
=
one_bound_for_assoc_type
(
tcx
,
candidates
,
candidates
,
&
trait_ref
.to_string
(),
&
trait_ref
.to_string
(),
&
binding
.item_name
.as_str
(),
&
binding
.item_name
.as_str
(),
binding
.span
)
?
;
binding
.span
)
?
;
Ok
(
ty
::
Binder
(
ty
::
ProjectionPredicate
{
// <-------------------------+
Ok
(
ty
::
Binder
(
ty
::
ProjectionPredicate
{
// <-------------------------+
projection_ty
:
ty
::
ProjectionTy
{
// |
projection_ty
:
ty
::
ProjectionTy
{
// |
...
...
src/librustc_typeck/check/dropck.rs
浏览文件 @
2628f3cc
...
@@ -47,10 +47,10 @@ pub fn check_drop_impl(tcx: &TyCtxt, drop_impl_did: DefId) -> Result<(), ()> {
...
@@ -47,10 +47,10 @@ pub fn check_drop_impl(tcx: &TyCtxt, drop_impl_did: DefId) -> Result<(), ()> {
ty
::
TyEnum
(
adt_def
,
self_to_impl_substs
)
|
ty
::
TyEnum
(
adt_def
,
self_to_impl_substs
)
|
ty
::
TyStruct
(
adt_def
,
self_to_impl_substs
)
=>
{
ty
::
TyStruct
(
adt_def
,
self_to_impl_substs
)
=>
{
ensure_drop_params_and_item_params_correspond
(
tcx
,
ensure_drop_params_and_item_params_correspond
(
tcx
,
drop_impl_did
,
drop_impl_did
,
dtor_generics
,
dtor_generics
,
&
dtor_self_type
,
&
dtor_self_type
,
adt_def
.did
)
?
;
adt_def
.did
)
?
;
ensure_drop_predicates_are_implied_by_item_defn
(
tcx
,
ensure_drop_predicates_are_implied_by_item_defn
(
tcx
,
drop_impl_did
,
drop_impl_did
,
...
@@ -469,8 +469,7 @@ fn iterate_over_potentially_unsafe_regions_in_type<'a, 'b, 'tcx>(
...
@@ -469,8 +469,7 @@ fn iterate_over_potentially_unsafe_regions_in_type<'a, 'b, 'tcx>(
ty
::
TyTuple
(
ref
tys
)
|
ty
::
TyTuple
(
ref
tys
)
|
ty
::
TyClosure
(
_
,
box
ty
::
ClosureSubsts
{
upvar_tys
:
ref
tys
,
..
})
=>
{
ty
::
TyClosure
(
_
,
box
ty
::
ClosureSubsts
{
upvar_tys
:
ref
tys
,
..
})
=>
{
for
ty
in
tys
{
for
ty
in
tys
{
iterate_over_potentially_unsafe_regions_in_type
(
iterate_over_potentially_unsafe_regions_in_type
(
cx
,
context
,
ty
,
depth
+
1
)
?
cx
,
context
,
ty
,
depth
+
1
)
?
}
}
Ok
(())
Ok
(())
}
}
...
...
src/librustc_typeck/lib.rs
浏览文件 @
2628f3cc
...
@@ -354,17 +354,13 @@ pub fn check_crate(tcx: &TyCtxt, trait_map: ty::TraitMap) -> CompileResult {
...
@@ -354,17 +354,13 @@ pub fn check_crate(tcx: &TyCtxt, trait_map: ty::TraitMap) -> CompileResult {
coherence
::
check_coherence
(
&
ccx
));
coherence
::
check_coherence
(
&
ccx
));
})
?
;
})
?
;
time
(
time_passes
,
"wf checking"
,
||
time
(
time_passes
,
"wf checking"
,
||
check
::
check_wf_new
(
&
ccx
))
?
;
check
::
check_wf_new
(
&
ccx
))
?
;
time
(
time_passes
,
"item-types checking"
,
||
time
(
time_passes
,
"item-types checking"
,
||
check
::
check_item_types
(
&
ccx
))
?
;
check
::
check_item_types
(
&
ccx
))
?
;
time
(
time_passes
,
"item-bodies checking"
,
||
time
(
time_passes
,
"item-bodies checking"
,
||
check
::
check_item_bodies
(
&
ccx
))
?
;
check
::
check_item_bodies
(
&
ccx
))
?
;
time
(
time_passes
,
"drop-impl checking"
,
||
time
(
time_passes
,
"drop-impl checking"
,
||
check
::
check_drop_impls
(
&
ccx
))
?
;
check
::
check_drop_impls
(
&
ccx
))
?
;
check_for_entry_fn
(
&
ccx
);
check_for_entry_fn
(
&
ccx
);
...
...
src/librustdoc/html/format.rs
浏览文件 @
2628f3cc
...
@@ -344,9 +344,9 @@ fn resolved_path(w: &mut fmt::Formatter, did: DefId, path: &clean::Path,
...
@@ -344,9 +344,9 @@ fn resolved_path(w: &mut fmt::Formatter, did: DefId, path: &clean::Path,
root
.push_str
(
&
seg
.name
);
root
.push_str
(
&
seg
.name
);
root
.push_str
(
"/"
);
root
.push_str
(
"/"
);
write!
(
w
,
"<a class='mod'
write!
(
w
,
"<a class='mod'
href='{}index.html'>{}</a>::"
,
href='{}index.html'>{}</a>::"
,
root
,
root
,
seg
.name
)
?
;
seg
.name
)
?
;
}
}
}
}
}
}
...
@@ -361,7 +361,7 @@ fn resolved_path(w: &mut fmt::Formatter, did: DefId, path: &clean::Path,
...
@@ -361,7 +361,7 @@ fn resolved_path(w: &mut fmt::Formatter, did: DefId, path: &clean::Path,
match
href
(
did
)
{
match
href
(
did
)
{
Some
((
url
,
shortty
,
fqp
))
=>
{
Some
((
url
,
shortty
,
fqp
))
=>
{
write!
(
w
,
"<a class='{}' href='{}' title='{}'>{}</a>"
,
write!
(
w
,
"<a class='{}' href='{}' title='{}'>{}</a>"
,
shortty
,
url
,
fqp
.join
(
"::"
),
last
.name
)
?
;
shortty
,
url
,
fqp
.join
(
"::"
),
last
.name
)
?
;
}
}
_
=>
write!
(
w
,
"{}"
,
last
.name
)
?
,
_
=>
write!
(
w
,
"{}"
,
last
.name
)
?
,
}
}
...
@@ -379,8 +379,8 @@ fn primitive_link(f: &mut fmt::Formatter,
...
@@ -379,8 +379,8 @@ fn primitive_link(f: &mut fmt::Formatter,
let
len
=
CURRENT_LOCATION_KEY
.with
(|
s
|
s
.borrow
()
.len
());
let
len
=
CURRENT_LOCATION_KEY
.with
(|
s
|
s
.borrow
()
.len
());
let
len
=
if
len
==
0
{
0
}
else
{
len
-
1
};
let
len
=
if
len
==
0
{
0
}
else
{
len
-
1
};
write!
(
f
,
"<a class='primitive' href='{}primitive.{}.html'>"
,
write!
(
f
,
"<a class='primitive' href='{}primitive.{}.html'>"
,
repeat
(
"../"
)
.take
(
len
)
.collect
::
<
String
>
(),
repeat
(
"../"
)
.take
(
len
)
.collect
::
<
String
>
(),
prim
.to_url_str
())
?
;
prim
.to_url_str
())
?
;
needs_termination
=
true
;
needs_termination
=
true
;
}
}
Some
(
&
cnum
)
=>
{
Some
(
&
cnum
)
=>
{
...
@@ -399,9 +399,9 @@ fn primitive_link(f: &mut fmt::Formatter,
...
@@ -399,9 +399,9 @@ fn primitive_link(f: &mut fmt::Formatter,
match
loc
{
match
loc
{
Some
(
root
)
=>
{
Some
(
root
)
=>
{
write!
(
f
,
"<a class='primitive' href='{}{}/primitive.{}.html'>"
,
write!
(
f
,
"<a class='primitive' href='{}{}/primitive.{}.html'>"
,
root
,
root
,
path
.0
.first
()
.unwrap
(),
path
.0
.first
()
.unwrap
(),
prim
.to_url_str
())
?
;
prim
.to_url_str
())
?
;
needs_termination
=
true
;
needs_termination
=
true
;
}
}
None
=>
{}
None
=>
{}
...
@@ -490,7 +490,7 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
...
@@ -490,7 +490,7 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
}
}
_
=>
{
_
=>
{
primitive_link
(
f
,
clean
::
PrimitiveType
::
PrimitiveRawPointer
,
primitive_link
(
f
,
clean
::
PrimitiveType
::
PrimitiveRawPointer
,
&
format!
(
"*{}"
,
RawMutableSpace
(
m
)))
?
;
&
format!
(
"*{}"
,
RawMutableSpace
(
m
)))
?
;
write!
(
f
,
"{}"
,
t
)
write!
(
f
,
"{}"
,
t
)
}
}
}
}
...
@@ -508,8 +508,7 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
...
@@ -508,8 +508,7 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
primitive_link
(
f
,
clean
::
Slice
,
primitive_link
(
f
,
clean
::
Slice
,
&
format!
(
"&{}{}[{}]"
,
lt
,
m
,
**
bt
)),
&
format!
(
"&{}{}[{}]"
,
lt
,
m
,
**
bt
)),
_
=>
{
_
=>
{
primitive_link
(
f
,
clean
::
Slice
,
primitive_link
(
f
,
clean
::
Slice
,
&
format!
(
"&{}{}["
,
lt
,
m
))
?
;
&
format!
(
"&{}{}["
,
lt
,
m
))
?
;
write!
(
f
,
"{}"
,
**
bt
)
?
;
write!
(
f
,
"{}"
,
**
bt
)
?
;
primitive_link
(
f
,
clean
::
Slice
,
"]"
)
primitive_link
(
f
,
clean
::
Slice
,
"]"
)
}
}
...
@@ -567,8 +566,8 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
...
@@ -567,8 +566,8 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!
(
f
,
"impl{} "
,
self
.generics
)
?
;
write!
(
f
,
"impl{} "
,
self
.generics
)
?
;
if
let
Some
(
ref
ty
)
=
self
.trait_
{
if
let
Some
(
ref
ty
)
=
self
.trait_
{
write!
(
f
,
"{}{} for "
,
write!
(
f
,
"{}{} for "
,
if
self
.polarity
==
Some
(
clean
::
ImplPolarity
::
Negative
)
{
"!"
}
else
{
""
},
if
self
.polarity
==
Some
(
clean
::
ImplPolarity
::
Negative
)
{
"!"
}
else
{
""
},
*
ty
)
?
;
*
ty
)
?
;
}
}
write!
(
f
,
"{}{}"
,
self
.for_
,
WhereClause
(
&
self
.generics
))
?
;
write!
(
f
,
"{}{}"
,
self
.for_
,
WhereClause
(
&
self
.generics
))
?
;
Ok
(())
Ok
(())
...
...
src/librustdoc/html/highlight.rs
浏览文件 @
2628f3cc
...
@@ -71,7 +71,7 @@ fn doit(sess: &parse::ParseSess, mut lexer: lexer::StringReader,
...
@@ -71,7 +71,7 @@ fn doit(sess: &parse::ParseSess, mut lexer: lexer::StringReader,
},
},
token
::
Comment
=>
{
token
::
Comment
=>
{
write!
(
out
,
"<span class='comment'>{}</span>"
,
write!
(
out
,
"<span class='comment'>{}</span>"
,
Escape
(
&
snip
(
next
.sp
)))
?
;
Escape
(
&
snip
(
next
.sp
)))
?
;
continue
continue
},
},
token
::
Shebang
(
s
)
=>
{
token
::
Shebang
(
s
)
=>
{
...
@@ -180,8 +180,7 @@ fn doit(sess: &parse::ParseSess, mut lexer: lexer::StringReader,
...
@@ -180,8 +180,7 @@ fn doit(sess: &parse::ParseSess, mut lexer: lexer::StringReader,
if
klass
==
""
{
if
klass
==
""
{
write!
(
out
,
"{}"
,
Escape
(
&
snip
))
?
;
write!
(
out
,
"{}"
,
Escape
(
&
snip
))
?
;
}
else
{
}
else
{
write!
(
out
,
"<span class='{}'>{}</span>"
,
klass
,
write!
(
out
,
"<span class='{}'>{}</span>"
,
klass
,
Escape
(
&
snip
))
?
;
Escape
(
&
snip
))
?
;
}
}
}
}
...
...
src/librustdoc/html/render.rs
浏览文件 @
2628f3cc
此差异已折叠。
点击以展开。
src/librustdoc/html/toc.rs
浏览文件 @
2628f3cc
...
@@ -188,10 +188,10 @@ fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
...
@@ -188,10 +188,10 @@ fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
// recursively format this table of contents (the
// recursively format this table of contents (the
// `{children}` is the key).
// `{children}` is the key).
write!
(
fmt
,
write!
(
fmt
,
"
\n
<li><a href=
\"
#{id}
\"
>{num} {name}</a>{children}</li>"
,
"
\n
<li><a href=
\"
#{id}
\"
>{num} {name}</a>{children}</li>"
,
id
=
entry
.id
,
id
=
entry
.id
,
num
=
entry
.sec_number
,
name
=
entry
.name
,
num
=
entry
.sec_number
,
name
=
entry
.name
,
children
=
entry
.children
)
?
children
=
entry
.children
)
?
}
}
write!
(
fmt
,
"</ul>"
)
write!
(
fmt
,
"</ul>"
)
}
}
...
...
src/libstd/sys/common/net.rs
浏览文件 @
2628f3cc
...
@@ -49,7 +49,7 @@ pub fn setsockopt<T>(sock: &Socket, opt: c_int, val: c_int,
...
@@ -49,7 +49,7 @@ pub fn setsockopt<T>(sock: &Socket, opt: c_int, val: c_int,
unsafe
{
unsafe
{
let
payload
=
&
payload
as
*
const
T
as
*
const
c_void
;
let
payload
=
&
payload
as
*
const
T
as
*
const
c_void
;
cvt
(
c
::
setsockopt
(
*
sock
.as_inner
(),
opt
,
val
,
payload
,
cvt
(
c
::
setsockopt
(
*
sock
.as_inner
(),
opt
,
val
,
payload
,
mem
::
size_of
::
<
T
>
()
as
c
::
socklen_t
))
?
;
mem
::
size_of
::
<
T
>
()
as
c
::
socklen_t
))
?
;
Ok
(())
Ok
(())
}
}
}
}
...
@@ -60,8 +60,8 @@ pub fn getsockopt<T: Copy>(sock: &Socket, opt: c_int,
...
@@ -60,8 +60,8 @@ pub fn getsockopt<T: Copy>(sock: &Socket, opt: c_int,
let
mut
slot
:
T
=
mem
::
zeroed
();
let
mut
slot
:
T
=
mem
::
zeroed
();
let
mut
len
=
mem
::
size_of
::
<
T
>
()
as
c
::
socklen_t
;
let
mut
len
=
mem
::
size_of
::
<
T
>
()
as
c
::
socklen_t
;
cvt
(
c
::
getsockopt
(
*
sock
.as_inner
(),
opt
,
val
,
cvt
(
c
::
getsockopt
(
*
sock
.as_inner
(),
opt
,
val
,
&
mut
slot
as
*
mut
_
as
*
mut
_
,
&
mut
slot
as
*
mut
_
as
*
mut
_
,
&
mut
len
))
?
;
&
mut
len
))
?
;
assert_eq!
(
len
as
usize
,
mem
::
size_of
::
<
T
>
());
assert_eq!
(
len
as
usize
,
mem
::
size_of
::
<
T
>
());
Ok
(
slot
)
Ok
(
slot
)
}
}
...
@@ -147,7 +147,7 @@ pub fn lookup_host(host: &str) -> io::Result<LookupHost> {
...
@@ -147,7 +147,7 @@ pub fn lookup_host(host: &str) -> io::Result<LookupHost> {
let
mut
res
=
ptr
::
null_mut
();
let
mut
res
=
ptr
::
null_mut
();
unsafe
{
unsafe
{
cvt_gai
(
c
::
getaddrinfo
(
c_host
.as_ptr
(),
ptr
::
null
(),
ptr
::
null
(),
cvt_gai
(
c
::
getaddrinfo
(
c_host
.as_ptr
(),
ptr
::
null
(),
ptr
::
null
(),
&
mut
res
))
?
;
&
mut
res
))
?
;
Ok
(
LookupHost
{
original
:
res
,
cur
:
res
})
Ok
(
LookupHost
{
original
:
res
,
cur
:
res
})
}
}
}
}
...
@@ -308,7 +308,7 @@ pub fn bind(addr: &SocketAddr) -> io::Result<TcpListener> {
...
@@ -308,7 +308,7 @@ pub fn bind(addr: &SocketAddr) -> io::Result<TcpListener> {
// the OS to clean up the previous one.
// the OS to clean up the previous one.
if
!
cfg!
(
windows
)
{
if
!
cfg!
(
windows
)
{
setsockopt
(
&
sock
,
c
::
SOL_SOCKET
,
c
::
SO_REUSEADDR
,
setsockopt
(
&
sock
,
c
::
SOL_SOCKET
,
c
::
SO_REUSEADDR
,
1
as
c_int
)
?
;
1
as
c_int
)
?
;
}
}
// Bind our new socket
// Bind our new socket
...
@@ -334,7 +334,7 @@ pub fn accept(&self) -> io::Result<(TcpStream, SocketAddr)> {
...
@@ -334,7 +334,7 @@ pub fn accept(&self) -> io::Result<(TcpStream, SocketAddr)> {
let
mut
storage
:
c
::
sockaddr_storage
=
unsafe
{
mem
::
zeroed
()
};
let
mut
storage
:
c
::
sockaddr_storage
=
unsafe
{
mem
::
zeroed
()
};
let
mut
len
=
mem
::
size_of_val
(
&
storage
)
as
c
::
socklen_t
;
let
mut
len
=
mem
::
size_of_val
(
&
storage
)
as
c
::
socklen_t
;
let
sock
=
self
.inner
.accept
(
&
mut
storage
as
*
mut
_
as
*
mut
_
,
let
sock
=
self
.inner
.accept
(
&
mut
storage
as
*
mut
_
as
*
mut
_
,
&
mut
len
)
?
;
&
mut
len
)
?
;
let
addr
=
sockaddr_to_addr
(
&
storage
,
len
as
usize
)
?
;
let
addr
=
sockaddr_to_addr
(
&
storage
,
len
as
usize
)
?
;
Ok
((
TcpStream
{
inner
:
sock
,
},
addr
))
Ok
((
TcpStream
{
inner
:
sock
,
},
addr
))
}
}
...
...
src/libstd/sys/unix/ext/net.rs
浏览文件 @
2628f3cc
...
@@ -642,11 +642,11 @@ fn inner(d: &UnixDatagram, buf: &[u8], path: &Path) -> io::Result<usize> {
...
@@ -642,11 +642,11 @@ fn inner(d: &UnixDatagram, buf: &[u8], path: &Path) -> io::Result<usize> {
let
(
addr
,
len
)
=
sockaddr_un
(
path
)
?
;
let
(
addr
,
len
)
=
sockaddr_un
(
path
)
?
;
let
count
=
cvt
(
libc
::
sendto
(
*
d
.0
.as_inner
(),
let
count
=
cvt
(
libc
::
sendto
(
*
d
.0
.as_inner
(),
buf
.as_ptr
()
as
*
const
_
,
buf
.as_ptr
()
as
*
const
_
,
buf
.len
(),
buf
.len
(),
0
,
0
,
&
addr
as
*
const
_
as
*
const
_
,
&
addr
as
*
const
_
as
*
const
_
,
len
))
?
;
len
))
?
;
Ok
(
count
as
usize
)
Ok
(
count
as
usize
)
}
}
}
}
...
...
src/libstd/sys/unix/os.rs
浏览文件 @
2628f3cc
...
@@ -181,15 +181,15 @@ pub fn current_exe() -> io::Result<PathBuf> {
...
@@ -181,15 +181,15 @@ pub fn current_exe() -> io::Result<PathBuf> {
-
1
as
c_int
];
-
1
as
c_int
];
let
mut
sz
:
libc
::
size_t
=
0
;
let
mut
sz
:
libc
::
size_t
=
0
;
cvt
(
libc
::
sysctl
(
mib
.as_mut_ptr
(),
mib
.len
()
as
::
libc
::
c_uint
,
cvt
(
libc
::
sysctl
(
mib
.as_mut_ptr
(),
mib
.len
()
as
::
libc
::
c_uint
,
ptr
::
null_mut
(),
&
mut
sz
,
ptr
::
null_mut
(),
ptr
::
null_mut
(),
&
mut
sz
,
ptr
::
null_mut
(),
0
as
libc
::
size_t
))
?
;
0
as
libc
::
size_t
))
?
;
if
sz
==
0
{
if
sz
==
0
{
return
Err
(
io
::
Error
::
last_os_error
())
return
Err
(
io
::
Error
::
last_os_error
())
}
}
let
mut
v
:
Vec
<
u8
>
=
Vec
::
with_capacity
(
sz
as
usize
);
let
mut
v
:
Vec
<
u8
>
=
Vec
::
with_capacity
(
sz
as
usize
);
cvt
(
libc
::
sysctl
(
mib
.as_mut_ptr
(),
mib
.len
()
as
::
libc
::
c_uint
,
cvt
(
libc
::
sysctl
(
mib
.as_mut_ptr
(),
mib
.len
()
as
::
libc
::
c_uint
,
v
.as_mut_ptr
()
as
*
mut
libc
::
c_void
,
&
mut
sz
,
v
.as_mut_ptr
()
as
*
mut
libc
::
c_void
,
&
mut
sz
,
ptr
::
null_mut
(),
0
as
libc
::
size_t
))
?
;
ptr
::
null_mut
(),
0
as
libc
::
size_t
))
?
;
if
sz
==
0
{
if
sz
==
0
{
return
Err
(
io
::
Error
::
last_os_error
());
return
Err
(
io
::
Error
::
last_os_error
());
}
}
...
@@ -218,10 +218,10 @@ pub fn current_exe() -> io::Result<PathBuf> {
...
@@ -218,10 +218,10 @@ pub fn current_exe() -> io::Result<PathBuf> {
let
mib
=
mib
.as_mut_ptr
();
let
mib
=
mib
.as_mut_ptr
();
let
mut
argv_len
=
0
;
let
mut
argv_len
=
0
;
cvt
(
libc
::
sysctl
(
mib
,
4
,
0
as
*
mut
_
,
&
mut
argv_len
,
cvt
(
libc
::
sysctl
(
mib
,
4
,
0
as
*
mut
_
,
&
mut
argv_len
,
0
as
*
mut
_
,
0
))
?
;
0
as
*
mut
_
,
0
))
?
;
let
mut
argv
=
Vec
::
<*
const
libc
::
c_char
>
::
with_capacity
(
argv_len
as
usize
);
let
mut
argv
=
Vec
::
<*
const
libc
::
c_char
>
::
with_capacity
(
argv_len
as
usize
);
cvt
(
libc
::
sysctl
(
mib
,
4
,
argv
.as_mut_ptr
()
as
*
mut
_
,
cvt
(
libc
::
sysctl
(
mib
,
4
,
argv
.as_mut_ptr
()
as
*
mut
_
,
&
mut
argv_len
,
0
as
*
mut
_
,
0
))
?
;
&
mut
argv_len
,
0
as
*
mut
_
,
0
))
?
;
argv
.set_len
(
argv_len
as
usize
);
argv
.set_len
(
argv_len
as
usize
);
if
argv
[
0
]
.is_null
()
{
if
argv
[
0
]
.is_null
()
{
return
Err
(
io
::
Error
::
new
(
io
::
ErrorKind
::
Other
,
return
Err
(
io
::
Error
::
new
(
io
::
ErrorKind
::
Other
,
...
...
src/libstd/sys/unix/process.rs
浏览文件 @
2628f3cc
...
@@ -392,7 +392,7 @@ unsafe fn do_exec(&mut self, stdio: ChildPipes) -> io::Error {
...
@@ -392,7 +392,7 @@ unsafe fn do_exec(&mut self, stdio: ChildPipes) -> io::Error {
let
mut
set
:
libc
::
sigset_t
=
mem
::
uninitialized
();
let
mut
set
:
libc
::
sigset_t
=
mem
::
uninitialized
();
t!
(
cvt
(
libc
::
sigemptyset
(
&
mut
set
)));
t!
(
cvt
(
libc
::
sigemptyset
(
&
mut
set
)));
t!
(
cvt
(
libc
::
pthread_sigmask
(
libc
::
SIG_SETMASK
,
&
set
,
t!
(
cvt
(
libc
::
pthread_sigmask
(
libc
::
SIG_SETMASK
,
&
set
,
ptr
::
null_mut
())));
ptr
::
null_mut
())));
let
ret
=
libc
::
signal
(
libc
::
SIGPIPE
,
libc
::
SIG_DFL
);
let
ret
=
libc
::
signal
(
libc
::
SIGPIPE
,
libc
::
SIG_DFL
);
if
ret
==
libc
::
SIG_ERR
{
if
ret
==
libc
::
SIG_ERR
{
return
io
::
Error
::
last_os_error
()
return
io
::
Error
::
last_os_error
()
...
...
src/libstd/sys/windows/fs.rs
浏览文件 @
2628f3cc
...
@@ -290,7 +290,7 @@ pub fn file_attr(&self) -> io::Result<FileAttr> {
...
@@ -290,7 +290,7 @@ pub fn file_attr(&self) -> io::Result<FileAttr> {
unsafe
{
unsafe
{
let
mut
info
:
c
::
BY_HANDLE_FILE_INFORMATION
=
mem
::
zeroed
();
let
mut
info
:
c
::
BY_HANDLE_FILE_INFORMATION
=
mem
::
zeroed
();
cvt
(
c
::
GetFileInformationByHandle
(
self
.handle
.raw
(),
cvt
(
c
::
GetFileInformationByHandle
(
self
.handle
.raw
(),
&
mut
info
))
?
;
&
mut
info
))
?
;
let
mut
attr
=
FileAttr
{
let
mut
attr
=
FileAttr
{
attributes
:
info
.dwFileAttributes
,
attributes
:
info
.dwFileAttributes
,
creation_time
:
info
.ftCreationTime
,
creation_time
:
info
.ftCreationTime
,
...
...
src/libstd/sys/windows/process.rs
浏览文件 @
2628f3cc
...
@@ -188,9 +188,9 @@ pub fn spawn(&mut self, default: Stdio, needs_stdin: bool)
...
@@ -188,9 +188,9 @@ pub fn spawn(&mut self, default: Stdio, needs_stdin: bool)
let
stderr
=
self
.stderr
.as_ref
()
.unwrap_or
(
&
default
);
let
stderr
=
self
.stderr
.as_ref
()
.unwrap_or
(
&
default
);
let
stdin
=
stdin
.to_handle
(
c
::
STD_INPUT_HANDLE
,
&
mut
pipes
.stdin
)
?
;
let
stdin
=
stdin
.to_handle
(
c
::
STD_INPUT_HANDLE
,
&
mut
pipes
.stdin
)
?
;
let
stdout
=
stdout
.to_handle
(
c
::
STD_OUTPUT_HANDLE
,
let
stdout
=
stdout
.to_handle
(
c
::
STD_OUTPUT_HANDLE
,
&
mut
pipes
.stdout
)
?
;
&
mut
pipes
.stdout
)
?
;
let
stderr
=
stderr
.to_handle
(
c
::
STD_ERROR_HANDLE
,
let
stderr
=
stderr
.to_handle
(
c
::
STD_ERROR_HANDLE
,
&
mut
pipes
.stderr
)
?
;
&
mut
pipes
.stderr
)
?
;
si
.hStdInput
=
stdin
.raw
();
si
.hStdInput
=
stdin
.raw
();
si
.hStdOutput
=
stdout
.raw
();
si
.hStdOutput
=
stdout
.raw
();
si
.hStdError
=
stderr
.raw
();
si
.hStdError
=
stderr
.raw
();
...
...
src/libsyntax/codemap.rs
浏览文件 @
2628f3cc
...
@@ -530,51 +530,51 @@ fn encode<S: Encoder>(&self, s: &mut S) -> Result<(), S::Error> {
...
@@ -530,51 +530,51 @@ fn encode<S: Encoder>(&self, s: &mut S) -> Result<(), S::Error> {
s
.emit_struct_field
(
"start_pos"
,
1
,
|
s
|
self
.start_pos
.encode
(
s
))
?
;
s
.emit_struct_field
(
"start_pos"
,
1
,
|
s
|
self
.start_pos
.encode
(
s
))
?
;
s
.emit_struct_field
(
"end_pos"
,
2
,
|
s
|
self
.end_pos
.encode
(
s
))
?
;
s
.emit_struct_field
(
"end_pos"
,
2
,
|
s
|
self
.end_pos
.encode
(
s
))
?
;
s
.emit_struct_field
(
"lines"
,
3
,
|
s
|
{
s
.emit_struct_field
(
"lines"
,
3
,
|
s
|
{
let
lines
=
self
.lines
.borrow
();
let
lines
=
self
.lines
.borrow
();
// store the length
// store the length
s
.emit_u32
(
lines
.len
()
as
u32
)
?
;
s
.emit_u32
(
lines
.len
()
as
u32
)
?
;
if
!
lines
.is_empty
()
{
if
!
lines
.is_empty
()
{
// In order to preserve some space, we exploit the fact that
// In order to preserve some space, we exploit the fact that
// the lines list is sorted and individual lines are
// the lines list is sorted and individual lines are
// probably not that long. Because of that we can store lines
// probably not that long. Because of that we can store lines
// as a difference list, using as little space as possible
// as a difference list, using as little space as possible
// for the differences.
// for the differences.
let
max_line_length
=
if
lines
.len
()
==
1
{
let
max_line_length
=
if
lines
.len
()
==
1
{
0
0
}
else
{
}
else
{
lines
.windows
(
2
)
lines
.windows
(
2
)
.map
(|
w
|
w
[
1
]
-
w
[
0
])
.map
(|
w
|
w
[
1
]
-
w
[
0
])
.map
(|
bp
|
bp
.to_usize
())
.map
(|
bp
|
bp
.to_usize
())
.max
()
.max
()
.unwrap
()
.unwrap
()
};
};
let
bytes_per_diff
:
u8
=
match
max_line_length
{
let
bytes_per_diff
:
u8
=
match
max_line_length
{
0
...
0xFF
=>
1
,
0
...
0xFF
=>
1
,
0x100
...
0xFFFF
=>
2
,
0x100
...
0xFFFF
=>
2
,
_
=>
4
_
=>
4
};
};
// Encode the number of bytes used per diff.
// Encode the number of bytes used per diff.
bytes_per_diff
.encode
(
s
)
?
;
bytes_per_diff
.encode
(
s
)
?
;
// Encode the first element.
// Encode the first element.
lines
[
0
]
.encode
(
s
)
?
;
lines
[
0
]
.encode
(
s
)
?
;
let
diff_iter
=
(
&
lines
[
..
])
.windows
(
2
)
let
diff_iter
=
(
&
lines
[
..
])
.windows
(
2
)
.map
(|
w
|
(
w
[
1
]
-
w
[
0
]));
.map
(|
w
|
(
w
[
1
]
-
w
[
0
]));
match
bytes_per_diff
{
match
bytes_per_diff
{
1
=>
for
diff
in
diff_iter
{
(
diff
.0
as
u8
)
.encode
(
s
)
?
},
1
=>
for
diff
in
diff_iter
{
(
diff
.0
as
u8
)
.encode
(
s
)
?
},
2
=>
for
diff
in
diff_iter
{
(
diff
.0
as
u16
)
.encode
(
s
)
?
},
2
=>
for
diff
in
diff_iter
{
(
diff
.0
as
u16
)
.encode
(
s
)
?
},
4
=>
for
diff
in
diff_iter
{
diff
.0
.encode
(
s
)
?
},
4
=>
for
diff
in
diff_iter
{
diff
.0
.encode
(
s
)
?
},
_
=>
unreachable!
()
_
=>
unreachable!
()
}
}
}
}
Ok
(())
Ok
(())
})
?
;
})
?
;
s
.emit_struct_field
(
"multibyte_chars"
,
4
,
|
s
|
{
s
.emit_struct_field
(
"multibyte_chars"
,
4
,
|
s
|
{
(
*
self
.multibyte_chars
.borrow
())
.encode
(
s
)
(
*
self
.multibyte_chars
.borrow
())
.encode
(
s
)
})
})
...
@@ -590,33 +590,33 @@ fn decode<D: Decoder>(d: &mut D) -> Result<FileMap, D::Error> {
...
@@ -590,33 +590,33 @@ fn decode<D: Decoder>(d: &mut D) -> Result<FileMap, D::Error> {
let
start_pos
:
BytePos
=
d
.read_struct_field
(
"start_pos"
,
1
,
|
d
|
Decodable
::
decode
(
d
))
?
;
let
start_pos
:
BytePos
=
d
.read_struct_field
(
"start_pos"
,
1
,
|
d
|
Decodable
::
decode
(
d
))
?
;
let
end_pos
:
BytePos
=
d
.read_struct_field
(
"end_pos"
,
2
,
|
d
|
Decodable
::
decode
(
d
))
?
;
let
end_pos
:
BytePos
=
d
.read_struct_field
(
"end_pos"
,
2
,
|
d
|
Decodable
::
decode
(
d
))
?
;
let
lines
:
Vec
<
BytePos
>
=
d
.read_struct_field
(
"lines"
,
3
,
|
d
|
{
let
lines
:
Vec
<
BytePos
>
=
d
.read_struct_field
(
"lines"
,
3
,
|
d
|
{
let
num_lines
:
u32
=
Decodable
::
decode
(
d
)
?
;
let
num_lines
:
u32
=
Decodable
::
decode
(
d
)
?
;
let
mut
lines
=
Vec
::
with_capacity
(
num_lines
as
usize
);
let
mut
lines
=
Vec
::
with_capacity
(
num_lines
as
usize
);
if
num_lines
>
0
{
// Read the number of bytes used per diff.
let
bytes_per_diff
:
u8
=
Decodable
::
decode
(
d
)
?
;
// Read the first element.
let
mut
line_start
:
BytePos
=
Decodable
::
decode
(
d
)
?
;
lines
.push
(
line_start
);
for
_
in
1
..
num_lines
{
let
diff
=
match
bytes_per_diff
{
1
=>
d
.read_u8
()
?
as
u32
,
2
=>
d
.read_u16
()
?
as
u32
,
4
=>
d
.read_u32
()
?
,
_
=>
unreachable!
()
};
if
num_lines
>
0
{
line_start
=
line_start
+
BytePos
(
diff
);
// Read the number of bytes used per diff.
let
bytes_per_diff
:
u8
=
Decodable
::
decode
(
d
)
?
;
// Read the first element.
let
mut
line_start
:
BytePos
=
Decodable
::
decode
(
d
)
?
;
lines
.push
(
line_start
);
lines
.push
(
line_start
);
for
_
in
1
..
num_lines
{
let
diff
=
match
bytes_per_diff
{
1
=>
d
.read_u8
()
?
as
u32
,
2
=>
d
.read_u16
()
?
as
u32
,
4
=>
d
.read_u32
()
?
,
_
=>
unreachable!
()
};
line_start
=
line_start
+
BytePos
(
diff
);
lines
.push
(
line_start
);
}
}
}
}
Ok
(
lines
)
Ok
(
lines
)
})
?
;
})
?
;
let
multibyte_chars
:
Vec
<
MultiByteChar
>
=
let
multibyte_chars
:
Vec
<
MultiByteChar
>
=
d
.read_struct_field
(
"multibyte_chars"
,
4
,
|
d
|
Decodable
::
decode
(
d
))
?
;
d
.read_struct_field
(
"multibyte_chars"
,
4
,
|
d
|
Decodable
::
decode
(
d
))
?
;
Ok
(
FileMap
{
Ok
(
FileMap
{
...
...
src/libsyntax/errors/emitter.rs
浏览文件 @
2628f3cc
...
@@ -208,8 +208,8 @@ fn emit_(&mut self,
...
@@ -208,8 +208,8 @@ fn emit_(&mut self,
if
let
Some
(
_
)
=
self
.registry
.as_ref
()
if
let
Some
(
_
)
=
self
.registry
.as_ref
()
.and_then
(|
registry
|
registry
.find_description
(
code
))
{
.and_then
(|
registry
|
registry
.find_description
(
code
))
{
print_diagnostic
(
&
mut
self
.dst
,
&
ss
[
..
],
Help
,
print_diagnostic
(
&
mut
self
.dst
,
&
ss
[
..
],
Help
,
&
format!
(
"run `rustc --explain {}` to see a
\
&
format!
(
"run `rustc --explain {}` to see a
\
detailed explanation"
,
code
),
None
)
?
;
detailed explanation"
,
code
),
None
)
?
;
}
}
}
}
Ok
(())
Ok
(())
...
@@ -234,13 +234,13 @@ fn highlight_suggestion(&mut self, suggestion: &CodeSuggestion) -> io::Result<()
...
@@ -234,13 +234,13 @@ fn highlight_suggestion(&mut self, suggestion: &CodeSuggestion) -> io::Result<()
let
mut
lines
=
complete
.lines
();
let
mut
lines
=
complete
.lines
();
for
line
in
lines
.by_ref
()
.take
(
MAX_HIGHLIGHT_LINES
)
{
for
line
in
lines
.by_ref
()
.take
(
MAX_HIGHLIGHT_LINES
)
{
write!
(
&
mut
self
.dst
,
"{0}:{1:2$} {3}
\n
"
,
write!
(
&
mut
self
.dst
,
"{0}:{1:2$} {3}
\n
"
,
fm
.name
,
""
,
max_digits
,
line
)
?
;
fm
.name
,
""
,
max_digits
,
line
)
?
;
}
}
// if we elided some lines, add an ellipsis
// if we elided some lines, add an ellipsis
if
let
Some
(
_
)
=
lines
.next
()
{
if
let
Some
(
_
)
=
lines
.next
()
{
write!
(
&
mut
self
.dst
,
"{0:1$} {0:2$} ...
\n
"
,
write!
(
&
mut
self
.dst
,
"{0:1$} {0:2$} ...
\n
"
,
""
,
fm
.name
.len
(),
max_digits
)
?
;
""
,
fm
.name
.len
(),
max_digits
)
?
;
}
}
Ok
(())
Ok
(())
...
@@ -424,15 +424,15 @@ fn highlight_lines(&mut self,
...
@@ -424,15 +424,15 @@ fn highlight_lines(&mut self,
// Print offending code-line
// Print offending code-line
remaining_err_lines
-=
1
;
remaining_err_lines
-=
1
;
write!
(
&
mut
self
.dst
,
"{}:{:>width$} {}
\n
"
,
write!
(
&
mut
self
.dst
,
"{}:{:>width$} {}
\n
"
,
fm
.name
,
fm
.name
,
line
.line_index
+
1
,
line
.line_index
+
1
,
cur_line_str
,
cur_line_str
,
width
=
digits
)
?
;
width
=
digits
)
?
;
if
s
.len
()
>
skip
{
if
s
.len
()
>
skip
{
// Render the spans we assembled previously (if any).
// Render the spans we assembled previously (if any).
println_maybe_styled!
(
&
mut
self
.dst
,
term
::
Attr
::
ForegroundColor
(
lvl
.color
()),
println_maybe_styled!
(
&
mut
self
.dst
,
term
::
Attr
::
ForegroundColor
(
lvl
.color
()),
"{}"
,
s
)
?
;
"{}"
,
s
)
?
;
}
}
if
!
overflowed_buf
.is_empty
()
{
if
!
overflowed_buf
.is_empty
()
{
...
@@ -561,13 +561,13 @@ fn end_highlight_lines(&mut self,
...
@@ -561,13 +561,13 @@ fn end_highlight_lines(&mut self,
// Print offending code-lines
// Print offending code-lines
write!
(
&
mut
self
.dst
,
"{}:{:>width$} {}
\n
"
,
fm
.name
,
write!
(
&
mut
self
.dst
,
"{}:{:>width$} {}
\n
"
,
fm
.name
,
line
.line_index
+
1
,
line_str
,
width
=
digits
)
?
;
line
.line_index
+
1
,
line_str
,
width
=
digits
)
?
;
remaining_err_lines
-=
1
;
remaining_err_lines
-=
1
;
if
s
.len
()
>
skip
{
if
s
.len
()
>
skip
{
// Render the spans we assembled previously (if any)
// Render the spans we assembled previously (if any)
println_maybe_styled!
(
&
mut
self
.dst
,
term
::
Attr
::
ForegroundColor
(
lvl
.color
()),
println_maybe_styled!
(
&
mut
self
.dst
,
term
::
Attr
::
ForegroundColor
(
lvl
.color
()),
"{}"
,
s
)
?
;
"{}"
,
s
)
?
;
}
}
prev_line_index
=
line
.line_index
;
prev_line_index
=
line
.line_index
;
}
}
...
@@ -642,7 +642,7 @@ fn print_diagnostic(dst: &mut Destination,
...
@@ -642,7 +642,7 @@ fn print_diagnostic(dst: &mut Destination,
}
}
print_maybe_styled!
(
dst
,
term
::
Attr
::
ForegroundColor
(
lvl
.color
()),
print_maybe_styled!
(
dst
,
term
::
Attr
::
ForegroundColor
(
lvl
.color
()),
"{}: "
,
lvl
.to_string
())
?
;
"{}: "
,
lvl
.to_string
())
?
;
print_maybe_styled!
(
dst
,
term
::
Attr
::
Bold
,
"{}"
,
msg
)
?
;
print_maybe_styled!
(
dst
,
term
::
Attr
::
Bold
,
"{}"
,
msg
)
?
;
if
let
Some
(
code
)
=
code
{
if
let
Some
(
code
)
=
code
{
...
...
src/libsyntax/parse/parser.rs
浏览文件 @
2628f3cc
...
@@ -834,7 +834,7 @@ pub fn parse_seq_to_before_gt<T, F>(&mut self,
...
@@ -834,7 +834,7 @@ pub fn parse_seq_to_before_gt<T, F>(&mut self,
F
:
FnMut
(
&
mut
Parser
<
'a
>
)
->
PResult
<
'a
,
T
>
,
F
:
FnMut
(
&
mut
Parser
<
'a
>
)
->
PResult
<
'a
,
T
>
,
{
{
let
(
result
,
returned
)
=
self
.parse_seq_to_before_gt_or_return
(
sep
,
let
(
result
,
returned
)
=
self
.parse_seq_to_before_gt_or_return
(
sep
,
|
p
|
Ok
(
Some
(
f
(
p
)
?
)))
?
;
|
p
|
Ok
(
Some
(
f
(
p
)
?
)))
?
;
assert
!
(
!
returned
);
assert
!
(
!
returned
);
return
Ok
(
result
);
return
Ok
(
result
);
}
}
...
@@ -1476,8 +1476,8 @@ pub fn parse_ty(&mut self) -> PResult<'a, P<Ty>> {
...
@@ -1476,8 +1476,8 @@ pub fn parse_ty(&mut self) -> PResult<'a, P<Ty>> {
self
.bump
();
self
.bump
();
let
delim
=
self
.expect_open_delim
()
?
;
let
delim
=
self
.expect_open_delim
()
?
;
let
tts
=
self
.parse_seq_to_end
(
&
token
::
CloseDelim
(
delim
),
let
tts
=
self
.parse_seq_to_end
(
&
token
::
CloseDelim
(
delim
),
SeqSep
::
none
(),
SeqSep
::
none
(),
|
p
|
p
.parse_token_tree
())
?
;
|
p
|
p
.parse_token_tree
())
?
;
let
hi
=
self
.span.hi
;
let
hi
=
self
.span.hi
;
TyKind
::
Mac
(
spanned
(
lo
,
hi
,
Mac_
{
path
:
path
,
tts
:
tts
,
ctxt
:
EMPTY_CTXT
}))
TyKind
::
Mac
(
spanned
(
lo
,
hi
,
Mac_
{
path
:
path
,
tts
:
tts
,
ctxt
:
EMPTY_CTXT
}))
}
else
{
}
else
{
...
@@ -2225,7 +2225,7 @@ fn parse_bottom_expr(&mut self) -> PResult<'a, P<Expr>> {
...
@@ -2225,7 +2225,7 @@ fn parse_bottom_expr(&mut self) -> PResult<'a, P<Expr>> {
&
token
::
CloseDelim
(
token
::
Bracket
),
&
token
::
CloseDelim
(
token
::
Bracket
),
SeqSep
::
trailing_allowed
(
token
::
Comma
),
SeqSep
::
trailing_allowed
(
token
::
Comma
),
|
p
|
Ok
(
p
.parse_expr
()
?
)
|
p
|
Ok
(
p
.parse_expr
()
?
)
)
?
;
)
?
;
let
mut
exprs
=
vec!
(
first_expr
);
let
mut
exprs
=
vec!
(
first_expr
);
exprs
.extend
(
remaining_exprs
);
exprs
.extend
(
remaining_exprs
);
ex
=
ExprKind
::
Vec
(
exprs
);
ex
=
ExprKind
::
Vec
(
exprs
);
...
@@ -2610,8 +2610,8 @@ fn parse_dot_or_call_expr_with_(&mut self, e0: P<Expr>, lo: BytePos) -> PResult<
...
@@ -2610,8 +2610,8 @@ fn parse_dot_or_call_expr_with_(&mut self, e0: P<Expr>, lo: BytePos) -> PResult<
let
dot_pos
=
self
.last_span.hi
;
let
dot_pos
=
self
.last_span.hi
;
e
=
self
.parse_dot_suffix
(
special_idents
::
invalid
,
e
=
self
.parse_dot_suffix
(
special_idents
::
invalid
,
mk_sp
(
dot_pos
,
dot_pos
),
mk_sp
(
dot_pos
,
dot_pos
),
e
,
lo
)
?
;
e
,
lo
)
?
;
}
}
}
}
continue
;
continue
;
...
@@ -3267,7 +3267,7 @@ fn parse_match_expr(&mut self, attrs: ThinAttributes) -> PResult<'a, P<Expr>> {
...
@@ -3267,7 +3267,7 @@ fn parse_match_expr(&mut self, attrs: ThinAttributes) -> PResult<'a, P<Expr>> {
let
match_span
=
self
.last_span
;
let
match_span
=
self
.last_span
;
let
lo
=
self
.last_span.lo
;
let
lo
=
self
.last_span.lo
;
let
discriminant
=
self
.parse_expr_res
(
Restrictions
::
RESTRICTION_NO_STRUCT_LITERAL
,
let
discriminant
=
self
.parse_expr_res
(
Restrictions
::
RESTRICTION_NO_STRUCT_LITERAL
,
None
)
?
;
None
)
?
;
if
let
Err
(
mut
e
)
=
self
.commit_expr_expecting
(
&
discriminant
,
if
let
Err
(
mut
e
)
=
self
.commit_expr_expecting
(
&
discriminant
,
token
::
OpenDelim
(
token
::
Brace
))
{
token
::
OpenDelim
(
token
::
Brace
))
{
if
self
.token
==
token
::
Token
::
Semi
{
if
self
.token
==
token
::
Token
::
Semi
{
...
@@ -3612,8 +3612,9 @@ pub fn parse_pat(&mut self) -> PResult<'a, P<Pat>> {
...
@@ -3612,8 +3612,9 @@ pub fn parse_pat(&mut self) -> PResult<'a, P<Pat>> {
let
path
=
ident_to_path
(
ident_span
,
ident
);
let
path
=
ident_to_path
(
ident_span
,
ident
);
self
.bump
();
self
.bump
();
let
delim
=
self
.expect_open_delim
()
?
;
let
delim
=
self
.expect_open_delim
()
?
;
let
tts
=
self
.parse_seq_to_end
(
&
token
::
CloseDelim
(
delim
),
let
tts
=
self
.parse_seq_to_end
(
SeqSep
::
none
(),
|
p
|
p
.parse_token_tree
())
?
;
&
token
::
CloseDelim
(
delim
),
SeqSep
::
none
(),
|
p
|
p
.parse_token_tree
())
?
;
let
mac
=
Mac_
{
path
:
path
,
tts
:
tts
,
ctxt
:
EMPTY_CTXT
};
let
mac
=
Mac_
{
path
:
path
,
tts
:
tts
,
ctxt
:
EMPTY_CTXT
};
pat
=
PatKind
::
Mac
(
codemap
::
Spanned
{
node
:
mac
,
pat
=
PatKind
::
Mac
(
codemap
::
Spanned
{
node
:
mac
,
span
:
mk_sp
(
lo
,
self
.last_span.hi
)});
span
:
mk_sp
(
lo
,
self
.last_span.hi
)});
...
@@ -3670,10 +3671,10 @@ pub fn parse_pat(&mut self) -> PResult<'a, P<Pat>> {
...
@@ -3670,10 +3671,10 @@ pub fn parse_pat(&mut self) -> PResult<'a, P<Pat>> {
pat
=
PatKind
::
TupleStruct
(
path
,
None
);
pat
=
PatKind
::
TupleStruct
(
path
,
None
);
}
else
{
}
else
{
let
args
=
self
.parse_enum_variant_seq
(
let
args
=
self
.parse_enum_variant_seq
(
&
token
::
OpenDelim
(
token
::
Paren
),
&
token
::
OpenDelim
(
token
::
Paren
),
&
token
::
CloseDelim
(
token
::
Paren
),
&
token
::
CloseDelim
(
token
::
Paren
),
SeqSep
::
trailing_allowed
(
token
::
Comma
),
SeqSep
::
trailing_allowed
(
token
::
Comma
),
|
p
|
p
.parse_pat
())
?
;
|
p
|
p
.parse_pat
())
?
;
pat
=
PatKind
::
TupleStruct
(
path
,
Some
(
args
));
pat
=
PatKind
::
TupleStruct
(
path
,
Some
(
args
));
}
}
}
}
...
@@ -3963,7 +3964,7 @@ fn parse_stmt_without_recovery(&mut self) -> PResult<'a, Option<Stmt>> {
...
@@ -3963,7 +3964,7 @@ fn parse_stmt_without_recovery(&mut self) -> PResult<'a, Option<Stmt>> {
// FIXME: Bad copy of attrs
// FIXME: Bad copy of attrs
let
restrictions
=
self
.restrictions
|
Restrictions
::
NO_NONINLINE_MOD
;
let
restrictions
=
self
.restrictions
|
Restrictions
::
NO_NONINLINE_MOD
;
match
self
.with_res
(
restrictions
,
match
self
.with_res
(
restrictions
,
|
this
|
this
.parse_item_
(
attrs
.clone
(),
false
,
true
))
?
{
|
this
|
this
.parse_item_
(
attrs
.clone
(),
false
,
true
))
?
{
Some
(
i
)
=>
{
Some
(
i
)
=>
{
let
hi
=
i
.span.hi
;
let
hi
=
i
.span.hi
;
let
decl
=
P
(
spanned
(
lo
,
hi
,
DeclKind
::
Item
(
i
)));
let
decl
=
P
(
spanned
(
lo
,
hi
,
DeclKind
::
Item
(
i
)));
...
@@ -4941,8 +4942,8 @@ fn parse_impl_method(&mut self, vis: Visibility)
...
@@ -4941,8 +4942,8 @@ fn parse_impl_method(&mut self, vis: Visibility)
// eat a matched-delimiter token tree:
// eat a matched-delimiter token tree:
let
delim
=
self
.expect_open_delim
()
?
;
let
delim
=
self
.expect_open_delim
()
?
;
let
tts
=
self
.parse_seq_to_end
(
&
token
::
CloseDelim
(
delim
),
let
tts
=
self
.parse_seq_to_end
(
&
token
::
CloseDelim
(
delim
),
SeqSep
::
none
(),
SeqSep
::
none
(),
|
p
|
p
.parse_token_tree
())
?
;
|
p
|
p
.parse_token_tree
())
?
;
let
m_
=
Mac_
{
path
:
pth
,
tts
:
tts
,
ctxt
:
EMPTY_CTXT
};
let
m_
=
Mac_
{
path
:
pth
,
tts
:
tts
,
ctxt
:
EMPTY_CTXT
};
let
m
:
ast
::
Mac
=
codemap
::
Spanned
{
node
:
m_
,
let
m
:
ast
::
Mac
=
codemap
::
Spanned
{
node
:
m_
,
span
:
mk_sp
(
lo
,
span
:
mk_sp
(
lo
,
...
@@ -5409,8 +5410,8 @@ fn eval_src_mod(&mut self,
...
@@ -5409,8 +5410,8 @@ fn eval_src_mod(&mut self,
id_sp
:
Span
)
id_sp
:
Span
)
->
PResult
<
'a
,
(
ast
::
ItemKind
,
Vec
<
ast
::
Attribute
>
)
>
{
->
PResult
<
'a
,
(
ast
::
ItemKind
,
Vec
<
ast
::
Attribute
>
)
>
{
let
ModulePathSuccess
{
path
,
owns_directory
}
=
self
.submod_path
(
id
,
let
ModulePathSuccess
{
path
,
owns_directory
}
=
self
.submod_path
(
id
,
outer_attrs
,
outer_attrs
,
id_sp
)
?
;
id_sp
)
?
;
self
.eval_src_mod_from_path
(
path
,
self
.eval_src_mod_from_path
(
path
,
owns_directory
,
owns_directory
,
...
@@ -5993,8 +5994,8 @@ fn parse_macro_use_or_failure(
...
@@ -5993,8 +5994,8 @@ fn parse_macro_use_or_failure(
// eat a matched-delimiter token tree:
// eat a matched-delimiter token tree:
let
delim
=
self
.expect_open_delim
()
?
;
let
delim
=
self
.expect_open_delim
()
?
;
let
tts
=
self
.parse_seq_to_end
(
&
token
::
CloseDelim
(
delim
),
let
tts
=
self
.parse_seq_to_end
(
&
token
::
CloseDelim
(
delim
),
SeqSep
::
none
(),
SeqSep
::
none
(),
|
p
|
p
.parse_token_tree
())
?
;
|
p
|
p
.parse_token_tree
())
?
;
// single-variant-enum... :
// single-variant-enum... :
let
m
=
Mac_
{
path
:
pth
,
tts
:
tts
,
ctxt
:
EMPTY_CTXT
};
let
m
=
Mac_
{
path
:
pth
,
tts
:
tts
,
ctxt
:
EMPTY_CTXT
};
let
m
:
ast
::
Mac
=
codemap
::
Spanned
{
node
:
m
,
let
m
:
ast
::
Mac
=
codemap
::
Spanned
{
node
:
m
,
...
...
src/libsyntax/print/pprust.rs
浏览文件 @
2628f3cc
...
@@ -388,7 +388,7 @@ pub fn fun_to_string(decl: &ast::FnDecl,
...
@@ -388,7 +388,7 @@ pub fn fun_to_string(decl: &ast::FnDecl,
to_string
(|
s
|
{
to_string
(|
s
|
{
s
.head
(
""
)
?
;
s
.head
(
""
)
?
;
s
.print_fn
(
decl
,
unsafety
,
constness
,
Abi
::
Rust
,
Some
(
name
),
s
.print_fn
(
decl
,
unsafety
,
constness
,
Abi
::
Rust
,
Some
(
name
),
generics
,
opt_explicit_self
,
ast
::
Visibility
::
Inherited
)
?
;
generics
,
opt_explicit_self
,
ast
::
Visibility
::
Inherited
)
?
;
s
.end
()
?
;
// Close the head box
s
.end
()
?
;
// Close the head box
s
.end
()
// Close the outer box
s
.end
()
// Close the outer box
})
})
...
@@ -779,8 +779,8 @@ fn print_meta_item(&mut self, item: &ast::MetaItem) -> io::Result<()> {
...
@@ -779,8 +779,8 @@ fn print_meta_item(&mut self, item: &ast::MetaItem) -> io::Result<()> {
word
(
self
.writer
(),
&
name
)
?
;
word
(
self
.writer
(),
&
name
)
?
;
self
.popen
()
?
;
self
.popen
()
?
;
self
.commasep
(
Consistent
,
self
.commasep
(
Consistent
,
&
items
[
..
],
&
items
[
..
],
|
s
,
i
|
s
.print_meta_item
(
&
i
))
?
;
|
s
,
i
|
s
.print_meta_item
(
&
i
))
?
;
self
.pclose
()
?
;
self
.pclose
()
?
;
}
}
}
}
...
@@ -915,7 +915,7 @@ pub fn commasep_cmnt<T, F, G>(&mut self,
...
@@ -915,7 +915,7 @@ pub fn commasep_cmnt<T, F, G>(&mut self,
if
i
<
len
{
if
i
<
len
{
word
(
&
mut
self
.s
,
","
)
?
;
word
(
&
mut
self
.s
,
","
)
?
;
self
.maybe_print_trailing_comment
(
get_span
(
elt
),
self
.maybe_print_trailing_comment
(
get_span
(
elt
),
Some
(
get_span
(
&
elts
[
i
])
.hi
))
?
;
Some
(
get_span
(
&
elts
[
i
])
.hi
))
?
;
self
.space_if_not_bol
()
?
;
self
.space_if_not_bol
()
?
;
}
}
}
}
...
@@ -979,7 +979,7 @@ pub fn print_type(&mut self, ty: &ast::Ty) -> io::Result<()> {
...
@@ -979,7 +979,7 @@ pub fn print_type(&mut self, ty: &ast::Ty) -> io::Result<()> {
ast
::
TyKind
::
Tup
(
ref
elts
)
=>
{
ast
::
TyKind
::
Tup
(
ref
elts
)
=>
{
self
.popen
()
?
;
self
.popen
()
?
;
self
.commasep
(
Inconsistent
,
&
elts
[
..
],
self
.commasep
(
Inconsistent
,
&
elts
[
..
],
|
s
,
ty
|
s
.print_type
(
&
ty
))
?
;
|
s
,
ty
|
s
.print_type
(
&
ty
))
?
;
if
elts
.len
()
==
1
{
if
elts
.len
()
==
1
{
word
(
&
mut
self
.s
,
","
)
?
;
word
(
&
mut
self
.s
,
","
)
?
;
}
}
...
@@ -1000,11 +1000,11 @@ pub fn print_type(&mut self, ty: &ast::Ty) -> io::Result<()> {
...
@@ -1000,11 +1000,11 @@ pub fn print_type(&mut self, ty: &ast::Ty) -> io::Result<()> {
},
},
};
};
self
.print_ty_fn
(
f
.abi
,
self
.print_ty_fn
(
f
.abi
,
f
.unsafety
,
f
.unsafety
,
&
f
.decl
,
&
f
.decl
,
None
,
None
,
&
generics
,
&
generics
,
None
)
?
;
None
)
?
;
}
}
ast
::
TyKind
::
Path
(
None
,
ref
path
)
=>
{
ast
::
TyKind
::
Path
(
None
,
ref
path
)
=>
{
self
.print_path
(
path
,
false
,
0
)
?
;
self
.print_path
(
path
,
false
,
0
)
?
;
...
@@ -1050,16 +1050,15 @@ pub fn print_foreign_item(&mut self,
...
@@ -1050,16 +1050,15 @@ pub fn print_foreign_item(&mut self,
ast
::
ForeignItemKind
::
Fn
(
ref
decl
,
ref
generics
)
=>
{
ast
::
ForeignItemKind
::
Fn
(
ref
decl
,
ref
generics
)
=>
{
self
.head
(
""
)
?
;
self
.head
(
""
)
?
;
self
.print_fn
(
decl
,
ast
::
Unsafety
::
Normal
,
self
.print_fn
(
decl
,
ast
::
Unsafety
::
Normal
,
ast
::
Constness
::
NotConst
,
ast
::
Constness
::
NotConst
,
Abi
::
Rust
,
Some
(
item
.ident
),
Abi
::
Rust
,
Some
(
item
.ident
),
generics
,
None
,
item
.vis
)
?
;
generics
,
None
,
item
.vis
)
?
;
self
.end
()
?
;
// end head-ibox
self
.end
()
?
;
// end head-ibox
word
(
&
mut
self
.s
,
";"
)
?
;
word
(
&
mut
self
.s
,
";"
)
?
;
self
.end
()
// end the outer fn box
self
.end
()
// end the outer fn box
}
}
ast
::
ForeignItemKind
::
Static
(
ref
t
,
m
)
=>
{
ast
::
ForeignItemKind
::
Static
(
ref
t
,
m
)
=>
{
self
.head
(
&
visibility_qualified
(
item
.vis
,
self
.head
(
&
visibility_qualified
(
item
.vis
,
"static"
))
?
;
"static"
))
?
;
if
m
{
if
m
{
self
.word_space
(
"mut"
)
?
;
self
.word_space
(
"mut"
)
?
;
}
}
...
@@ -1119,8 +1118,7 @@ pub fn print_item(&mut self, item: &ast::Item) -> io::Result<()> {
...
@@ -1119,8 +1118,7 @@ pub fn print_item(&mut self, item: &ast::Item) -> io::Result<()> {
self
.ann
.pre
(
self
,
NodeItem
(
item
))
?
;
self
.ann
.pre
(
self
,
NodeItem
(
item
))
?
;
match
item
.node
{
match
item
.node
{
ast
::
ItemKind
::
ExternCrate
(
ref
optional_path
)
=>
{
ast
::
ItemKind
::
ExternCrate
(
ref
optional_path
)
=>
{
self
.head
(
&
visibility_qualified
(
item
.vis
,
self
.head
(
&
visibility_qualified
(
item
.vis
,
"extern crate"
))
?
;
"extern crate"
))
?
;
if
let
Some
(
p
)
=
*
optional_path
{
if
let
Some
(
p
)
=
*
optional_path
{
let
val
=
p
.as_str
();
let
val
=
p
.as_str
();
if
val
.contains
(
"-"
)
{
if
val
.contains
(
"-"
)
{
...
@@ -1138,16 +1136,14 @@ pub fn print_item(&mut self, item: &ast::Item) -> io::Result<()> {
...
@@ -1138,16 +1136,14 @@ pub fn print_item(&mut self, item: &ast::Item) -> io::Result<()> {
self
.end
()
?
;
// end outer head-block
self
.end
()
?
;
// end outer head-block
}
}
ast
::
ItemKind
::
Use
(
ref
vp
)
=>
{
ast
::
ItemKind
::
Use
(
ref
vp
)
=>
{
self
.head
(
&
visibility_qualified
(
item
.vis
,
self
.head
(
&
visibility_qualified
(
item
.vis
,
"use"
))
?
;
"use"
))
?
;
self
.print_view_path
(
&
vp
)
?
;
self
.print_view_path
(
&
vp
)
?
;
word
(
&
mut
self
.s
,
";"
)
?
;
word
(
&
mut
self
.s
,
";"
)
?
;
self
.end
()
?
;
// end inner head-block
self
.end
()
?
;
// end inner head-block
self
.end
()
?
;
// end outer head-block
self
.end
()
?
;
// end outer head-block
}
}
ast
::
ItemKind
::
Static
(
ref
ty
,
m
,
ref
expr
)
=>
{
ast
::
ItemKind
::
Static
(
ref
ty
,
m
,
ref
expr
)
=>
{
self
.head
(
&
visibility_qualified
(
item
.vis
,
self
.head
(
&
visibility_qualified
(
item
.vis
,
"static"
))
?
;
"static"
))
?
;
if
m
==
ast
::
Mutability
::
Mutable
{
if
m
==
ast
::
Mutability
::
Mutable
{
self
.word_space
(
"mut"
)
?
;
self
.word_space
(
"mut"
)
?
;
}
}
...
@@ -1163,8 +1159,7 @@ pub fn print_item(&mut self, item: &ast::Item) -> io::Result<()> {
...
@@ -1163,8 +1159,7 @@ pub fn print_item(&mut self, item: &ast::Item) -> io::Result<()> {
self
.end
()
?
;
// end the outer cbox
self
.end
()
?
;
// end the outer cbox
}
}
ast
::
ItemKind
::
Const
(
ref
ty
,
ref
expr
)
=>
{
ast
::
ItemKind
::
Const
(
ref
ty
,
ref
expr
)
=>
{
self
.head
(
&
visibility_qualified
(
item
.vis
,
self
.head
(
&
visibility_qualified
(
item
.vis
,
"const"
))
?
;
"const"
))
?
;
self
.print_ident
(
item
.ident
)
?
;
self
.print_ident
(
item
.ident
)
?
;
self
.word_space
(
":"
)
?
;
self
.word_space
(
":"
)
?
;
self
.print_type
(
&
ty
)
?
;
self
.print_type
(
&
ty
)
?
;
...
@@ -1192,8 +1187,7 @@ pub fn print_item(&mut self, item: &ast::Item) -> io::Result<()> {
...
@@ -1192,8 +1187,7 @@ pub fn print_item(&mut self, item: &ast::Item) -> io::Result<()> {
self
.print_block_with_attrs
(
&
body
,
&
item
.attrs
)
?
;
self
.print_block_with_attrs
(
&
body
,
&
item
.attrs
)
?
;
}
}
ast
::
ItemKind
::
Mod
(
ref
_
mod
)
=>
{
ast
::
ItemKind
::
Mod
(
ref
_
mod
)
=>
{
self
.head
(
&
visibility_qualified
(
item
.vis
,
self
.head
(
&
visibility_qualified
(
item
.vis
,
"mod"
))
?
;
"mod"
))
?
;
self
.print_ident
(
item
.ident
)
?
;
self
.print_ident
(
item
.ident
)
?
;
self
.nbsp
()
?
;
self
.nbsp
()
?
;
self
.bopen
()
?
;
self
.bopen
()
?
;
...
@@ -1555,8 +1549,8 @@ pub fn print_trait_item(&mut self, ti: &ast::TraitItem)
...
@@ -1555,8 +1549,8 @@ pub fn print_trait_item(&mut self, ti: &ast::TraitItem)
match
ti
.node
{
match
ti
.node
{
ast
::
TraitItemKind
::
Const
(
ref
ty
,
ref
default
)
=>
{
ast
::
TraitItemKind
::
Const
(
ref
ty
,
ref
default
)
=>
{
self
.print_associated_const
(
ti
.ident
,
&
ty
,
self
.print_associated_const
(
ti
.ident
,
&
ty
,
default
.as_ref
()
.map
(|
expr
|
&**
expr
),
default
.as_ref
()
.map
(|
expr
|
&**
expr
),
ast
::
Visibility
::
Inherited
)
?
;
ast
::
Visibility
::
Inherited
)
?
;
}
}
ast
::
TraitItemKind
::
Method
(
ref
sig
,
ref
body
)
=>
{
ast
::
TraitItemKind
::
Method
(
ref
sig
,
ref
body
)
=>
{
if
body
.is_some
()
{
if
body
.is_some
()
{
...
@@ -1572,7 +1566,7 @@ pub fn print_trait_item(&mut self, ti: &ast::TraitItem)
...
@@ -1572,7 +1566,7 @@ pub fn print_trait_item(&mut self, ti: &ast::TraitItem)
}
}
ast
::
TraitItemKind
::
Type
(
ref
bounds
,
ref
default
)
=>
{
ast
::
TraitItemKind
::
Type
(
ref
bounds
,
ref
default
)
=>
{
self
.print_associated_type
(
ti
.ident
,
Some
(
bounds
),
self
.print_associated_type
(
ti
.ident
,
Some
(
bounds
),
default
.as_ref
()
.map
(|
ty
|
&**
ty
))
?
;
default
.as_ref
()
.map
(|
ty
|
&**
ty
))
?
;
}
}
}
}
self
.ann
.post
(
self
,
NodeSubItem
(
ti
.id
))
self
.ann
.post
(
self
,
NodeSubItem
(
ti
.id
))
...
@@ -1923,7 +1917,7 @@ fn print_expr_method_call(&mut self,
...
@@ -1923,7 +1917,7 @@ fn print_expr_method_call(&mut self,
if
!
tys
.is_empty
()
{
if
!
tys
.is_empty
()
{
word
(
&
mut
self
.s
,
"::<"
)
?
;
word
(
&
mut
self
.s
,
"::<"
)
?
;
self
.commasep
(
Inconsistent
,
tys
,
self
.commasep
(
Inconsistent
,
tys
,
|
s
,
ty
|
s
.print_type
(
&
ty
))
?
;
|
s
,
ty
|
s
.print_type
(
&
ty
))
?
;
word
(
&
mut
self
.s
,
">"
)
?
;
word
(
&
mut
self
.s
,
">"
)
?
;
}
}
self
.print_call_post
(
base_args
)
self
.print_call_post
(
base_args
)
...
@@ -2223,7 +2217,7 @@ fn print_expr_outer_attr_style(&mut self,
...
@@ -2223,7 +2217,7 @@ fn print_expr_outer_attr_style(&mut self,
match
out
.constraint
.slice_shift_char
()
{
match
out
.constraint
.slice_shift_char
()
{
Some
((
'='
,
operand
))
if
out
.is_rw
=>
{
Some
((
'='
,
operand
))
if
out
.is_rw
=>
{
s
.print_string
(
&
format!
(
"+{}"
,
operand
),
s
.print_string
(
&
format!
(
"+{}"
,
operand
),
ast
::
StrStyle
::
Cooked
)
?
ast
::
StrStyle
::
Cooked
)
?
}
}
_
=>
s
.print_string
(
&
out
.constraint
,
ast
::
StrStyle
::
Cooked
)
?
_
=>
s
.print_string
(
&
out
.constraint
,
ast
::
StrStyle
::
Cooked
)
?
}
}
...
@@ -2267,10 +2261,10 @@ fn print_expr_outer_attr_style(&mut self,
...
@@ -2267,10 +2261,10 @@ fn print_expr_outer_attr_style(&mut self,
space
(
&
mut
self
.s
)
?
;
space
(
&
mut
self
.s
)
?
;
self
.word_space
(
":"
)
?
;
self
.word_space
(
":"
)
?
;
self
.commasep
(
Inconsistent
,
&
options
,
self
.commasep
(
Inconsistent
,
&
options
,
|
s
,
&
co
|
{
|
s
,
&
co
|
{
s
.print_string
(
co
,
ast
::
StrStyle
::
Cooked
)
?
;
s
.print_string
(
co
,
ast
::
StrStyle
::
Cooked
)
?
;
Ok
(())
Ok
(())
})
?
;
})
?
;
}
}
self
.pclose
()
?
;
self
.pclose
()
?
;
...
@@ -3037,13 +3031,13 @@ pub fn print_ty_fn(&mut self,
...
@@ -3037,13 +3031,13 @@ pub fn print_ty_fn(&mut self,
},
},
};
};
self
.print_fn
(
decl
,
self
.print_fn
(
decl
,
unsafety
,
unsafety
,
ast
::
Constness
::
NotConst
,
ast
::
Constness
::
NotConst
,
abi
,
abi
,
name
,
name
,
&
generics
,
&
generics
,
opt_explicit_self
,
opt_explicit_self
,
ast
::
Visibility
::
Inherited
)
?
;
ast
::
Visibility
::
Inherited
)
?
;
self
.end
()
self
.end
()
}
}
...
...
src/tools/error_index_generator/main.rs
浏览文件 @
2628f3cc
...
@@ -96,8 +96,8 @@ fn error_code_block(&self, output: &mut Write, info: &ErrorMetadata,
...
@@ -96,8 +96,8 @@ fn error_code_block(&self, output: &mut Write, info: &ErrorMetadata,
// Error title (with self-link).
// Error title (with self-link).
write!
(
output
,
write!
(
output
,
"<h2 id=
\"
{0}
\"
class=
\"
section-header
\"
><a href=
\"
#{0}
\"
>{0}</a></h2>
\n
"
,
"<h2 id=
\"
{0}
\"
class=
\"
section-header
\"
><a href=
\"
#{0}
\"
>{0}</a></h2>
\n
"
,
err_code
)
?
;
err_code
)
?
;
// Description rendered as markdown.
// Description rendered as markdown.
match
info
.description
{
match
info
.description
{
...
...
src/tools/rustbook/build.rs
浏览文件 @
2628f3cc
...
@@ -56,10 +56,10 @@ fn walk_item(item: &BookItem,
...
@@ -56,10 +56,10 @@ fn walk_item(item: &BookItem,
};
};
writeln!
(
out
,
"<li><a {} href='{}'><b>{}</b> {}</a>"
,
writeln!
(
out
,
"<li><a {} href='{}'><b>{}</b> {}</a>"
,
class_string
,
class_string
,
current_page
.path_to_root
.join
(
&
item
.path
)
.with_extension
(
"html"
)
.display
(),
current_page
.path_to_root
.join
(
&
item
.path
)
.with_extension
(
"html"
)
.display
(),
section
,
section
,
item
.title
)
?
;
item
.title
)
?
;
if
!
item
.children
.is_empty
()
{
if
!
item
.children
.is_empty
()
{
writeln!
(
out
,
"<ul class='section'>"
)
?
;
writeln!
(
out
,
"<ul class='section'>"
)
?
;
let
_
=
walk_items
(
&
item
.children
[
..
],
section
,
current_page
,
out
);
let
_
=
walk_items
(
&
item
.children
[
..
],
section
,
current_page
,
out
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录