Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
061d8439
R
Rust
项目概览
int
/
Rust
11 个月 前同步成功
通知
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,发现更多精彩内容 >>
提交
061d8439
编写于
3月 07, 2015
作者:
R
Richo Healey
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
remove uses of as_slice where deref coercions can be used
上级
14ce607d
变更
19
隐藏空白更改
内联
并排
Showing
19 changed file
with
39 addition
and
39 deletion
+39
-39
src/librustc/metadata/creader.rs
src/librustc/metadata/creader.rs
+1
-1
src/librustc/middle/check_match.rs
src/librustc/middle/check_match.rs
+1
-1
src/librustc/middle/const_eval.rs
src/librustc/middle/const_eval.rs
+3
-3
src/librustc/middle/ty.rs
src/librustc/middle/ty.rs
+1
-1
src/librustc/util/ppaux.rs
src/librustc/util/ppaux.rs
+1
-1
src/librustc_borrowck/borrowck/mod.rs
src/librustc_borrowck/borrowck/mod.rs
+2
-2
src/librustc_lint/builtin.rs
src/librustc_lint/builtin.rs
+1
-1
src/librustc_typeck/astconv.rs
src/librustc_typeck/astconv.rs
+1
-1
src/librustc_typeck/check/dropck.rs
src/librustc_typeck/check/dropck.rs
+2
-2
src/librustc_typeck/check/mod.rs
src/librustc_typeck/check/mod.rs
+1
-1
src/librustc_typeck/check/regionck.rs
src/librustc_typeck/check/regionck.rs
+3
-3
src/librustc_typeck/check/wf.rs
src/librustc_typeck/check/wf.rs
+3
-3
src/librustc_typeck/collect.rs
src/librustc_typeck/collect.rs
+2
-2
src/libstd/env.rs
src/libstd/env.rs
+3
-3
src/libstd/fs/mod.rs
src/libstd/fs/mod.rs
+3
-3
src/libstd/process.rs
src/libstd/process.rs
+7
-7
src/libstd/thread.rs
src/libstd/thread.rs
+1
-1
src/libsyntax/feature_gate.rs
src/libsyntax/feature_gate.rs
+2
-2
src/test/run-make/unicode-input/span_length.rs
src/test/run-make/unicode-input/span_length.rs
+1
-1
未找到文件。
src/librustc/metadata/creader.rs
浏览文件 @
061d8439
...
...
@@ -493,7 +493,7 @@ fn read_extension_crate(&mut self, span: Span, info: &CrateInfo) -> ExtensionCra
};
let
dylib
=
library
.dylib
.clone
();
let
register
=
should_link
&&
self
.existing_match
(
info
.name
.as_slice
()
,
let
register
=
should_link
&&
self
.existing_match
(
&
info
.name
,
None
,
PathKind
::
Crate
)
.is_none
();
let
metadata
=
if
register
{
...
...
src/librustc/middle/check_match.rs
浏览文件 @
061d8439
...
...
@@ -276,7 +276,7 @@ fn check_for_static_nan(cx: &MatchCheckCtxt, pat: &Pat) {
let
subspan
=
p
.span.lo
<=
err
.span.lo
&&
err
.span.hi
<=
p
.span.hi
;
cx
.tcx.sess
.span_err
(
err
.span
,
&
format!
(
"constant evaluation error: {}"
,
err
.description
()
.as_slice
()
));
err
.description
()));
if
!
subspan
{
cx
.tcx.sess
.span_note
(
p
.span
,
"in pattern here"
)
...
...
src/librustc/middle/const_eval.rs
浏览文件 @
061d8439
...
...
@@ -204,7 +204,7 @@ pub fn const_expr_to_pat(tcx: &ty::ctxt, expr: &Expr, span: Span) -> P<ast::Pat>
pub
fn
eval_const_expr
(
tcx
:
&
ty
::
ctxt
,
e
:
&
Expr
)
->
const_val
{
match
eval_const_expr_partial
(
tcx
,
e
,
None
)
{
Ok
(
r
)
=>
r
,
Err
(
s
)
=>
tcx
.sess
.span_fatal
(
s
.span
,
s
.description
()
.as_slice
())
Err
(
s
)
=>
tcx
.sess
.span_fatal
(
s
.span
,
&
s
.description
())
}
}
...
...
@@ -665,14 +665,14 @@ pub fn compare_lit_exprs<'tcx>(tcx: &ty::ctxt<'tcx>,
let
a
=
match
eval_const_expr_partial
(
tcx
,
a
,
ty_hint
)
{
Ok
(
a
)
=>
a
,
Err
(
e
)
=>
{
tcx
.sess
.span_err
(
a
.span
,
e
.description
()
.as_slice
());
tcx
.sess
.span_err
(
a
.span
,
&
e
.description
());
return
None
;
}
};
let
b
=
match
eval_const_expr_partial
(
tcx
,
b
,
ty_hint
)
{
Ok
(
b
)
=>
b
,
Err
(
e
)
=>
{
tcx
.sess
.span_err
(
b
.span
,
e
.description
()
.as_slice
());
tcx
.sess
.span_err
(
b
.span
,
&
e
.description
());
return
None
;
}
};
...
...
src/librustc/middle/ty.rs
浏览文件 @
061d8439
...
...
@@ -5485,7 +5485,7 @@ pub fn enum_variants<'tcx>(cx: &ctxt<'tcx>, id: ast::DefId)
Err
(
err
)
=>
{
span_err!
(
cx
.sess
,
err
.span
,
E0305
,
"constant evaluation error: {}"
,
err
.description
()
.as_slice
()
);
err
.description
());
}
}
}
else
{
...
...
src/librustc/util/ppaux.rs
浏览文件 @
061d8439
...
...
@@ -115,7 +115,7 @@ pub fn explain_region_and_span(cx: &ctxt, region: ty::Region)
region
::
CodeExtent
::
Misc
(
_
)
=>
tag
,
region
::
CodeExtent
::
DestructionScope
(
_
)
=>
{
new_string
=
format!
(
"destruction scope surrounding {}"
,
tag
);
new_string
.as_slice
()
&*
new_string
}
region
::
CodeExtent
::
Remainder
(
r
)
=>
{
new_string
=
format!
(
"block suffix following statement {}"
,
...
...
src/librustc_borrowck/borrowck/mod.rs
浏览文件 @
061d8439
...
...
@@ -704,9 +704,9 @@ pub fn report_partial_reinitialization_of_uninitialized_structure(
self
.tcx
.sess
.span_err
(
span
,
(
format!
(
"partial reinitialization of uninitialized
\
&
format!
(
"partial reinitialization of uninitialized
\
structure `{}`"
,
self
.loan_path_to_string
(
lp
)))
.as_slice
())
;
self
.loan_path_to_string
(
lp
)));
}
pub
fn
report_reassigned_immutable_variable
(
&
self
,
...
...
src/librustc_lint/builtin.rs
浏览文件 @
061d8439
...
...
@@ -2080,7 +2080,7 @@ fn check_item(&mut self, cx: &Context, it: &ast::Item) {
!
cx
.exported_items
.contains
(
&
it
.id
)
{
let
msg
=
format!
(
"static {} is marked #[no_mangle], but not exported"
,
it
.ident
);
cx
.span_lint
(
PRIVATE_NO_MANGLE_STATICS
,
it
.span
,
msg
.as_slice
()
);
cx
.span_lint
(
PRIVATE_NO_MANGLE_STATICS
,
it
.span
,
&
msg
);
}
},
ast
::
ItemConst
(
..
)
=>
{
...
...
src/librustc_typeck/astconv.rs
浏览文件 @
061d8439
...
...
@@ -1404,7 +1404,7 @@ pub fn ast_ty_to_ty<'tcx>(this: &AstConv<'tcx>,
ast_ty
.span.lo
<=
r
.span.lo
&&
r
.span.hi
<=
ast_ty
.span.hi
;
span_err!
(
tcx
.sess
,
r
.span
,
E0250
,
"array length constant evaluation error: {}"
,
r
.description
()
.as_slice
()
);
r
.description
());
if
!
subspan
{
span_note!
(
tcx
.sess
,
ast_ty
.span
,
"for array length here"
)
}
...
...
src/librustc_typeck/check/dropck.rs
浏览文件 @
061d8439
...
...
@@ -298,8 +298,8 @@ fn iterate_over_potentially_unsafe_regions_in_type<'a, 'tcx>(
match
rcx
.tcx
()
.region_maps
.opt_encl_scope
(
scope
)
{
Some
(
parent_scope
)
=>
ty
::
ReScope
(
parent_scope
),
None
=>
rcx
.tcx
()
.sess
.span_bug
(
span
,
format!
(
"no enclosing scope found for scope: {:?}"
,
scope
)
.as_slice
(
)),
span
,
&
format!
(
"no enclosing scope found for scope: {:?}"
,
scope
)),
};
regionck
::
type_must_outlive
(
rcx
,
origin
(),
typ
,
parent_region
);
...
...
src/librustc_typeck/check/mod.rs
浏览文件 @
061d8439
...
...
@@ -4620,7 +4620,7 @@ fn do_check<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
Err
(
ref
err
)
=>
{
span_err!
(
ccx
.tcx.sess
,
err
.span
,
E0080
,
"constant evaluation error: {}"
,
err
.description
()
.as_slice
()
);
err
.description
());
}
}
},
...
...
src/librustc_typeck/check/regionck.rs
浏览文件 @
061d8439
...
...
@@ -963,9 +963,9 @@ fn check_safety_of_rvalue_destructor_if_necessary<'a, 'tcx>(rcx: &mut Rcx<'a, 't
rcx
.tcx
()
.sess
.span_bug
(
span
,
format!
(
"unexpected rvalue region in rvalue
\
destructor safety checking: `{}`"
,
region
.repr
(
rcx
.tcx
()))
.as_slice
(
));
&
format!
(
"unexpected rvalue region in rvalue
\
destructor safety checking: `{}`"
,
region
.repr
(
rcx
.tcx
())
));
}
}
}
...
...
src/librustc_typeck/check/wf.rs
浏览文件 @
061d8439
...
...
@@ -411,9 +411,9 @@ fn report_bivariance(&self,
Some
(
def_id
)
=>
{
self
.tcx
()
.sess
.fileline_help
(
span
,
format!
(
"consider removing `{}` or using a marker such as `{}`"
,
param_name
.user_string
(
self
.tcx
()),
ty
::
item_path_str
(
self
.tcx
(),
def_id
))
.as_slice
(
));
&
format!
(
"consider removing `{}` or using a marker such as `{}`"
,
param_name
.user_string
(
self
.tcx
()),
ty
::
item_path_str
(
self
.tcx
(),
def_id
)
));
}
None
=>
{
// no lang items, no help!
...
...
src/librustc_typeck/collect.rs
浏览文件 @
061d8439
...
...
@@ -1590,8 +1590,8 @@ fn compute_type_scheme_of_item<'a,'tcx>(ccx: &CrateCtxt<'a,'tcx>,
ast
::
ItemMac
(
..
)
=>
{
tcx
.sess
.span_bug
(
it
.span
,
format!
(
"compute_type_scheme_of_item: unexpected item type: {:?}"
,
it
.node
)
.as_slice
(
));
&
format!
(
"compute_type_scheme_of_item: unexpected item type: {:?}"
,
it
.node
));
}
}
}
...
...
src/libstd/env.rs
浏览文件 @
061d8439
...
...
@@ -780,8 +780,8 @@ fn test_var_big() {
i
+=
1
;
}
let
n
=
make_rand_name
();
set_var
(
&
n
,
s
.as_slice
()
);
eq
(
var_os
(
&
n
),
Some
(
s
.as_slice
()
));
set_var
(
&
n
,
&
s
);
eq
(
var_os
(
&
n
),
Some
(
&
s
));
}
#[test]
...
...
@@ -799,7 +799,7 @@ fn test_env_set_get_huge() {
let
n
=
make_rand_name
();
let
s
=
repeat
(
"x"
)
.take
(
10000
)
.collect
::
<
String
>
();
set_var
(
&
n
,
&
s
);
eq
(
var_os
(
&
n
),
Some
(
s
.as_slice
()
));
eq
(
var_os
(
&
n
),
Some
(
&
s
));
remove_var
(
&
n
);
eq
(
var_os
(
&
n
),
None
);
}
...
...
src/libstd/fs/mod.rs
浏览文件 @
061d8439
...
...
@@ -828,7 +828,7 @@ mod tests {
macro_rules!
error
{
(
$e:expr
,
$s:expr
)
=>
(
match
$e
{
Ok
(
_
)
=>
panic!
(
"Unexpected success. Should've been: {:?}"
,
$s
),
Err
(
ref
err
)
=>
assert!
(
err
.to_string
()
.contains
(
$s
.as_slice
()
),
Err
(
ref
err
)
=>
assert!
(
err
.to_string
()
.contains
(
$s
),
format!
(
"`{}` did not contain `{}`"
,
err
,
$s
))
}
)
}
...
...
@@ -880,7 +880,7 @@ fn file_test_io_smoke_test() {
-
1
|
0
=>
panic!
(
"shouldn't happen"
),
n
=>
str
::
from_utf8
(
&
read_buf
[
..
n
])
.unwrap
()
.to_string
()
};
assert_eq!
(
read_str
.as_slice
()
,
message
);
assert_eq!
(
read_str
,
message
);
}
check!
(
fs
::
remove_file
(
filename
));
}
...
...
@@ -1107,7 +1107,7 @@ fn file_test_directoryinfo_readdir() {
check!
(
check!
(
File
::
open
(
&
f
))
.read
(
&
mut
mem
));
let
read_str
=
str
::
from_utf8
(
&
mem
)
.unwrap
();
let
expected
=
format!
(
"{}{}"
,
prefix
,
n
.to_str
()
.unwrap
());
assert_eq!
(
expected
.as_slice
()
,
read_str
);
assert_eq!
(
expected
,
read_str
);
}
check!
(
fs
::
remove_file
(
&
f
));
}
...
...
src/libstd/process.rs
浏览文件 @
061d8439
...
...
@@ -812,7 +812,7 @@ fn test_inherit_env() {
for
(
ref
k
,
ref
v
)
in
env
::
vars
()
{
// don't check windows magical empty-named variables
assert
!
(
k
.is_empty
()
||
output
.contains
(
format!
(
"{}={}"
,
*
k
,
*
v
)
.as_slice
(
)),
output
.contains
(
&
format!
(
"{}={}"
,
*
k
,
*
v
)),
"output doesn't contain `{}={}`
\n
{}"
,
k
,
v
,
output
);
}
...
...
@@ -830,12 +830,12 @@ fn test_inherit_env() {
for
&
(
ref
k
,
ref
v
)
in
&
r
{
// don't check android RANDOM variables
if
*
k
!=
"RANDOM"
.to_string
()
{
assert
!
(
output
.contains
(
format!
(
"{}={}"
,
*
k
,
*
v
)
.as_slice
(
))
||
output
.contains
(
format!
(
"{}=
\'
{}
\'
"
,
*
k
,
*
v
)
.as_slice
(
)));
assert
!
(
output
.contains
(
&
format!
(
"{}={}"
,
*
k
,
*
v
))
||
output
.contains
(
&
format!
(
"{}=
\'
{}
\'
"
,
*
k
,
*
v
)));
}
}
}
...
...
src/libstd/thread.rs
浏览文件 @
061d8439
...
...
@@ -284,7 +284,7 @@ fn spawn_inner<T: Send>(self, f: Thunk<(), T>) -> io::Result<JoinInner<T>> {
stack
::
record_os_managed_stack_bounds
(
my_stack_bottom
,
my_stack_top
);
}
match
their_thread
.name
()
{
Some
(
name
)
=>
unsafe
{
imp
::
set_name
(
name
.as_slice
()
);
},
Some
(
name
)
=>
unsafe
{
imp
::
set_name
(
name
);
},
None
=>
{}
}
thread_info
::
set
(
...
...
src/libsyntax/feature_gate.rs
浏览文件 @
061d8439
...
...
@@ -403,11 +403,11 @@ fn check_attribute(&self, attr: &ast::Attribute) {
for the compiler"
);
}
else
{
self
.gate_feature
(
"custom_attribute"
,
attr
.span
,
format!
(
"The attribute `{}` is currently
\
&
format!
(
"The attribute `{}` is currently
\
unknown to the the compiler and
\
may have meaning
\
added to it in the future"
,
name
)
.as_slice
()
);
name
));
}
}
}
...
...
src/test/run-make/unicode-input/span_length.rs
浏览文件 @
061d8439
...
...
@@ -80,7 +80,7 @@ fn main() {
.arg
(
format!
(
"{} {}"
,
rustc
,
main_file
.as_str
()
.unwrap
())
.as_slice
()
)
.unwrap
()))
.output
()
.unwrap
();
let
err
=
String
::
from_utf8_lossy
(
result
.error
.as_slice
());
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录