Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
eb447f4e
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,发现更多精彩内容 >>
未验证
提交
eb447f4e
编写于
3月 24, 2017
作者:
O
Oliver Schneider
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix various useless derefs and slicings
上级
79feb947
变更
46
显示空白变更内容
内联
并排
Showing
46 changed file
with
120 addition
and
122 deletion
+120
-122
src/bootstrap/check.rs
src/bootstrap/check.rs
+1
-1
src/grammar/verify.rs
src/grammar/verify.rs
+3
-3
src/libcollections/linked_list.rs
src/libcollections/linked_list.rs
+1
-1
src/libgraphviz/lib.rs
src/libgraphviz/lib.rs
+3
-3
src/librustc/ich/fingerprint.rs
src/librustc/ich/fingerprint.rs
+2
-2
src/librustc/lint/context.rs
src/librustc/lint/context.rs
+2
-3
src/librustc/middle/stability.rs
src/librustc/middle/stability.rs
+1
-1
src/librustc_borrowck/borrowck/fragments.rs
src/librustc_borrowck/borrowck/fragments.rs
+12
-12
src/librustc_borrowck/borrowck/mod.rs
src/librustc_borrowck/borrowck/mod.rs
+1
-1
src/librustc_borrowck/graphviz.rs
src/librustc_borrowck/graphviz.rs
+1
-1
src/librustc_const_eval/_match.rs
src/librustc_const_eval/_match.rs
+2
-2
src/librustc_const_eval/check_match.rs
src/librustc_const_eval/check_match.rs
+1
-1
src/librustc_data_structures/accumulate_vec.rs
src/librustc_data_structures/accumulate_vec.rs
+4
-4
src/librustc_data_structures/base_n.rs
src/librustc_data_structures/base_n.rs
+1
-1
src/librustc_data_structures/blake2b.rs
src/librustc_data_structures/blake2b.rs
+1
-1
src/librustc_data_structures/indexed_set.rs
src/librustc_data_structures/indexed_set.rs
+4
-4
src/librustc_driver/lib.rs
src/librustc_driver/lib.rs
+5
-5
src/librustc_driver/pretty.rs
src/librustc_driver/pretty.rs
+3
-3
src/librustc_driver/test.rs
src/librustc_driver/test.rs
+1
-1
src/librustc_incremental/persist/file_format.rs
src/librustc_incremental/persist/file_format.rs
+2
-2
src/librustc_lint/bad_style.rs
src/librustc_lint/bad_style.rs
+1
-1
src/librustc_lint/builtin.rs
src/librustc_lint/builtin.rs
+1
-1
src/librustc_lint/unused.rs
src/librustc_lint/unused.rs
+1
-1
src/librustc_llvm/build.rs
src/librustc_llvm/build.rs
+2
-2
src/librustc_metadata/creader.rs
src/librustc_metadata/creader.rs
+1
-1
src/librustc_metadata/encoder.rs
src/librustc_metadata/encoder.rs
+2
-2
src/librustc_metadata/locator.rs
src/librustc_metadata/locator.rs
+3
-3
src/librustc_plugin/load.rs
src/librustc_plugin/load.rs
+3
-3
src/librustc_save_analysis/csv_dumper.rs
src/librustc_save_analysis/csv_dumper.rs
+1
-1
src/librustc_trans/abi.rs
src/librustc_trans/abi.rs
+1
-1
src/librustc_trans/adt.rs
src/librustc_trans/adt.rs
+4
-4
src/librustc_trans/asm.rs
src/librustc_trans/asm.rs
+2
-2
src/librustc_trans/back/archive.rs
src/librustc_trans/back/archive.rs
+2
-2
src/librustc_trans/back/link.rs
src/librustc_trans/back/link.rs
+7
-7
src/librustc_trans/back/lto.rs
src/librustc_trans/back/lto.rs
+2
-2
src/librustc_trans/back/rpath.rs
src/librustc_trans/back/rpath.rs
+7
-7
src/librustc_trans/back/symbol_export.rs
src/librustc_trans/back/symbol_export.rs
+2
-2
src/librustc_trans/back/symbol_names.rs
src/librustc_trans/back/symbol_names.rs
+1
-1
src/librustc_trans/back/write.rs
src/librustc_trans/back/write.rs
+6
-6
src/librustc_trans/base.rs
src/librustc_trans/base.rs
+6
-6
src/librustc_trans/builder.rs
src/librustc_trans/builder.rs
+3
-3
src/librustdoc/html/render.rs
src/librustdoc/html/render.rs
+2
-2
src/libsyntax/ext/tt/macro_rules.rs
src/libsyntax/ext/tt/macro_rules.rs
+1
-1
src/libsyntax/feature_gate.rs
src/libsyntax/feature_gate.rs
+4
-5
src/libsyntax/parse/parser.rs
src/libsyntax/parse/parser.rs
+3
-3
src/libsyntax/test.rs
src/libsyntax/test.rs
+1
-1
未找到文件。
src/bootstrap/check.rs
浏览文件 @
eb447f4e
...
@@ -586,7 +586,7 @@ fn android_copy_libs(build: &Build, compiler: &Compiler, target: &str) {
...
@@ -586,7 +586,7 @@ fn android_copy_libs(build: &Build, compiler: &Compiler, target: &str) {
.arg
(
ADB_TEST_DIR
));
.arg
(
ADB_TEST_DIR
));
let
target_dir
=
format!
(
"{}/{}"
,
ADB_TEST_DIR
,
target
);
let
target_dir
=
format!
(
"{}/{}"
,
ADB_TEST_DIR
,
target
);
build
.run
(
Command
::
new
(
"adb"
)
.args
(
&
[
"shell"
,
"mkdir"
,
&
target_dir
[
..
]
]));
build
.run
(
Command
::
new
(
"adb"
)
.args
(
&
[
"shell"
,
"mkdir"
,
&
target_dir
]));
for
f
in
t!
(
build
.sysroot_libdir
(
compiler
,
target
)
.read_dir
())
{
for
f
in
t!
(
build
.sysroot_libdir
(
compiler
,
target
)
.read_dir
())
{
let
f
=
t!
(
f
);
let
f
=
t!
(
f
);
...
...
src/grammar/verify.rs
浏览文件 @
eb447f4e
...
@@ -196,7 +196,7 @@ fn parse_antlr_token(s: &str, tokens: &HashMap<String, token::Token>, surrogate_
...
@@ -196,7 +196,7 @@ fn parse_antlr_token(s: &str, tokens: &HashMap<String, token::Token>, surrogate_
let
toknum
=
&
s
[
content_end
+
3
..
toknum_end
];
let
toknum
=
&
s
[
content_end
+
3
..
toknum_end
];
let
not_found
=
format!
(
"didn't find token {:?} in the map"
,
toknum
);
let
not_found
=
format!
(
"didn't find token {:?} in the map"
,
toknum
);
let
proto_tok
=
tokens
.get
(
toknum
)
.expect
(
&
not_found
[
..
]
);
let
proto_tok
=
tokens
.get
(
toknum
)
.expect
(
&
not_found
);
let
nm
=
Symbol
::
intern
(
content
);
let
nm
=
Symbol
::
intern
(
content
);
...
@@ -304,14 +304,14 @@ fn next(r: &mut lexer::StringReader) -> TokenAndSpan {
...
@@ -304,14 +304,14 @@ fn next(r: &mut lexer::StringReader) -> TokenAndSpan {
let
mut
token_file
=
File
::
open
(
&
Path
::
new
(
&
args
.next
()
.unwrap
()))
.unwrap
();
let
mut
token_file
=
File
::
open
(
&
Path
::
new
(
&
args
.next
()
.unwrap
()))
.unwrap
();
let
mut
token_list
=
String
::
new
();
let
mut
token_list
=
String
::
new
();
token_file
.read_to_string
(
&
mut
token_list
)
.unwrap
();
token_file
.read_to_string
(
&
mut
token_list
)
.unwrap
();
let
token_map
=
parse_token_list
(
&
token_list
[
..
]
);
let
token_map
=
parse_token_list
(
&
token_list
);
let
stdin
=
std
::
io
::
stdin
();
let
stdin
=
std
::
io
::
stdin
();
let
lock
=
stdin
.lock
();
let
lock
=
stdin
.lock
();
let
lines
=
lock
.lines
();
let
lines
=
lock
.lines
();
let
antlr_tokens
=
lines
.map
(|
l
|
parse_antlr_token
(
l
.unwrap
()
.trim
(),
let
antlr_tokens
=
lines
.map
(|
l
|
parse_antlr_token
(
l
.unwrap
()
.trim
(),
&
token_map
,
&
token_map
,
&
surrogate_pairs_pos
[
..
]
,
&
surrogate_pairs_pos
,
has_bom
));
has_bom
));
for
antlr_tok
in
antlr_tokens
{
for
antlr_tok
in
antlr_tokens
{
...
...
src/libcollections/linked_list.rs
浏览文件 @
eb447f4e
...
@@ -1376,7 +1376,7 @@ fn test_send() {
...
@@ -1376,7 +1376,7 @@ fn test_send() {
thread
::
spawn
(
move
||
{
thread
::
spawn
(
move
||
{
check_links
(
&
n
);
check_links
(
&
n
);
let
a
:
&
[
_
]
=
&
[
&
1
,
&
2
,
&
3
];
let
a
:
&
[
_
]
=
&
[
&
1
,
&
2
,
&
3
];
assert_eq!
(
a
,
&
n
.iter
()
.collect
::
<
Vec
<
_
>>
()[
..
]
);
assert_eq!
(
a
,
&
*
n
.iter
()
.collect
::
<
Vec
<
_
>>
()
);
})
})
.join
()
.join
()
.ok
()
.ok
()
...
...
src/libgraphviz/lib.rs
浏览文件 @
eb447f4e
...
@@ -554,7 +554,7 @@ fn escape_str(s: &str) -> String {
...
@@ -554,7 +554,7 @@ fn escape_str(s: &str) -> String {
pub
fn
to_dot_string
(
&
self
)
->
String
{
pub
fn
to_dot_string
(
&
self
)
->
String
{
match
self
{
match
self
{
&
LabelStr
(
ref
s
)
=>
format!
(
"
\"
{}
\"
"
,
s
.escape_default
()),
&
LabelStr
(
ref
s
)
=>
format!
(
"
\"
{}
\"
"
,
s
.escape_default
()),
&
EscStr
(
ref
s
)
=>
format!
(
"
\"
{}
\"
"
,
LabelText
::
escape_str
(
&
s
[
..
]
)),
&
EscStr
(
ref
s
)
=>
format!
(
"
\"
{}
\"
"
,
LabelText
::
escape_str
(
&
s
)),
&
HtmlStr
(
ref
s
)
=>
format!
(
"<{}>"
,
s
),
&
HtmlStr
(
ref
s
)
=>
format!
(
"<{}>"
,
s
),
}
}
}
}
...
@@ -587,7 +587,7 @@ pub fn suffix_line(self, suffix: LabelText) -> LabelText<'static> {
...
@@ -587,7 +587,7 @@ pub fn suffix_line(self, suffix: LabelText) -> LabelText<'static> {
let
mut
prefix
=
self
.pre_escaped_content
()
.into_owned
();
let
mut
prefix
=
self
.pre_escaped_content
()
.into_owned
();
let
suffix
=
suffix
.pre_escaped_content
();
let
suffix
=
suffix
.pre_escaped_content
();
prefix
.push_str
(
r"\n\n"
);
prefix
.push_str
(
r"\n\n"
);
prefix
.push_str
(
&
suffix
[
..
]
);
prefix
.push_str
(
&
suffix
);
EscStr
(
prefix
.into_cow
())
EscStr
(
prefix
.into_cow
())
}
}
}
}
...
@@ -878,7 +878,7 @@ impl<'a> Labeller<'a> for LabelledGraph {
...
@@ -878,7 +878,7 @@ impl<'a> Labeller<'a> for LabelledGraph {
type
Node
=
Node
;
type
Node
=
Node
;
type
Edge
=
&
'a
Edge
;
type
Edge
=
&
'a
Edge
;
fn
graph_id
(
&
'a
self
)
->
Id
<
'a
>
{
fn
graph_id
(
&
'a
self
)
->
Id
<
'a
>
{
Id
::
new
(
&
self
.name
[
..
]
)
.unwrap
()
Id
::
new
(
self
.name
)
.unwrap
()
}
}
fn
node_id
(
&
'a
self
,
n
:
&
Node
)
->
Id
<
'a
>
{
fn
node_id
(
&
'a
self
,
n
:
&
Node
)
->
Id
<
'a
>
{
id_name
(
n
)
id_name
(
n
)
...
...
src/librustc/ich/fingerprint.rs
浏览文件 @
eb447f4e
...
@@ -55,7 +55,7 @@ pub fn to_hex(&self) -> String {
...
@@ -55,7 +55,7 @@ pub fn to_hex(&self) -> String {
impl
Encodable
for
Fingerprint
{
impl
Encodable
for
Fingerprint
{
#[inline]
#[inline]
fn
encode
<
S
:
Encoder
>
(
&
self
,
s
:
&
mut
S
)
->
Result
<
(),
S
::
Error
>
{
fn
encode
<
S
:
Encoder
>
(
&
self
,
s
:
&
mut
S
)
->
Result
<
(),
S
::
Error
>
{
for
&
byte
in
&
self
.0
[
..
]
{
for
&
byte
in
&
self
.0
{
s
.emit_u8
(
byte
)
?
;
s
.emit_u8
(
byte
)
?
;
}
}
Ok
(())
Ok
(())
...
@@ -66,7 +66,7 @@ impl Decodable for Fingerprint {
...
@@ -66,7 +66,7 @@ impl Decodable for Fingerprint {
#[inline]
#[inline]
fn
decode
<
D
:
Decoder
>
(
d
:
&
mut
D
)
->
Result
<
Fingerprint
,
D
::
Error
>
{
fn
decode
<
D
:
Decoder
>
(
d
:
&
mut
D
)
->
Result
<
Fingerprint
,
D
::
Error
>
{
let
mut
result
=
Fingerprint
([
0u8
;
FINGERPRINT_LENGTH
]);
let
mut
result
=
Fingerprint
([
0u8
;
FINGERPRINT_LENGTH
]);
for
byte
in
&
mut
result
.0
[
..
]
{
for
byte
in
&
mut
result
.0
{
*
byte
=
d
.read_u8
()
?
;
*
byte
=
d
.read_u8
()
?
;
}
}
Ok
(
result
)
Ok
(
result
)
...
...
src/librustc/lint/context.rs
浏览文件 @
eb447f4e
...
@@ -40,7 +40,6 @@
...
@@ -40,7 +40,6 @@
use
std
::
default
::
Default
as
StdDefault
;
use
std
::
default
::
Default
as
StdDefault
;
use
std
::
mem
;
use
std
::
mem
;
use
std
::
fmt
;
use
std
::
fmt
;
use
std
::
ops
::
Deref
;
use
syntax
::
attr
;
use
syntax
::
attr
;
use
syntax
::
ast
;
use
syntax
::
ast
;
use
syntax
::
symbol
::
Symbol
;
use
syntax
::
symbol
::
Symbol
;
...
@@ -485,7 +484,7 @@ pub fn raw_struct_lint<'a, S>(sess: &'a Session,
...
@@ -485,7 +484,7 @@ pub fn raw_struct_lint<'a, S>(sess: &'a Session,
Allow
=>
bug!
(
"earlier conditional return should handle Allow case"
)
Allow
=>
bug!
(
"earlier conditional return should handle Allow case"
)
};
};
let
hyphen_case_lint_name
=
name
.replace
(
"_"
,
"-"
);
let
hyphen_case_lint_name
=
name
.replace
(
"_"
,
"-"
);
if
lint_flag_val
.as_str
()
.deref
()
==
name
{
if
lint_flag_val
.as_str
()
==
name
{
err
.note
(
&
format!
(
"requested on the command line with `{} {}`"
,
err
.note
(
&
format!
(
"requested on the command line with `{} {}`"
,
flag
,
hyphen_case_lint_name
));
flag
,
hyphen_case_lint_name
));
}
else
{
}
else
{
...
@@ -496,7 +495,7 @@ pub fn raw_struct_lint<'a, S>(sess: &'a Session,
...
@@ -496,7 +495,7 @@ pub fn raw_struct_lint<'a, S>(sess: &'a Session,
},
},
Node
(
lint_attr_name
,
src
)
=>
{
Node
(
lint_attr_name
,
src
)
=>
{
def
=
Some
(
src
);
def
=
Some
(
src
);
if
lint_attr_name
.as_str
()
.deref
()
!=
name
{
if
lint_attr_name
.as_str
()
!=
name
{
let
level_str
=
level
.as_str
();
let
level_str
=
level
.as_str
();
err
.note
(
&
format!
(
"#[{}({})] implied by #[{}({})]"
,
err
.note
(
&
format!
(
"#[{}({})] implied by #[{}({})]"
,
level_str
,
name
,
level_str
,
lint_attr_name
));
level_str
,
name
,
level_str
,
lint_attr_name
));
...
...
src/librustc/middle/stability.rs
浏览文件 @
eb447f4e
...
@@ -536,7 +536,7 @@ pub fn check_stability(self, def_id: DefId, id: NodeId, span: Span) {
...
@@ -536,7 +536,7 @@ pub fn check_stability(self, def_id: DefId, id: NodeId, span: Span) {
if
!
self
.stability
.borrow
()
.active_features
.contains
(
feature
)
{
if
!
self
.stability
.borrow
()
.active_features
.contains
(
feature
)
{
let
msg
=
match
*
reason
{
let
msg
=
match
*
reason
{
Some
(
ref
r
)
=>
format!
(
"use of unstable library feature '{}': {}"
,
Some
(
ref
r
)
=>
format!
(
"use of unstable library feature '{}': {}"
,
&
feature
.as_str
(),
&
r
),
feature
.as_str
(),
&
r
),
None
=>
format!
(
"use of unstable library feature '{}'"
,
&
feature
)
None
=>
format!
(
"use of unstable library feature '{}'"
,
&
feature
)
};
};
emit_feature_err
(
&
self
.sess.parse_sess
,
&
feature
.as_str
(),
span
,
emit_feature_err
(
&
self
.sess.parse_sess
,
&
feature
.as_str
(),
span
,
...
...
src/librustc_borrowck/borrowck/fragments.rs
浏览文件 @
eb447f4e
...
@@ -267,11 +267,11 @@ pub fn fixup_fragment_sets<'a, 'tcx>(this: &MoveData<'tcx>, tcx: TyCtxt<'a, 'tcx
...
@@ -267,11 +267,11 @@ pub fn fixup_fragment_sets<'a, 'tcx>(this: &MoveData<'tcx>, tcx: TyCtxt<'a, 'tcx
// First, filter out duplicates
// First, filter out duplicates
moved
.sort
();
moved
.sort
();
moved
.dedup
();
moved
.dedup
();
debug!
(
"fragments 1 moved: {:?}"
,
path_lps
(
&
moved
[
..
]
));
debug!
(
"fragments 1 moved: {:?}"
,
path_lps
(
&
moved
));
assigned
.sort
();
assigned
.sort
();
assigned
.dedup
();
assigned
.dedup
();
debug!
(
"fragments 1 assigned: {:?}"
,
path_lps
(
&
assigned
[
..
]
));
debug!
(
"fragments 1 assigned: {:?}"
,
path_lps
(
&
assigned
));
// Second, build parents from the moved and assigned.
// Second, build parents from the moved and assigned.
for
m
in
&
moved
{
for
m
in
&
moved
{
...
@@ -291,14 +291,14 @@ pub fn fixup_fragment_sets<'a, 'tcx>(this: &MoveData<'tcx>, tcx: TyCtxt<'a, 'tcx
...
@@ -291,14 +291,14 @@ pub fn fixup_fragment_sets<'a, 'tcx>(this: &MoveData<'tcx>, tcx: TyCtxt<'a, 'tcx
parents
.sort
();
parents
.sort
();
parents
.dedup
();
parents
.dedup
();
debug!
(
"fragments 2 parents: {:?}"
,
path_lps
(
&
parents
[
..
]
));
debug!
(
"fragments 2 parents: {:?}"
,
path_lps
(
&
parents
));
// Third, filter the moved and assigned fragments down to just the non-parents
// Third, filter the moved and assigned fragments down to just the non-parents
moved
.retain
(|
f
|
non_member
(
*
f
,
&
parents
[
..
]
));
moved
.retain
(|
f
|
non_member
(
*
f
,
&
parents
));
debug!
(
"fragments 3 moved: {:?}"
,
path_lps
(
&
moved
[
..
]
));
debug!
(
"fragments 3 moved: {:?}"
,
path_lps
(
&
moved
));
assigned
.retain
(|
f
|
non_member
(
*
f
,
&
parents
[
..
]
));
assigned
.retain
(|
f
|
non_member
(
*
f
,
&
parents
));
debug!
(
"fragments 3 assigned: {:?}"
,
path_lps
(
&
assigned
[
..
]
));
debug!
(
"fragments 3 assigned: {:?}"
,
path_lps
(
&
assigned
));
// Fourth, build the leftover from the moved, assigned, and parents.
// Fourth, build the leftover from the moved, assigned, and parents.
for
m
in
&
moved
{
for
m
in
&
moved
{
...
@@ -316,16 +316,16 @@ pub fn fixup_fragment_sets<'a, 'tcx>(this: &MoveData<'tcx>, tcx: TyCtxt<'a, 'tcx
...
@@ -316,16 +316,16 @@ pub fn fixup_fragment_sets<'a, 'tcx>(this: &MoveData<'tcx>, tcx: TyCtxt<'a, 'tcx
unmoved
.sort
();
unmoved
.sort
();
unmoved
.dedup
();
unmoved
.dedup
();
debug!
(
"fragments 4 unmoved: {:?}"
,
frag_lps
(
&
unmoved
[
..
]
));
debug!
(
"fragments 4 unmoved: {:?}"
,
frag_lps
(
&
unmoved
));
// Fifth, filter the leftover fragments down to its core.
// Fifth, filter the leftover fragments down to its core.
unmoved
.retain
(|
f
|
match
*
f
{
unmoved
.retain
(|
f
|
match
*
f
{
AllButOneFrom
(
_
)
=>
true
,
AllButOneFrom
(
_
)
=>
true
,
Just
(
mpi
)
=>
non_member
(
mpi
,
&
parents
[
..
]
)
&&
Just
(
mpi
)
=>
non_member
(
mpi
,
&
parents
)
&&
non_member
(
mpi
,
&
moved
[
..
]
)
&&
non_member
(
mpi
,
&
moved
)
&&
non_member
(
mpi
,
&
assigned
[
..
]
)
non_member
(
mpi
,
&
assigned
)
});
});
debug!
(
"fragments 5 unmoved: {:?}"
,
frag_lps
(
&
unmoved
[
..
]
));
debug!
(
"fragments 5 unmoved: {:?}"
,
frag_lps
(
&
unmoved
));
// Swap contents back in.
// Swap contents back in.
fragments
.unmoved_fragments
=
unmoved
;
fragments
.unmoved_fragments
=
unmoved
;
...
...
src/librustc_borrowck/borrowck/mod.rs
浏览文件 @
eb447f4e
...
@@ -112,7 +112,7 @@ fn borrowck_fn<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, body_id: hir::BodyId) {
...
@@ -112,7 +112,7 @@ fn borrowck_fn<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, body_id: hir::BodyId) {
&
flowed_moves
.move_data
,
&
flowed_moves
.move_data
,
owner_id
);
owner_id
);
check_loans
::
check_loans
(
bccx
,
&
loan_dfcx
,
&
flowed_moves
,
&
all_loans
[
..
]
,
body
);
check_loans
::
check_loans
(
bccx
,
&
loan_dfcx
,
&
flowed_moves
,
&
all_loans
,
body
);
}
}
fn
build_borrowck_dataflow_data
<
'a
,
'tcx
>
(
this
:
&
mut
BorrowckCtxt
<
'a
,
'tcx
>
,
fn
build_borrowck_dataflow_data
<
'a
,
'tcx
>
(
this
:
&
mut
BorrowckCtxt
<
'a
,
'tcx
>
,
...
...
src/librustc_borrowck/graphviz.rs
浏览文件 @
eb447f4e
...
@@ -88,7 +88,7 @@ fn build_set<O:DataFlowOperator, F>(&self,
...
@@ -88,7 +88,7 @@ fn build_set<O:DataFlowOperator, F>(&self,
set
.push_str
(
", "
);
set
.push_str
(
", "
);
}
}
let
loan_str
=
self
.borrowck_ctxt
.loan_path_to_string
(
&
lp
);
let
loan_str
=
self
.borrowck_ctxt
.loan_path_to_string
(
&
lp
);
set
.push_str
(
&
loan_str
[
..
]
);
set
.push_str
(
&
loan_str
);
saw_some
=
true
;
saw_some
=
true
;
true
true
});
});
...
...
src/librustc_const_eval/_match.rs
浏览文件 @
eb447f4e
...
@@ -680,10 +680,10 @@ fn is_useful_specialized<'p, 'a:'p, 'tcx: 'a>(
...
@@ -680,10 +680,10 @@ fn is_useful_specialized<'p, 'a:'p, 'tcx: 'a>(
})
.collect
();
})
.collect
();
let
wild_patterns
:
Vec
<
_
>
=
wild_patterns_owned
.iter
()
.collect
();
let
wild_patterns
:
Vec
<
_
>
=
wild_patterns_owned
.iter
()
.collect
();
let
matrix
=
Matrix
(
m
.iter
()
.flat_map
(|
r
|
{
let
matrix
=
Matrix
(
m
.iter
()
.flat_map
(|
r
|
{
specialize
(
cx
,
&
r
[
..
]
,
&
ctor
,
&
wild_patterns
)
specialize
(
cx
,
&
r
,
&
ctor
,
&
wild_patterns
)
})
.collect
());
})
.collect
());
match
specialize
(
cx
,
v
,
&
ctor
,
&
wild_patterns
)
{
match
specialize
(
cx
,
v
,
&
ctor
,
&
wild_patterns
)
{
Some
(
v
)
=>
match
is_useful
(
cx
,
&
matrix
,
&
v
[
..
]
,
witness
)
{
Some
(
v
)
=>
match
is_useful
(
cx
,
&
matrix
,
&
v
,
witness
)
{
UsefulWithWitness
(
witnesses
)
=>
UsefulWithWitness
(
UsefulWithWitness
(
witnesses
)
=>
UsefulWithWitness
(
witnesses
.into_iter
()
witnesses
.into_iter
()
.map
(|
witness
|
witness
.apply_constructor
(
cx
,
&
ctor
,
lty
))
.map
(|
witness
|
witness
.apply_constructor
(
cx
,
&
ctor
,
lty
))
...
...
src/librustc_const_eval/check_match.rs
浏览文件 @
eb447f4e
...
@@ -311,7 +311,7 @@ fn check_arms<'a, 'tcx>(cx: &mut MatchCheckCtxt<'a, 'tcx>,
...
@@ -311,7 +311,7 @@ fn check_arms<'a, 'tcx>(cx: &mut MatchCheckCtxt<'a, 'tcx>,
for
&
(
pat
,
hir_pat
)
in
pats
{
for
&
(
pat
,
hir_pat
)
in
pats
{
let
v
=
vec!
[
pat
];
let
v
=
vec!
[
pat
];
match
is_useful
(
cx
,
&
seen
,
&
v
[
..
]
,
LeaveOutWitness
)
{
match
is_useful
(
cx
,
&
seen
,
&
v
,
LeaveOutWitness
)
{
NotUseful
=>
{
NotUseful
=>
{
match
source
{
match
source
{
hir
::
MatchSource
::
IfLetDesugar
{
..
}
=>
{
hir
::
MatchSource
::
IfLetDesugar
{
..
}
=>
{
...
...
src/librustc_data_structures/accumulate_vec.rs
浏览文件 @
eb447f4e
...
@@ -91,8 +91,8 @@ impl<A: Array> Deref for AccumulateVec<A> {
...
@@ -91,8 +91,8 @@ impl<A: Array> Deref for AccumulateVec<A> {
type
Target
=
[
A
::
Element
];
type
Target
=
[
A
::
Element
];
fn
deref
(
&
self
)
->
&
Self
::
Target
{
fn
deref
(
&
self
)
->
&
Self
::
Target
{
match
*
self
{
match
*
self
{
AccumulateVec
::
Array
(
ref
v
)
=>
&
v
[
..
]
,
AccumulateVec
::
Array
(
ref
v
)
=>
v
,
AccumulateVec
::
Heap
(
ref
v
)
=>
&
v
[
..
]
,
AccumulateVec
::
Heap
(
ref
v
)
=>
v
,
}
}
}
}
}
}
...
@@ -100,8 +100,8 @@ fn deref(&self) -> &Self::Target {
...
@@ -100,8 +100,8 @@ fn deref(&self) -> &Self::Target {
impl
<
A
:
Array
>
DerefMut
for
AccumulateVec
<
A
>
{
impl
<
A
:
Array
>
DerefMut
for
AccumulateVec
<
A
>
{
fn
deref_mut
(
&
mut
self
)
->
&
mut
[
A
::
Element
]
{
fn
deref_mut
(
&
mut
self
)
->
&
mut
[
A
::
Element
]
{
match
*
self
{
match
*
self
{
AccumulateVec
::
Array
(
ref
mut
v
)
=>
&
mut
v
[
..
]
,
AccumulateVec
::
Array
(
ref
mut
v
)
=>
v
,
AccumulateVec
::
Heap
(
ref
mut
v
)
=>
&
mut
v
[
..
]
,
AccumulateVec
::
Heap
(
ref
mut
v
)
=>
v
,
}
}
}
}
}
}
...
...
src/librustc_data_structures/base_n.rs
浏览文件 @
eb447f4e
...
@@ -48,7 +48,7 @@ pub fn encode(n: u64, base: u64) -> String {
...
@@ -48,7 +48,7 @@ pub fn encode(n: u64, base: u64) -> String {
#[test]
#[test]
fn
test_encode
()
{
fn
test_encode
()
{
fn
test
(
n
:
u64
,
base
:
u64
)
{
fn
test
(
n
:
u64
,
base
:
u64
)
{
assert_eq!
(
Ok
(
n
),
u64
::
from_str_radix
(
&
encode
(
n
,
base
)
[
..
]
,
base
as
u32
));
assert_eq!
(
Ok
(
n
),
u64
::
from_str_radix
(
&
encode
(
n
,
base
),
base
as
u32
));
}
}
for
base
in
2
..
37
{
for
base
in
2
..
37
{
...
...
src/librustc_data_structures/blake2b.rs
浏览文件 @
eb447f4e
...
@@ -35,7 +35,7 @@ pub struct Blake2bCtx {
...
@@ -35,7 +35,7 @@ pub struct Blake2bCtx {
impl
::
std
::
fmt
::
Debug
for
Blake2bCtx
{
impl
::
std
::
fmt
::
Debug
for
Blake2bCtx
{
fn
fmt
(
&
self
,
fmt
:
&
mut
::
std
::
fmt
::
Formatter
)
->
Result
<
(),
::
std
::
fmt
::
Error
>
{
fn
fmt
(
&
self
,
fmt
:
&
mut
::
std
::
fmt
::
Formatter
)
->
Result
<
(),
::
std
::
fmt
::
Error
>
{
try!
(
write!
(
fmt
,
"hash: "
));
try!
(
write!
(
fmt
,
"hash: "
));
for
v
in
&
self
.h
[
..
]
{
for
v
in
&
self
.h
{
try!
(
write!
(
fmt
,
"{:x}"
,
v
));
try!
(
write!
(
fmt
,
"{:x}"
,
v
));
}
}
Ok
(())
Ok
(())
...
...
src/librustc_data_structures/indexed_set.rs
浏览文件 @
eb447f4e
...
@@ -91,13 +91,13 @@ unsafe fn from_slice_mut(s: &mut [Word]) -> &mut Self {
...
@@ -91,13 +91,13 @@ unsafe fn from_slice_mut(s: &mut [Word]) -> &mut Self {
impl
<
T
:
Idx
>
Deref
for
IdxSetBuf
<
T
>
{
impl
<
T
:
Idx
>
Deref
for
IdxSetBuf
<
T
>
{
type
Target
=
IdxSet
<
T
>
;
type
Target
=
IdxSet
<
T
>
;
fn
deref
(
&
self
)
->
&
IdxSet
<
T
>
{
fn
deref
(
&
self
)
->
&
IdxSet
<
T
>
{
unsafe
{
IdxSet
::
from_slice
(
&
self
.bits
[
..
]
)
}
unsafe
{
IdxSet
::
from_slice
(
&
self
.bits
)
}
}
}
}
}
impl
<
T
:
Idx
>
DerefMut
for
IdxSetBuf
<
T
>
{
impl
<
T
:
Idx
>
DerefMut
for
IdxSetBuf
<
T
>
{
fn
deref_mut
(
&
mut
self
)
->
&
mut
IdxSet
<
T
>
{
fn
deref_mut
(
&
mut
self
)
->
&
mut
IdxSet
<
T
>
{
unsafe
{
IdxSet
::
from_slice_mut
(
&
mut
self
.bits
[
..
]
)
}
unsafe
{
IdxSet
::
from_slice_mut
(
&
mut
self
.bits
)
}
}
}
}
}
...
@@ -135,11 +135,11 @@ pub fn contains(&self, elem: &T) -> bool {
...
@@ -135,11 +135,11 @@ pub fn contains(&self, elem: &T) -> bool {
}
}
pub
fn
words
(
&
self
)
->
&
[
Word
]
{
pub
fn
words
(
&
self
)
->
&
[
Word
]
{
&
self
.bits
[
..
]
&
self
.bits
}
}
pub
fn
words_mut
(
&
mut
self
)
->
&
mut
[
Word
]
{
pub
fn
words_mut
(
&
mut
self
)
->
&
mut
[
Word
]
{
&
mut
self
.bits
[
..
]
&
mut
self
.bits
}
}
pub
fn
clone_from
(
&
mut
self
,
other
:
&
IdxSet
<
T
>
)
{
pub
fn
clone_from
(
&
mut
self
,
other
:
&
IdxSet
<
T
>
)
{
...
...
src/librustc_driver/lib.rs
浏览文件 @
eb447f4e
...
@@ -233,7 +233,7 @@ fn make_output(matches: &getopts::Matches) -> (Option<PathBuf>, Option<PathBuf>)
...
@@ -233,7 +233,7 @@ fn make_output(matches: &getopts::Matches) -> (Option<PathBuf>, Option<PathBuf>)
// Extract input (string or file and optional path) from matches.
// Extract input (string or file and optional path) from matches.
fn
make_input
(
free_matches
:
&
[
String
])
->
Option
<
(
Input
,
Option
<
PathBuf
>
)
>
{
fn
make_input
(
free_matches
:
&
[
String
])
->
Option
<
(
Input
,
Option
<
PathBuf
>
)
>
{
if
free_matches
.len
()
==
1
{
if
free_matches
.len
()
==
1
{
let
ifile
=
&
free_matches
[
0
]
[
..
]
;
let
ifile
=
&
free_matches
[
0
];
if
ifile
==
"-"
{
if
ifile
==
"-"
{
let
mut
src
=
String
::
new
();
let
mut
src
=
String
::
new
();
io
::
stdin
()
.read_to_string
(
&
mut
src
)
.unwrap
();
io
::
stdin
()
.read_to_string
(
&
mut
src
)
.unwrap
();
...
@@ -800,7 +800,7 @@ fn sort_lint_groups(lints: Vec<(&'static str, Vec<lint::LintId>, bool)>)
...
@@ -800,7 +800,7 @@ fn sort_lint_groups(lints: Vec<(&'static str, Vec<lint::LintId>, bool)>)
for
lint
in
lints
{
for
lint
in
lints
{
let
name
=
lint
.name_lower
()
.replace
(
"_"
,
"-"
);
let
name
=
lint
.name_lower
()
.replace
(
"_"
,
"-"
);
println!
(
" {} {:7.7} {}"
,
println!
(
" {} {:7.7} {}"
,
padded
(
&
name
[
..
]
),
padded
(
&
name
),
lint
.default_level
.as_str
(),
lint
.default_level
.as_str
(),
lint
.desc
);
lint
.desc
);
}
}
...
@@ -838,7 +838,7 @@ fn sort_lint_groups(lints: Vec<(&'static str, Vec<lint::LintId>, bool)>)
...
@@ -838,7 +838,7 @@ fn sort_lint_groups(lints: Vec<(&'static str, Vec<lint::LintId>, bool)>)
.map
(|
x
|
x
.to_string
()
.replace
(
"_"
,
"-"
))
.map
(|
x
|
x
.to_string
()
.replace
(
"_"
,
"-"
))
.collect
::
<
Vec
<
String
>>
()
.collect
::
<
Vec
<
String
>>
()
.join
(
", "
);
.join
(
", "
);
println!
(
" {} {}"
,
padded
(
&
name
[
..
]
),
desc
);
println!
(
" {} {}"
,
padded
(
&
name
),
desc
);
}
}
println!
(
"
\n
"
);
println!
(
"
\n
"
);
};
};
...
@@ -945,7 +945,7 @@ pub fn handle_options(args: &[String]) -> Option<getopts::Matches> {
...
@@ -945,7 +945,7 @@ pub fn handle_options(args: &[String]) -> Option<getopts::Matches> {
.into_iter
()
.into_iter
()
.map
(|
x
|
x
.opt_group
)
.map
(|
x
|
x
.opt_group
)
.collect
();
.collect
();
let
matches
=
match
getopts
::
getopts
(
&
args
[
..
]
,
&
all_groups
)
{
let
matches
=
match
getopts
::
getopts
(
&
args
,
&
all_groups
)
{
Ok
(
m
)
=>
m
,
Ok
(
m
)
=>
m
,
Err
(
f
)
=>
early_error
(
ErrorOutputType
::
default
(),
&
f
.to_string
()),
Err
(
f
)
=>
early_error
(
ErrorOutputType
::
default
(),
&
f
.to_string
()),
};
};
...
@@ -1084,7 +1084,7 @@ fn flush(&mut self) -> io::Result<()> {
...
@@ -1084,7 +1084,7 @@ fn flush(&mut self) -> io::Result<()> {
format!
(
"we would appreciate a bug report: {}"
,
BUG_REPORT_URL
)];
format!
(
"we would appreciate a bug report: {}"
,
BUG_REPORT_URL
)];
for
note
in
&
xs
{
for
note
in
&
xs
{
handler
.emit
(
&
MultiSpan
::
new
(),
handler
.emit
(
&
MultiSpan
::
new
(),
&
note
[
..
]
,
&
note
,
errors
::
Level
::
Note
);
errors
::
Level
::
Note
);
}
}
if
match
env
::
var_os
(
"RUST_BACKTRACE"
)
{
if
match
env
::
var_os
(
"RUST_BACKTRACE"
)
{
...
...
src/librustc_driver/pretty.rs
浏览文件 @
eb447f4e
...
@@ -589,7 +589,7 @@ fn all_matching_node_ids<'a, 'hir>(&'a self,
...
@@ -589,7 +589,7 @@ fn all_matching_node_ids<'a, 'hir>(&'a self,
->
NodesMatchingUII
<
'a
,
'hir
>
{
->
NodesMatchingUII
<
'a
,
'hir
>
{
match
*
self
{
match
*
self
{
ItemViaNode
(
node_id
)
=>
NodesMatchingDirect
(
Some
(
node_id
)
.into_iter
()),
ItemViaNode
(
node_id
)
=>
NodesMatchingDirect
(
Some
(
node_id
)
.into_iter
()),
ItemViaPath
(
ref
parts
)
=>
NodesMatchingSuffix
(
map
.nodes_matching_suffix
(
&
parts
[
..
]
)),
ItemViaPath
(
ref
parts
)
=>
NodesMatchingSuffix
(
map
.nodes_matching_suffix
(
&
parts
)),
}
}
}
}
...
@@ -600,7 +600,7 @@ fn to_one_node_id(self, user_option: &str, sess: &Session, map: &hir_map::Map) -
...
@@ -600,7 +600,7 @@ fn to_one_node_id(self, user_option: &str, sess: &Session, map: &hir_map::Map) -
user_option
,
user_option
,
self
.reconstructed_input
(),
self
.reconstructed_input
(),
is_wrong_because
);
is_wrong_because
);
sess
.fatal
(
&
message
[
..
]
)
sess
.fatal
(
&
message
)
};
};
let
mut
saw_node
=
ast
::
DUMMY_NODE_ID
;
let
mut
saw_node
=
ast
::
DUMMY_NODE_ID
;
...
@@ -771,7 +771,7 @@ fn print_flowgraph<'a, 'tcx, W: Write>(variants: Vec<borrowck_dot::Variant>,
...
@@ -771,7 +771,7 @@ fn print_flowgraph<'a, 'tcx, W: Write>(variants: Vec<borrowck_dot::Variant>,
fn
expand_err_details
(
r
:
io
::
Result
<
()
>
)
->
io
::
Result
<
()
>
{
fn
expand_err_details
(
r
:
io
::
Result
<
()
>
)
->
io
::
Result
<
()
>
{
r
.map_err
(|
ioerr
|
{
r
.map_err
(|
ioerr
|
{
io
::
Error
::
new
(
io
::
ErrorKind
::
Other
,
io
::
Error
::
new
(
io
::
ErrorKind
::
Other
,
&
format!
(
"graphviz::render failed: {}"
,
ioerr
)[
..
]
)
format!
(
"graphviz::render failed: {}"
,
ioerr
)
)
})
})
}
}
}
}
...
...
src/librustc_driver/test.rs
浏览文件 @
eb447f4e
...
@@ -289,7 +289,7 @@ pub fn t_pair(&self, ty1: Ty<'tcx>, ty2: Ty<'tcx>) -> Ty<'tcx> {
...
@@ -289,7 +289,7 @@ pub fn t_pair(&self, ty1: Ty<'tcx>, ty2: Ty<'tcx>) -> Ty<'tcx> {
pub
fn
t_param
(
&
self
,
index
:
u32
)
->
Ty
<
'tcx
>
{
pub
fn
t_param
(
&
self
,
index
:
u32
)
->
Ty
<
'tcx
>
{
let
name
=
format!
(
"T{}"
,
index
);
let
name
=
format!
(
"T{}"
,
index
);
self
.infcx.tcx
.mk_param
(
index
,
Symbol
::
intern
(
&
name
[
..
]
))
self
.infcx.tcx
.mk_param
(
index
,
Symbol
::
intern
(
&
name
))
}
}
pub
fn
re_early_bound
(
&
self
,
index
:
u32
,
name
:
&
'static
str
)
->
&
'tcx
ty
::
Region
{
pub
fn
re_early_bound
(
&
self
,
index
:
u32
,
name
:
&
'static
str
)
->
&
'tcx
ty
::
Region
{
...
...
src/librustc_incremental/persist/file_format.rs
浏览文件 @
eb447f4e
...
@@ -99,9 +99,9 @@ pub fn read_file(sess: &Session, path: &Path) -> io::Result<Option<Vec<u8>>> {
...
@@ -99,9 +99,9 @@ pub fn read_file(sess: &Session, path: &Path) -> io::Result<Option<Vec<u8>>> {
let
rustc_version_str_len
=
rustc_version_str_len
[
0
]
as
usize
;
let
rustc_version_str_len
=
rustc_version_str_len
[
0
]
as
usize
;
let
mut
buffer
=
Vec
::
with_capacity
(
rustc_version_str_len
);
let
mut
buffer
=
Vec
::
with_capacity
(
rustc_version_str_len
);
buffer
.resize
(
rustc_version_str_len
,
0
);
buffer
.resize
(
rustc_version_str_len
,
0
);
file
.read_exact
(
&
mut
buffer
[
..
]
)
?
;
file
.read_exact
(
&
mut
buffer
)
?
;
if
&
buffer
[
..
]
!=
rustc_version
()
.as_bytes
()
{
if
buffer
!=
rustc_version
()
.as_bytes
()
{
report_format_mismatch
(
sess
,
path
,
"Different compiler version"
);
report_format_mismatch
(
sess
,
path
,
"Different compiler version"
);
return
Ok
(
None
);
return
Ok
(
None
);
}
}
...
...
src/librustc_lint/bad_style.rs
浏览文件 @
eb447f4e
...
@@ -88,7 +88,7 @@ fn to_camel_case(s: &str) -> String {
...
@@ -88,7 +88,7 @@ fn to_camel_case(s: &str) -> String {
}
else
{
}
else
{
format!
(
"{} `{}` should have a camel case name such as `{}`"
,
sort
,
name
,
c
)
format!
(
"{} `{}` should have a camel case name such as `{}`"
,
sort
,
name
,
c
)
};
};
cx
.span_lint
(
NON_CAMEL_CASE_TYPES
,
span
,
&
m
[
..
]
);
cx
.span_lint
(
NON_CAMEL_CASE_TYPES
,
span
,
&
m
);
}
}
}
}
}
}
...
...
src/librustc_lint/builtin.rs
浏览文件 @
eb447f4e
...
@@ -334,7 +334,7 @@ fn enter_lint_attrs(&mut self, _: &LateContext, attrs: &[ast::Attribute]) {
...
@@ -334,7 +334,7 @@ fn enter_lint_attrs(&mut self, _: &LateContext, attrs: &[ast::Attribute]) {
attr
.check_name
(
"doc"
)
&&
attr
.check_name
(
"doc"
)
&&
match
attr
.meta_item_list
()
{
match
attr
.meta_item_list
()
{
None
=>
false
,
None
=>
false
,
Some
(
l
)
=>
attr
::
list_contains_name
(
&
l
[
..
]
,
"hidden"
),
Some
(
l
)
=>
attr
::
list_contains_name
(
&
l
,
"hidden"
),
}
}
});
});
self
.doc_hidden_stack
.push
(
doc_hidden
);
self
.doc_hidden_stack
.push
(
doc_hidden
);
...
...
src/librustc_lint/unused.rs
浏览文件 @
eb447f4e
...
@@ -146,7 +146,7 @@ fn check_stmt(&mut self, cx: &LateContext, s: &hir::Stmt) {
...
@@ -146,7 +146,7 @@ fn check_stmt(&mut self, cx: &LateContext, s: &hir::Stmt) {
ty
::
TyBool
=>
return
,
ty
::
TyBool
=>
return
,
ty
::
TyAdt
(
def
,
_
)
=>
{
ty
::
TyAdt
(
def
,
_
)
=>
{
let
attrs
=
cx
.tcx
.get_attrs
(
def
.did
);
let
attrs
=
cx
.tcx
.get_attrs
(
def
.did
);
check_must_use
(
cx
,
&
attrs
[
..
]
,
s
.span
)
check_must_use
(
cx
,
&
attrs
,
s
.span
)
}
}
_
=>
false
,
_
=>
false
,
};
};
...
...
src/librustc_llvm/build.rs
浏览文件 @
eb447f4e
...
@@ -140,7 +140,7 @@ fn main() {
...
@@ -140,7 +140,7 @@ fn main() {
cfg
.flag
(
flag
);
cfg
.flag
(
flag
);
}
}
for
component
in
&
components
[
..
]
{
for
component
in
&
components
{
let
mut
flag
=
String
::
from
(
"-DLLVM_COMPONENT_"
);
let
mut
flag
=
String
::
from
(
"-DLLVM_COMPONENT_"
);
flag
.push_str
(
&
component
.to_uppercase
());
flag
.push_str
(
&
component
.to_uppercase
());
cfg
.flag
(
&
flag
);
cfg
.flag
(
&
flag
);
...
@@ -173,7 +173,7 @@ fn main() {
...
@@ -173,7 +173,7 @@ fn main() {
if
!
is_crossed
{
if
!
is_crossed
{
cmd
.arg
(
"--system-libs"
);
cmd
.arg
(
"--system-libs"
);
}
}
cmd
.args
(
&
components
[
..
]
);
cmd
.args
(
&
components
);
for
lib
in
output
(
&
mut
cmd
)
.split_whitespace
()
{
for
lib
in
output
(
&
mut
cmd
)
.split_whitespace
()
{
let
name
=
if
lib
.starts_with
(
"-l"
)
{
let
name
=
if
lib
.starts_with
(
"-l"
)
{
...
...
src/librustc_metadata/creader.rs
浏览文件 @
eb447f4e
...
@@ -669,7 +669,7 @@ pub fn find_plugin_registrar(&mut self, span: Span, name: &str)
...
@@ -669,7 +669,7 @@ pub fn find_plugin_registrar(&mut self, span: Span, name: &str)
name
,
name
,
config
::
host_triple
(),
config
::
host_triple
(),
self
.sess.opts.target_triple
);
self
.sess.opts.target_triple
);
span_fatal!
(
self
.sess
,
span
,
E0456
,
"{}"
,
&
message
[
..
]
);
span_fatal!
(
self
.sess
,
span
,
E0456
,
"{}"
,
&
message
);
}
}
let
root
=
ekrate
.metadata
.get_root
();
let
root
=
ekrate
.metadata
.get_root
();
...
...
src/librustc_metadata/encoder.rs
浏览文件 @
eb447f4e
...
@@ -918,14 +918,14 @@ fn encode_addl_info_for_item(&mut self, item: &hir::Item) {
...
@@ -918,14 +918,14 @@ fn encode_addl_info_for_item(&mut self, item: &hir::Item) {
self
.encode_fields
(
def_id
);
self
.encode_fields
(
def_id
);
}
}
hir
::
ItemImpl
(
..
)
=>
{
hir
::
ItemImpl
(
..
)
=>
{
for
&
trait_item_def_id
in
&
self
.tcx
.associated_item_def_ids
(
def_id
)[
..
]
{
for
&
trait_item_def_id
in
self
.tcx
.associated_item_def_ids
(
def_id
)
.iter
()
{
self
.record
(
trait_item_def_id
,
self
.record
(
trait_item_def_id
,
EncodeContext
::
encode_info_for_impl_item
,
EncodeContext
::
encode_info_for_impl_item
,
trait_item_def_id
);
trait_item_def_id
);
}
}
}
}
hir
::
ItemTrait
(
..
)
=>
{
hir
::
ItemTrait
(
..
)
=>
{
for
&
item_def_id
in
&
self
.tcx
.associated_item_def_ids
(
def_id
)[
..
]
{
for
&
item_def_id
in
self
.tcx
.associated_item_def_ids
(
def_id
)
.iter
()
{
self
.record
(
item_def_id
,
self
.record
(
item_def_id
,
EncodeContext
::
encode_info_for_trait_item
,
EncodeContext
::
encode_info_for_trait_item
,
item_def_id
);
item_def_id
);
...
...
src/librustc_metadata/locator.rs
浏览文件 @
eb447f4e
...
@@ -477,15 +477,15 @@ fn find_library_crate(&mut self) -> Option<Library> {
...
@@ -477,15 +477,15 @@ fn find_library_crate(&mut self) -> Option<Library> {
Some
(
file
)
=>
file
,
Some
(
file
)
=>
file
,
};
};
let
(
hash
,
found_kind
)
=
let
(
hash
,
found_kind
)
=
if
file
.starts_with
(
&
rlib_prefix
[
..
]
)
&&
file
.ends_with
(
".rlib"
)
{
if
file
.starts_with
(
&
rlib_prefix
)
&&
file
.ends_with
(
".rlib"
)
{
(
&
file
[(
rlib_prefix
.len
())
..
(
file
.len
()
-
".rlib"
.len
())],
CrateFlavor
::
Rlib
)
(
&
file
[(
rlib_prefix
.len
())
..
(
file
.len
()
-
".rlib"
.len
())],
CrateFlavor
::
Rlib
)
}
else
if
file
.starts_with
(
&
rlib_prefix
[
..
]
)
&&
file
.ends_with
(
".rmeta"
)
{
}
else
if
file
.starts_with
(
&
rlib_prefix
)
&&
file
.ends_with
(
".rmeta"
)
{
(
&
file
[(
rlib_prefix
.len
())
..
(
file
.len
()
-
".rmeta"
.len
())],
CrateFlavor
::
Rmeta
)
(
&
file
[(
rlib_prefix
.len
())
..
(
file
.len
()
-
".rmeta"
.len
())],
CrateFlavor
::
Rmeta
)
}
else
if
file
.starts_with
(
&
dylib_prefix
)
&&
}
else
if
file
.starts_with
(
&
dylib_prefix
)
&&
file
.ends_with
(
&
dypair
.1
)
{
file
.ends_with
(
&
dypair
.1
)
{
(
&
file
[(
dylib_prefix
.len
())
..
(
file
.len
()
-
dypair
.1
.len
())],
CrateFlavor
::
Dylib
)
(
&
file
[(
dylib_prefix
.len
())
..
(
file
.len
()
-
dypair
.1
.len
())],
CrateFlavor
::
Dylib
)
}
else
{
}
else
{
if
file
.starts_with
(
&
staticlib_prefix
[
..
]
)
&&
file
.ends_with
(
&
staticpair
.1
)
{
if
file
.starts_with
(
&
staticlib_prefix
)
&&
file
.ends_with
(
&
staticpair
.1
)
{
staticlibs
.push
(
CrateMismatch
{
staticlibs
.push
(
CrateMismatch
{
path
:
path
.to_path_buf
(),
path
:
path
.to_path_buf
(),
got
:
"static"
.to_string
(),
got
:
"static"
.to_string
(),
...
...
src/librustc_plugin/load.rs
浏览文件 @
eb447f4e
...
@@ -126,19 +126,19 @@ fn dylink_registrar(&mut self,
...
@@ -126,19 +126,19 @@ fn dylink_registrar(&mut self,
// inside this crate, so continue would spew "macro undefined"
// inside this crate, so continue would spew "macro undefined"
// errors
// errors
Err
(
err
)
=>
{
Err
(
err
)
=>
{
self
.sess
.span_fatal
(
span
,
&
err
[
..
]
)
self
.sess
.span_fatal
(
span
,
&
err
)
}
}
};
};
unsafe
{
unsafe
{
let
registrar
=
let
registrar
=
match
lib
.symbol
(
&
symbol
[
..
]
)
{
match
lib
.symbol
(
&
symbol
)
{
Ok
(
registrar
)
=>
{
Ok
(
registrar
)
=>
{
mem
::
transmute
::
<*
mut
u8
,
PluginRegistrarFun
>
(
registrar
)
mem
::
transmute
::
<*
mut
u8
,
PluginRegistrarFun
>
(
registrar
)
}
}
// again fatal if we can't register macros
// again fatal if we can't register macros
Err
(
err
)
=>
{
Err
(
err
)
=>
{
self
.sess
.span_fatal
(
span
,
&
err
[
..
]
)
self
.sess
.span_fatal
(
span
,
&
err
)
}
}
};
};
...
...
src/librustc_save_analysis/csv_dumper.rs
浏览文件 @
eb447f4e
...
@@ -423,7 +423,7 @@ fn make_values_str(pairs: &[(&'static str, &str)]) -> String {
...
@@ -423,7 +423,7 @@ fn make_values_str(pairs: &[(&'static str, &str)]) -> String {
let
strs
=
pairs
.map
(|(
f
,
v
)|
format!
(
",{},
\"
{}
\"
"
,
f
,
escape
(
String
::
from
(
v
))));
let
strs
=
pairs
.map
(|(
f
,
v
)|
format!
(
",{},
\"
{}
\"
"
,
f
,
escape
(
String
::
from
(
v
))));
strs
.fold
(
String
::
new
(),
|
mut
s
,
ss
|
{
strs
.fold
(
String
::
new
(),
|
mut
s
,
ss
|
{
s
.push_str
(
&
ss
[
..
]
);
s
.push_str
(
&
ss
);
s
s
})
})
}
}
...
...
src/librustc_trans/abi.rs
浏览文件 @
eb447f4e
...
@@ -369,7 +369,7 @@ fn unadjusted<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
...
@@ -369,7 +369,7 @@ fn unadjusted<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
match
sig
.inputs
()
.last
()
.unwrap
()
.sty
{
match
sig
.inputs
()
.last
()
.unwrap
()
.sty
{
ty
::
TyTuple
(
ref
tupled_arguments
,
_
)
=>
{
ty
::
TyTuple
(
ref
tupled_arguments
,
_
)
=>
{
inputs
=
&
sig
.inputs
()[
0
..
sig
.inputs
()
.len
()
-
1
];
inputs
=
&
sig
.inputs
()[
0
..
sig
.inputs
()
.len
()
-
1
];
&
tupled_arguments
[
..
]
&
tupled_arguments
}
}
_
=>
{
_
=>
{
bug!
(
"argument to function with
\"
rust-call
\"
ABI
\
bug!
(
"argument to function with
\"
rust-call
\"
ABI
\
...
...
src/librustc_trans/adt.rs
浏览文件 @
eb447f4e
...
@@ -229,11 +229,11 @@ fn generic_type_of<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
...
@@ -229,11 +229,11 @@ fn generic_type_of<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
variant_fill
]
.iter
()
.cloned
()
.collect
();
variant_fill
]
.iter
()
.cloned
()
.collect
();
match
name
{
match
name
{
None
=>
{
None
=>
{
Type
::
struct_
(
cx
,
&
fields
[
..
]
,
false
)
Type
::
struct_
(
cx
,
&
fields
,
false
)
}
}
Some
(
name
)
=>
{
Some
(
name
)
=>
{
let
mut
llty
=
Type
::
named_struct
(
cx
,
name
);
let
mut
llty
=
Type
::
named_struct
(
cx
,
name
);
llty
.set_struct_body
(
&
fields
[
..
]
,
false
);
llty
.set_struct_body
(
&
fields
,
false
);
llty
llty
}
}
}
}
...
@@ -330,7 +330,7 @@ fn struct_wrapped_nullable_bitdiscr(
...
@@ -330,7 +330,7 @@ fn struct_wrapped_nullable_bitdiscr(
alignment
:
Alignment
,
alignment
:
Alignment
,
)
->
ValueRef
{
)
->
ValueRef
{
let
llptrptr
=
bcx
.gepi
(
scrutinee
,
let
llptrptr
=
bcx
.gepi
(
scrutinee
,
&
discrfield
.iter
()
.map
(|
f
|
*
f
as
usize
)
.collect
::
<
Vec
<
_
>>
()
[
..
]
);
&
discrfield
.iter
()
.map
(|
f
|
*
f
as
usize
)
.collect
::
<
Vec
<
_
>>
());
let
llptr
=
bcx
.load
(
llptrptr
,
alignment
.to_align
());
let
llptr
=
bcx
.load
(
llptrptr
,
alignment
.to_align
());
let
cmp
=
if
nndiscr
==
0
{
IntEQ
}
else
{
IntNE
};
let
cmp
=
if
nndiscr
==
0
{
IntEQ
}
else
{
IntNE
};
bcx
.icmp
(
cmp
,
llptr
,
C_null
(
val_ty
(
llptr
)))
bcx
.icmp
(
cmp
,
llptr
,
C_null
(
val_ty
(
llptr
)))
...
@@ -402,7 +402,7 @@ pub fn trans_set_discr<'a, 'tcx>(bcx: &Builder<'a, 'tcx>, t: Ty<'tcx>, val: Valu
...
@@ -402,7 +402,7 @@ pub fn trans_set_discr<'a, 'tcx>(bcx: &Builder<'a, 'tcx>, t: Ty<'tcx>, val: Valu
base
::
call_memset
(
bcx
,
llptr
,
fill_byte
,
size
,
align
,
false
);
base
::
call_memset
(
bcx
,
llptr
,
fill_byte
,
size
,
align
,
false
);
}
else
{
}
else
{
let
path
=
discrfield
.iter
()
.map
(|
&
i
|
i
as
usize
)
.collect
::
<
Vec
<
_
>>
();
let
path
=
discrfield
.iter
()
.map
(|
&
i
|
i
as
usize
)
.collect
::
<
Vec
<
_
>>
();
let
llptrptr
=
bcx
.gepi
(
val
,
&
path
[
..
]
);
let
llptrptr
=
bcx
.gepi
(
val
,
&
path
);
let
llptrty
=
val_ty
(
llptrptr
)
.element_type
();
let
llptrty
=
val_ty
(
llptrptr
)
.element_type
();
bcx
.store
(
C_null
(
llptrty
),
llptrptr
,
None
);
bcx
.store
(
C_null
(
llptrty
),
llptrptr
,
None
);
}
}
...
...
src/librustc_trans/asm.rs
浏览文件 @
eb447f4e
...
@@ -77,14 +77,14 @@ pub fn trans_inline_asm<'a, 'tcx>(
...
@@ -77,14 +77,14 @@ pub fn trans_inline_asm<'a, 'tcx>(
.chain
(
arch_clobbers
.iter
()
.map
(|
s
|
s
.to_string
()))
.chain
(
arch_clobbers
.iter
()
.map
(|
s
|
s
.to_string
()))
.collect
::
<
Vec
<
String
>>
()
.join
(
","
);
.collect
::
<
Vec
<
String
>>
()
.join
(
","
);
debug!
(
"Asm Constraints: {}"
,
&
all_constraints
[
..
]
);
debug!
(
"Asm Constraints: {}"
,
&
all_constraints
);
// Depending on how many outputs we have, the return type is different
// Depending on how many outputs we have, the return type is different
let
num_outputs
=
output_types
.len
();
let
num_outputs
=
output_types
.len
();
let
output_type
=
match
num_outputs
{
let
output_type
=
match
num_outputs
{
0
=>
Type
::
void
(
bcx
.ccx
),
0
=>
Type
::
void
(
bcx
.ccx
),
1
=>
output_types
[
0
],
1
=>
output_types
[
0
],
_
=>
Type
::
struct_
(
bcx
.ccx
,
&
output_types
[
..
]
,
false
)
_
=>
Type
::
struct_
(
bcx
.ccx
,
&
output_types
,
false
)
};
};
let
dialect
=
match
ia
.dialect
{
let
dialect
=
match
ia
.dialect
{
...
...
src/librustc_trans/back/archive.rs
浏览文件 @
eb447f4e
...
@@ -65,10 +65,10 @@ pub fn find_library(name: &str, search_paths: &[PathBuf], sess: &Session)
...
@@ -65,10 +65,10 @@ pub fn find_library(name: &str, search_paths: &[PathBuf], sess: &Session)
for
path
in
search_paths
{
for
path
in
search_paths
{
debug!
(
"looking for {} inside {:?}"
,
name
,
path
);
debug!
(
"looking for {} inside {:?}"
,
name
,
path
);
let
test
=
path
.join
(
&
oslibname
[
..
]
);
let
test
=
path
.join
(
&
oslibname
);
if
test
.exists
()
{
return
test
}
if
test
.exists
()
{
return
test
}
if
oslibname
!=
unixlibname
{
if
oslibname
!=
unixlibname
{
let
test
=
path
.join
(
&
unixlibname
[
..
]
);
let
test
=
path
.join
(
&
unixlibname
);
if
test
.exists
()
{
return
test
}
if
test
.exists
()
{
return
test
}
}
}
}
}
...
...
src/librustc_trans/back/link.rs
浏览文件 @
eb447f4e
...
@@ -91,7 +91,7 @@ pub fn find_crate_name(sess: Option<&Session>,
...
@@ -91,7 +91,7 @@ pub fn find_crate_name(sess: Option<&Session>,
attrs
:
&
[
ast
::
Attribute
],
attrs
:
&
[
ast
::
Attribute
],
input
:
&
Input
)
->
String
{
input
:
&
Input
)
->
String
{
let
validate
=
|
s
:
String
,
span
:
Option
<
Span
>
|
{
let
validate
=
|
s
:
String
,
span
:
Option
<
Span
>
|
{
cstore
::
validate_crate_name
(
sess
,
&
s
[
..
]
,
span
);
cstore
::
validate_crate_name
(
sess
,
&
s
,
span
);
s
s
};
};
...
@@ -109,7 +109,7 @@ pub fn find_crate_name(sess: Option<&Session>,
...
@@ -109,7 +109,7 @@ pub fn find_crate_name(sess: Option<&Session>,
let
msg
=
format!
(
"--crate-name and #[crate_name] are
\
let
msg
=
format!
(
"--crate-name and #[crate_name] are
\
required to match, but `{}` != `{}`"
,
required to match, but `{}` != `{}`"
,
s
,
name
);
s
,
name
);
sess
.span_err
(
attr
.span
,
&
msg
[
..
]
);
sess
.span_err
(
attr
.span
,
&
msg
);
}
}
}
}
return
validate
(
s
.clone
(),
None
);
return
validate
(
s
.clone
(),
None
);
...
@@ -417,7 +417,7 @@ fn object_filenames(trans: &CrateTranslation,
...
@@ -417,7 +417,7 @@ fn object_filenames(trans: &CrateTranslation,
outputs
:
&
OutputFilenames
)
outputs
:
&
OutputFilenames
)
->
Vec
<
PathBuf
>
{
->
Vec
<
PathBuf
>
{
trans
.modules
.iter
()
.map
(|
module
|
{
trans
.modules
.iter
()
.map
(|
module
|
{
outputs
.temp_path
(
OutputType
::
Object
,
Some
(
&
module
.name
[
..
]
))
outputs
.temp_path
(
OutputType
::
Object
,
Some
(
&
module
.name
))
})
.collect
()
})
.collect
()
}
}
...
@@ -551,7 +551,7 @@ fn link_rlib<'a>(sess: &'a Session,
...
@@ -551,7 +551,7 @@ fn link_rlib<'a>(sess: &'a Session,
e
))
e
))
}
}
let
bc_data_deflated
=
flate
::
deflate_bytes
(
&
bc_data
[
..
]
);
let
bc_data_deflated
=
flate
::
deflate_bytes
(
&
bc_data
);
let
mut
bc_file_deflated
=
match
fs
::
File
::
create
(
&
bc_deflated_filename
)
{
let
mut
bc_file_deflated
=
match
fs
::
File
::
create
(
&
bc_deflated_filename
)
{
Ok
(
file
)
=>
file
,
Ok
(
file
)
=>
file
,
...
@@ -819,12 +819,12 @@ fn escape_string(s: &[u8]) -> String {
...
@@ -819,12 +819,12 @@ fn escape_string(s: &[u8]) -> String {
pname
,
pname
,
prog
.status
))
prog
.status
))
.note
(
&
format!
(
"{:?}"
,
&
cmd
))
.note
(
&
format!
(
"{:?}"
,
&
cmd
))
.note
(
&
escape_string
(
&
output
[
..
]
))
.note
(
&
escape_string
(
&
output
))
.emit
();
.emit
();
sess
.abort_if_errors
();
sess
.abort_if_errors
();
}
}
info!
(
"linker stderr:
\n
{}"
,
escape_string
(
&
prog
.stderr
[
..
]
));
info!
(
"linker stderr:
\n
{}"
,
escape_string
(
&
prog
.stderr
));
info!
(
"linker stdout:
\n
{}"
,
escape_string
(
&
prog
.stdout
[
..
]
));
info!
(
"linker stdout:
\n
{}"
,
escape_string
(
&
prog
.stdout
));
},
},
Err
(
e
)
=>
{
Err
(
e
)
=>
{
sess
.struct_err
(
&
format!
(
"could not exec the linker `{}`: {}"
,
pname
,
e
))
sess
.struct_err
(
&
format!
(
"could not exec the linker `{}`: {}"
,
pname
,
e
))
...
...
src/librustc_trans/back/lto.rs
浏览文件 @
eb447f4e
...
@@ -61,7 +61,7 @@ pub fn run(sess: &session::Session,
...
@@ -61,7 +61,7 @@ pub fn run(sess: &session::Session,
}
}
let
export_threshold
=
let
export_threshold
=
symbol_export
::
crates_export_threshold
(
&
sess
.crate_types
.borrow
()
[
..
]
);
symbol_export
::
crates_export_threshold
(
&
sess
.crate_types
.borrow
());
let
symbol_filter
=
&
|
&
(
ref
name
,
level
):
&
(
String
,
_
)|
{
let
symbol_filter
=
&
|
&
(
ref
name
,
level
):
&
(
String
,
_
)|
{
if
symbol_export
::
is_below_threshold
(
level
,
export_threshold
)
{
if
symbol_export
::
is_below_threshold
(
level
,
export_threshold
)
{
...
@@ -147,7 +147,7 @@ pub fn run(sess: &session::Session,
...
@@ -147,7 +147,7 @@ pub fn run(sess: &session::Session,
bc_decoded
.len
()
as
libc
::
size_t
)
{
bc_decoded
.len
()
as
libc
::
size_t
)
{
write
::
llvm_err
(
sess
.diagnostic
(),
write
::
llvm_err
(
sess
.diagnostic
(),
format!
(
"failed to load bc of `{}`"
,
format!
(
"failed to load bc of `{}`"
,
&
name
[
..
]
));
name
));
}
}
});
});
}
}
...
...
src/librustc_trans/back/rpath.rs
浏览文件 @
eb447f4e
...
@@ -37,8 +37,8 @@ pub fn get_rpath_flags(config: &mut RPathConfig) -> Vec<String> {
...
@@ -37,8 +37,8 @@ pub fn get_rpath_flags(config: &mut RPathConfig) -> Vec<String> {
let
libs
=
config
.used_crates
.clone
();
let
libs
=
config
.used_crates
.clone
();
let
libs
=
libs
.into_iter
()
.filter_map
(|(
_
,
l
)|
l
.option
())
.collect
::
<
Vec
<
_
>>
();
let
libs
=
libs
.into_iter
()
.filter_map
(|(
_
,
l
)|
l
.option
())
.collect
::
<
Vec
<
_
>>
();
let
rpaths
=
get_rpaths
(
config
,
&
libs
[
..
]
);
let
rpaths
=
get_rpaths
(
config
,
&
libs
);
flags
.extend_from_slice
(
&
rpaths_to_flags
(
&
rpaths
[
..
]
));
flags
.extend_from_slice
(
&
rpaths_to_flags
(
&
rpaths
));
// Use DT_RUNPATH instead of DT_RPATH if available
// Use DT_RUNPATH instead of DT_RPATH if available
if
config
.linker_is_gnu
{
if
config
.linker_is_gnu
{
...
@@ -84,14 +84,14 @@ fn log_rpaths(desc: &str, rpaths: &[String]) {
...
@@ -84,14 +84,14 @@ fn log_rpaths(desc: &str, rpaths: &[String]) {
}
}
}
}
log_rpaths
(
"relative"
,
&
rel_rpaths
[
..
]
);
log_rpaths
(
"relative"
,
&
rel_rpaths
);
log_rpaths
(
"fallback"
,
&
fallback_rpaths
[
..
]
);
log_rpaths
(
"fallback"
,
&
fallback_rpaths
);
let
mut
rpaths
=
rel_rpaths
;
let
mut
rpaths
=
rel_rpaths
;
rpaths
.extend_from_slice
(
&
fallback_rpaths
[
..
]
);
rpaths
.extend_from_slice
(
&
fallback_rpaths
);
// Remove duplicates
// Remove duplicates
let
rpaths
=
minimize_rpaths
(
&
rpaths
[
..
]
);
let
rpaths
=
minimize_rpaths
(
&
rpaths
);
return
rpaths
;
return
rpaths
;
}
}
...
@@ -177,7 +177,7 @@ fn minimize_rpaths(rpaths: &[String]) -> Vec<String> {
...
@@ -177,7 +177,7 @@ fn minimize_rpaths(rpaths: &[String]) -> Vec<String> {
let
mut
set
=
HashSet
::
new
();
let
mut
set
=
HashSet
::
new
();
let
mut
minimized
=
Vec
::
new
();
let
mut
minimized
=
Vec
::
new
();
for
rpath
in
rpaths
{
for
rpath
in
rpaths
{
if
set
.insert
(
&
rpath
[
..
]
)
{
if
set
.insert
(
rpath
)
{
minimized
.push
(
rpath
.clone
());
minimized
.push
(
rpath
.clone
());
}
}
}
}
...
...
src/librustc_trans/back/symbol_export.rs
浏览文件 @
eb447f4e
...
@@ -154,7 +154,7 @@ pub fn exported_symbols(&self,
...
@@ -154,7 +154,7 @@ pub fn exported_symbols(&self,
cnum
:
CrateNum
)
cnum
:
CrateNum
)
->
&
[(
String
,
SymbolExportLevel
)]
{
->
&
[(
String
,
SymbolExportLevel
)]
{
match
self
.exports
.get
(
&
cnum
)
{
match
self
.exports
.get
(
&
cnum
)
{
Some
(
exports
)
=>
&
exports
[
..
]
,
Some
(
exports
)
=>
exports
,
None
=>
&
[]
None
=>
&
[]
}
}
}
}
...
@@ -167,7 +167,7 @@ pub fn for_each_exported_symbol<F>(&self,
...
@@ -167,7 +167,7 @@ pub fn for_each_exported_symbol<F>(&self,
{
{
for
&
(
ref
name
,
export_level
)
in
self
.exported_symbols
(
cnum
)
{
for
&
(
ref
name
,
export_level
)
in
self
.exported_symbols
(
cnum
)
{
if
is_below_threshold
(
export_level
,
export_threshold
)
{
if
is_below_threshold
(
export_level
,
export_threshold
)
{
f
(
&
name
[
..
]
,
export_level
)
f
(
&
name
,
export_level
)
}
}
}
}
}
}
...
...
src/librustc_trans/back/symbol_names.rs
浏览文件 @
eb447f4e
...
@@ -341,7 +341,7 @@ pub fn sanitize(s: &str) -> String {
...
@@ -341,7 +341,7 @@ pub fn sanitize(s: &str) -> String {
if
!
result
.is_empty
()
&&
if
!
result
.is_empty
()
&&
result
.as_bytes
()[
0
]
!=
'_'
as
u8
&&
result
.as_bytes
()[
0
]
!=
'_'
as
u8
&&
!
(
result
.as_bytes
()[
0
]
as
char
)
.is_xid_start
()
{
!
(
result
.as_bytes
()[
0
]
as
char
)
.is_xid_start
()
{
return
format!
(
"_{}"
,
&
result
[
..
]
);
return
format!
(
"_{}"
,
result
);
}
}
return
result
;
return
result
;
...
...
src/librustc_trans/back/write.rs
浏览文件 @
eb447f4e
...
@@ -105,7 +105,7 @@ fn dump(&mut self, handler: &Handler) {
...
@@ -105,7 +105,7 @@ fn dump(&mut self, handler: &Handler) {
Some
(
ref
code
)
=>
{
Some
(
ref
code
)
=>
{
handler
.emit_with_code
(
&
MultiSpan
::
new
(),
handler
.emit_with_code
(
&
MultiSpan
::
new
(),
&
diag
.msg
,
&
diag
.msg
,
&
code
[
..
]
,
&
code
,
diag
.lvl
);
diag
.lvl
);
},
},
None
=>
{
None
=>
{
...
@@ -189,8 +189,8 @@ pub fn create_target_machine(sess: &Session) -> TargetMachineRef {
...
@@ -189,8 +189,8 @@ pub fn create_target_machine(sess: &Session) -> TargetMachineRef {
let
fdata_sections
=
ffunction_sections
;
let
fdata_sections
=
ffunction_sections
;
let
code_model_arg
=
match
sess
.opts.cg.code_model
{
let
code_model_arg
=
match
sess
.opts.cg.code_model
{
Some
(
ref
s
)
=>
&
s
[
..
]
,
Some
(
ref
s
)
=>
&
s
,
None
=>
&
sess
.target.target.options.code_model
[
..
]
,
None
=>
&
sess
.target.target.options.code_model
,
};
};
let
code_model
=
match
CODE_GEN_MODEL_ARGS
.iter
()
.find
(
let
code_model
=
match
CODE_GEN_MODEL_ARGS
.iter
()
.find
(
...
@@ -397,7 +397,7 @@ struct HandlerFreeVars<'a> {
...
@@ -397,7 +397,7 @@ struct HandlerFreeVars<'a> {
let
msg
=
llvm
::
build_string
(|
s
|
llvm
::
LLVMRustWriteSMDiagnosticToString
(
diag
,
s
))
let
msg
=
llvm
::
build_string
(|
s
|
llvm
::
LLVMRustWriteSMDiagnosticToString
(
diag
,
s
))
.expect
(
"non-UTF8 SMDiagnostic"
);
.expect
(
"non-UTF8 SMDiagnostic"
);
report_inline_asm
(
cgcx
,
&
msg
[
..
]
,
cookie
);
report_inline_asm
(
cgcx
,
&
msg
,
cookie
);
}
}
unsafe
extern
"C"
fn
diagnostic_handler
(
info
:
DiagnosticInfoRef
,
user
:
*
mut
c_void
)
{
unsafe
extern
"C"
fn
diagnostic_handler
(
info
:
DiagnosticInfoRef
,
user
:
*
mut
c_void
)
{
...
@@ -823,7 +823,7 @@ pub fn run_passes(sess: &Session,
...
@@ -823,7 +823,7 @@ pub fn run_passes(sess: &Session,
if
trans
.modules
.len
()
==
1
{
if
trans
.modules
.len
()
==
1
{
// 1) Only one codegen unit. In this case it's no difficulty
// 1) Only one codegen unit. In this case it's no difficulty
// to copy `foo.0.x` to `foo.x`.
// to copy `foo.0.x` to `foo.x`.
let
module_name
=
Some
(
&
(
trans
.modules
[
0
]
.name
)
[
..
]);
let
module_name
=
Some
(
&
trans
.modules
[
0
]
.name
[
..
]);
let
path
=
crate_output
.temp_path
(
output_type
,
module_name
);
let
path
=
crate_output
.temp_path
(
output_type
,
module_name
);
copy_gracefully
(
&
path
,
copy_gracefully
(
&
path
,
&
crate_output
.path
(
output_type
));
&
crate_output
.path
(
output_type
));
...
@@ -939,7 +939,7 @@ pub fn run_passes(sess: &Session,
...
@@ -939,7 +939,7 @@ pub fn run_passes(sess: &Session,
if
metadata_config
.emit_bc
&&
!
user_wants_bitcode
{
if
metadata_config
.emit_bc
&&
!
user_wants_bitcode
{
let
path
=
crate_output
.temp_path
(
OutputType
::
Bitcode
,
let
path
=
crate_output
.temp_path
(
OutputType
::
Bitcode
,
Some
(
&
trans
.metadata_module.name
[
..
]
));
Some
(
&
trans
.metadata_module.name
));
remove
(
sess
,
&
path
);
remove
(
sess
,
&
path
);
}
}
}
}
...
...
src/librustc_trans/base.rs
浏览文件 @
eb447f4e
...
@@ -514,7 +514,7 @@ pub fn call_memcpy<'a, 'tcx>(b: &Builder<'a, 'tcx>,
...
@@ -514,7 +514,7 @@ pub fn call_memcpy<'a, 'tcx>(b: &Builder<'a, 'tcx>,
n_bytes
:
ValueRef
,
n_bytes
:
ValueRef
,
align
:
u32
)
{
align
:
u32
)
{
let
ccx
=
b
.ccx
;
let
ccx
=
b
.ccx
;
let
ptr_width
=
&
ccx
.sess
()
.target.target.target_pointer_width
[
..
]
;
let
ptr_width
=
&
ccx
.sess
()
.target.target.target_pointer_width
;
let
key
=
format!
(
"llvm.memcpy.p0i8.p0i8.i{}"
,
ptr_width
);
let
key
=
format!
(
"llvm.memcpy.p0i8.p0i8.i{}"
,
ptr_width
);
let
memcpy
=
ccx
.get_intrinsic
(
&
key
);
let
memcpy
=
ccx
.get_intrinsic
(
&
key
);
let
src_ptr
=
b
.pointercast
(
src
,
Type
::
i8p
(
ccx
));
let
src_ptr
=
b
.pointercast
(
src
,
Type
::
i8p
(
ccx
));
...
@@ -550,7 +550,7 @@ pub fn call_memset<'a, 'tcx>(b: &Builder<'a, 'tcx>,
...
@@ -550,7 +550,7 @@ pub fn call_memset<'a, 'tcx>(b: &Builder<'a, 'tcx>,
size
:
ValueRef
,
size
:
ValueRef
,
align
:
ValueRef
,
align
:
ValueRef
,
volatile
:
bool
)
->
ValueRef
{
volatile
:
bool
)
->
ValueRef
{
let
ptr_width
=
&
b
.ccx
.sess
()
.target.target.target_pointer_width
[
..
]
;
let
ptr_width
=
&
b
.ccx
.sess
()
.target.target.target_pointer_width
;
let
intrinsic_key
=
format!
(
"llvm.memset.p0i8.i{}"
,
ptr_width
);
let
intrinsic_key
=
format!
(
"llvm.memset.p0i8.i{}"
,
ptr_width
);
let
llintrinsicfn
=
b
.ccx
.get_intrinsic
(
&
intrinsic_key
);
let
llintrinsicfn
=
b
.ccx
.get_intrinsic
(
&
intrinsic_key
);
let
volatile
=
C_bool
(
b
.ccx
,
volatile
);
let
volatile
=
C_bool
(
b
.ccx
,
volatile
);
...
@@ -765,7 +765,7 @@ enum MetadataKind {
...
@@ -765,7 +765,7 @@ enum MetadataKind {
let
mut
compressed
=
cstore
.metadata_encoding_version
()
.to_vec
();
let
mut
compressed
=
cstore
.metadata_encoding_version
()
.to_vec
();
compressed
.extend_from_slice
(
&
flate
::
deflate_bytes
(
&
metadata
));
compressed
.extend_from_slice
(
&
flate
::
deflate_bytes
(
&
metadata
));
let
llmeta
=
C_bytes_in_context
(
cx
.metadata_llcx
(),
&
compressed
[
..
]
);
let
llmeta
=
C_bytes_in_context
(
cx
.metadata_llcx
(),
&
compressed
);
let
llconst
=
C_struct_in_context
(
cx
.metadata_llcx
(),
&
[
llmeta
],
false
);
let
llconst
=
C_struct_in_context
(
cx
.metadata_llcx
(),
&
[
llmeta
],
false
);
let
name
=
cx
.metadata_symbol_name
();
let
name
=
cx
.metadata_symbol_name
();
let
buf
=
CString
::
new
(
name
)
.unwrap
();
let
buf
=
CString
::
new
(
name
)
.unwrap
();
...
@@ -796,7 +796,7 @@ fn internalize_symbols<'a, 'tcx>(sess: &Session,
...
@@ -796,7 +796,7 @@ fn internalize_symbols<'a, 'tcx>(sess: &Session,
symbol_map
:
&
SymbolMap
<
'tcx
>
,
symbol_map
:
&
SymbolMap
<
'tcx
>
,
exported_symbols
:
&
ExportedSymbols
)
{
exported_symbols
:
&
ExportedSymbols
)
{
let
export_threshold
=
let
export_threshold
=
symbol_export
::
crates_export_threshold
(
&
sess
.crate_types
.borrow
()
[
..
]
);
symbol_export
::
crates_export_threshold
(
&
sess
.crate_types
.borrow
());
let
exported_symbols
=
exported_symbols
let
exported_symbols
=
exported_symbols
.exported_symbols
(
LOCAL_CRATE
)
.exported_symbols
(
LOCAL_CRATE
)
...
@@ -1035,7 +1035,7 @@ pub fn find_exported_symbols(tcx: TyCtxt, reachable: NodeSet) -> NodeSet {
...
@@ -1035,7 +1035,7 @@ pub fn find_exported_symbols(tcx: TyCtxt, reachable: NodeSet) -> NodeSet {
(
generics
.parent_types
==
0
&&
generics
.types
.is_empty
())
&&
(
generics
.parent_types
==
0
&&
generics
.types
.is_empty
())
&&
// Functions marked with #[inline] are only ever translated
// Functions marked with #[inline] are only ever translated
// with "internal" linkage and are never exported.
// with "internal" linkage and are never exported.
!
attr
::
requests_inline
(
&
attributes
[
..
]
)
!
attr
::
requests_inline
(
&
attributes
)
}
}
_
=>
false
_
=>
false
...
@@ -1574,7 +1574,7 @@ fn collect_and_partition_translation_items<'a, 'tcx>(scx: &SharedCrateContext<'a
...
@@ -1574,7 +1574,7 @@ fn collect_and_partition_translation_items<'a, 'tcx>(scx: &SharedCrateContext<'a
cgus
.dedup
();
cgus
.dedup
();
for
&
(
ref
cgu_name
,
linkage
)
in
cgus
.iter
()
{
for
&
(
ref
cgu_name
,
linkage
)
in
cgus
.iter
()
{
output
.push_str
(
" "
);
output
.push_str
(
" "
);
output
.push_str
(
&
cgu_name
[
..
]
);
output
.push_str
(
&
cgu_name
);
let
linkage_abbrev
=
match
linkage
{
let
linkage_abbrev
=
match
linkage
{
llvm
::
Linkage
::
ExternalLinkage
=>
"External"
,
llvm
::
Linkage
::
ExternalLinkage
=>
"External"
,
...
...
src/librustc_trans/builder.rs
浏览文件 @
eb447f4e
...
@@ -627,7 +627,7 @@ pub fn gepi(&self, base: ValueRef, ixs: &[usize]) -> ValueRef {
...
@@ -627,7 +627,7 @@ pub fn gepi(&self, base: ValueRef, ixs: &[usize]) -> ValueRef {
}
else
{
}
else
{
let
v
=
ixs
.iter
()
.map
(|
i
|
C_i32
(
self
.ccx
,
*
i
as
i32
))
.collect
::
<
Vec
<
ValueRef
>>
();
let
v
=
ixs
.iter
()
.map
(|
i
|
C_i32
(
self
.ccx
,
*
i
as
i32
))
.collect
::
<
Vec
<
ValueRef
>>
();
self
.count_insn
(
"gepi"
);
self
.count_insn
(
"gepi"
);
self
.inbounds_gep
(
base
,
&
v
[
..
]
)
self
.inbounds_gep
(
base
,
&
v
)
}
}
}
}
...
@@ -835,8 +835,8 @@ pub fn add_span_comment(&self, sp: Span, text: &str) {
...
@@ -835,8 +835,8 @@ pub fn add_span_comment(&self, sp: Span, text: &str) {
let
s
=
format!
(
"{} ({})"
,
let
s
=
format!
(
"{} ({})"
,
text
,
text
,
self
.ccx
.sess
()
.codemap
()
.span_to_string
(
sp
));
self
.ccx
.sess
()
.codemap
()
.span_to_string
(
sp
));
debug!
(
"{}"
,
&
s
[
..
]
);
debug!
(
"{}"
,
s
);
self
.add_comment
(
&
s
[
..
]
);
self
.add_comment
(
&
s
);
}
}
}
}
...
...
src/librustdoc/html/render.rs
浏览文件 @
eb447f4e
...
@@ -2611,7 +2611,7 @@ fn render_attribute(attr: &ast::MetaItem) -> Option<String> {
...
@@ -2611,7 +2611,7 @@ fn render_attribute(attr: &ast::MetaItem) -> Option<String> {
if
attr
.is_word
()
{
if
attr
.is_word
()
{
Some
(
format!
(
"{}"
,
name
))
Some
(
format!
(
"{}"
,
name
))
}
else
if
let
Some
(
v
)
=
attr
.value_str
()
{
}
else
if
let
Some
(
v
)
=
attr
.value_str
()
{
Some
(
format!
(
"{} = {:?}"
,
name
,
&
v
.as_str
()[
..
]
))
Some
(
format!
(
"{} = {:?}"
,
name
,
v
.as_str
()
))
}
else
if
let
Some
(
values
)
=
attr
.meta_item_list
()
{
}
else
if
let
Some
(
values
)
=
attr
.meta_item_list
()
{
let
display
:
Vec
<
_
>
=
values
.iter
()
.filter_map
(|
attr
|
{
let
display
:
Vec
<
_
>
=
values
.iter
()
.filter_map
(|
attr
|
{
attr
.meta_item
()
.and_then
(|
mi
|
render_attribute
(
mi
))
attr
.meta_item
()
.and_then
(|
mi
|
render_attribute
(
mi
))
...
@@ -2642,7 +2642,7 @@ fn render_attributes(w: &mut fmt::Formatter, it: &clean::Item) -> fmt::Result {
...
@@ -2642,7 +2642,7 @@ fn render_attributes(w: &mut fmt::Formatter, it: &clean::Item) -> fmt::Result {
for
attr
in
&
it
.attrs.other_attrs
{
for
attr
in
&
it
.attrs.other_attrs
{
let
name
=
attr
.name
()
.unwrap
();
let
name
=
attr
.name
()
.unwrap
();
if
!
ATTRIBUTE_WHITELIST
.contains
(
&&
name
.as_str
()[
..
]
)
{
if
!
ATTRIBUTE_WHITELIST
.contains
(
&&
*
name
.as_str
()
)
{
continue
;
continue
;
}
}
if
let
Some
(
s
)
=
render_attribute
(
&
attr
.meta
()
.unwrap
())
{
if
let
Some
(
s
)
=
render_attribute
(
&
attr
.meta
()
.unwrap
())
{
...
...
src/libsyntax/ext/tt/macro_rules.rs
浏览文件 @
eb447f4e
...
@@ -119,7 +119,7 @@ fn generic_extension<'cx>(cx: &'cx ExtCtxt,
...
@@ -119,7 +119,7 @@ fn generic_extension<'cx>(cx: &'cx ExtCtxt,
};
};
let
mut
p
=
Parser
::
new
(
cx
.parse_sess
(),
tts
,
Some
(
directory
),
false
);
let
mut
p
=
Parser
::
new
(
cx
.parse_sess
(),
tts
,
Some
(
directory
),
false
);
p
.root_module_name
=
cx
.current_expansion.module.mod_path
.last
()
p
.root_module_name
=
cx
.current_expansion.module.mod_path
.last
()
.map
(|
id
|
(
*
id
.name
.as_str
())
.to_owned
());
.map
(|
id
|
id
.name
.as_str
()
.to_string
());
p
.check_unknown_macro_variable
();
p
.check_unknown_macro_variable
();
// Let the context choose how to interpret the result.
// Let the context choose how to interpret the result.
...
...
src/libsyntax/feature_gate.rs
浏览文件 @
eb447f4e
...
@@ -818,7 +818,7 @@ pub struct GatedCfg {
...
@@ -818,7 +818,7 @@ pub struct GatedCfg {
impl
GatedCfg
{
impl
GatedCfg
{
pub
fn
gate
(
cfg
:
&
ast
::
MetaItem
)
->
Option
<
GatedCfg
>
{
pub
fn
gate
(
cfg
:
&
ast
::
MetaItem
)
->
Option
<
GatedCfg
>
{
let
name
=
&*
cfg
.name
()
.as_str
();
let
name
=
cfg
.name
()
.as_str
();
GATED_CFGS
.iter
()
GATED_CFGS
.iter
()
.position
(|
info
|
info
.0
==
name
)
.position
(|
info
|
info
.0
==
name
)
.map
(|
idx
|
{
.map
(|
idx
|
{
...
@@ -865,8 +865,7 @@ struct Context<'a> {
...
@@ -865,8 +865,7 @@ struct Context<'a> {
impl
<
'a
>
Context
<
'a
>
{
impl
<
'a
>
Context
<
'a
>
{
fn
check_attribute
(
&
self
,
attr
:
&
ast
::
Attribute
,
is_macro
:
bool
)
{
fn
check_attribute
(
&
self
,
attr
:
&
ast
::
Attribute
,
is_macro
:
bool
)
{
debug!
(
"check_attribute(attr = {:?})"
,
attr
);
debug!
(
"check_attribute(attr = {:?})"
,
attr
);
let
name
=
unwrap_or!
(
attr
.name
(),
return
);
let
name
=
unwrap_or!
(
attr
.name
(),
return
)
.as_str
();
for
&
(
n
,
ty
,
ref
gateage
)
in
BUILTIN_ATTRIBUTES
{
for
&
(
n
,
ty
,
ref
gateage
)
in
BUILTIN_ATTRIBUTES
{
if
name
==
n
{
if
name
==
n
{
if
let
&
Gated
(
_
,
ref
name
,
ref
desc
,
ref
has_feature
)
=
gateage
{
if
let
&
Gated
(
_
,
ref
name
,
ref
desc
,
ref
has_feature
)
=
gateage
{
...
@@ -885,12 +884,12 @@ fn check_attribute(&self, attr: &ast::Attribute, is_macro: bool) {
...
@@ -885,12 +884,12 @@ fn check_attribute(&self, attr: &ast::Attribute, is_macro: bool) {
return
;
return
;
}
}
}
}
if
name
.
as_str
()
.
starts_with
(
"rustc_"
)
{
if
name
.starts_with
(
"rustc_"
)
{
gate_feature!
(
self
,
rustc_attrs
,
attr
.span
,
gate_feature!
(
self
,
rustc_attrs
,
attr
.span
,
"unless otherwise specified, attributes
\
"unless otherwise specified, attributes
\
with the prefix `rustc_`
\
with the prefix `rustc_`
\
are reserved for internal compiler diagnostics"
);
are reserved for internal compiler diagnostics"
);
}
else
if
name
.
as_str
()
.
starts_with
(
"derive_"
)
{
}
else
if
name
.starts_with
(
"derive_"
)
{
gate_feature!
(
self
,
custom_derive
,
attr
.span
,
EXPLAIN_DERIVE_UNDERSCORE
);
gate_feature!
(
self
,
custom_derive
,
attr
.span
,
EXPLAIN_DERIVE_UNDERSCORE
);
}
else
if
!
attr
::
is_known
(
attr
)
{
}
else
if
!
attr
::
is_known
(
attr
)
{
// Only run the custom attribute lint during regular
// Only run the custom attribute lint during regular
...
...
src/libsyntax/parse/parser.rs
浏览文件 @
eb447f4e
...
@@ -5151,15 +5151,15 @@ fn parse_item_mod(&mut self, outer_attrs: &[Attribute]) -> PResult<'a, ItemInfo>
...
@@ -5151,15 +5151,15 @@ fn parse_item_mod(&mut self, outer_attrs: &[Attribute]) -> PResult<'a, ItemInfo>
fn
push_directory
(
&
mut
self
,
id
:
Ident
,
attrs
:
&
[
Attribute
])
{
fn
push_directory
(
&
mut
self
,
id
:
Ident
,
attrs
:
&
[
Attribute
])
{
if
let
Some
(
path
)
=
attr
::
first_attr_value_str_by_name
(
attrs
,
"path"
)
{
if
let
Some
(
path
)
=
attr
::
first_attr_value_str_by_name
(
attrs
,
"path"
)
{
self
.directory.path
.push
(
&
*
path
.as_str
());
self
.directory.path
.push
(
&
path
.as_str
());
self
.directory.ownership
=
DirectoryOwnership
::
Owned
;
self
.directory.ownership
=
DirectoryOwnership
::
Owned
;
}
else
{
}
else
{
self
.directory.path
.push
(
&
*
id
.name
.as_str
());
self
.directory.path
.push
(
&
id
.name
.as_str
());
}
}
}
}
pub
fn
submod_path_from_attr
(
attrs
:
&
[
ast
::
Attribute
],
dir_path
:
&
Path
)
->
Option
<
PathBuf
>
{
pub
fn
submod_path_from_attr
(
attrs
:
&
[
ast
::
Attribute
],
dir_path
:
&
Path
)
->
Option
<
PathBuf
>
{
attr
::
first_attr_value_str_by_name
(
attrs
,
"path"
)
.map
(|
d
|
dir_path
.join
(
&
*
d
.as_str
()))
attr
::
first_attr_value_str_by_name
(
attrs
,
"path"
)
.map
(|
d
|
dir_path
.join
(
&
d
.as_str
()))
}
}
/// Returns either a path to a module, or .
/// Returns either a path to a module, or .
...
...
src/libsyntax/test.rs
浏览文件 @
eb447f4e
...
@@ -616,7 +616,7 @@ fn mk_tests(cx: &TestCtxt) -> P<ast::Item> {
...
@@ -616,7 +616,7 @@ fn mk_tests(cx: &TestCtxt) -> P<ast::Item> {
fn
is_test_crate
(
krate
:
&
ast
::
Crate
)
->
bool
{
fn
is_test_crate
(
krate
:
&
ast
::
Crate
)
->
bool
{
match
attr
::
find_crate_name
(
&
krate
.attrs
)
{
match
attr
::
find_crate_name
(
&
krate
.attrs
)
{
Some
(
s
)
if
"test"
==
&*
s
.as_str
()
=>
true
,
Some
(
s
)
if
"test"
==
s
.as_str
()
=>
true
,
_
=>
false
_
=>
false
}
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录