Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
04de8f85
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,发现更多精彩内容 >>
提交
04de8f85
编写于
5月 09, 2013
作者:
M
Marvin Löbel
提交者:
Björn Steinbrink
5月 14, 2013
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix cosmetics for fail!() calls
上级
bdc182cc
变更
21
隐藏空白更改
内联
并排
Showing
21 changed file
with
47 addition
and
63 deletion
+47
-63
src/libcore/local_data.rs
src/libcore/local_data.rs
+2
-2
src/libcore/num/strconv.rs
src/libcore/num/strconv.rs
+7
-9
src/libcore/os.rs
src/libcore/os.rs
+2
-4
src/libcore/run.rs
src/libcore/run.rs
+1
-2
src/libcore/str.rs
src/libcore/str.rs
+1
-1
src/librustc/driver/driver.rs
src/librustc/driver/driver.rs
+2
-4
src/librustc/metadata/tydecode.rs
src/librustc/metadata/tydecode.rs
+4
-4
src/librustc/middle/kind.rs
src/librustc/middle/kind.rs
+4
-4
src/librustc/middle/typeck/infer/test.rs
src/librustc/middle/typeck/infer/test.rs
+4
-4
src/librustdoc/attr_pass.rs
src/librustdoc/attr_pass.rs
+2
-3
src/librustpkg/rustpkg.rc
src/librustpkg/rustpkg.rc
+1
-2
src/librustpkg/workspace.rs
src/librustpkg/workspace.rs
+3
-4
src/libstd/ebml.rs
src/libstd/ebml.rs
+4
-7
src/libstd/net_tcp.rs
src/libstd/net_tcp.rs
+2
-2
src/libstd/sync.rs
src/libstd/sync.rs
+2
-4
src/libsyntax/codemap.rs
src/libsyntax/codemap.rs
+1
-2
src/libsyntax/ext/expand.rs
src/libsyntax/ext/expand.rs
+1
-1
src/libsyntax/print/pprust.rs
src/libsyntax/print/pprust.rs
+1
-1
src/test/run-fail/assert-eq-macro-fail.rs
src/test/run-fail/assert-eq-macro-fail.rs
+1
-1
src/test/run-fail/while-fail.rs
src/test/run-fail/while-fail.rs
+1
-1
src/test/run-pass/nullable-pointer-iotareduction.rs
src/test/run-pass/nullable-pointer-iotareduction.rs
+1
-1
未找到文件。
src/libcore/local_data.rs
浏览文件 @
04de8f85
...
...
@@ -133,13 +133,13 @@ fn my_key(_x: @~str) { }
local_data_modify
(
my_key
,
|
data
|
{
match
data
{
Some
(
@
ref
val
)
=>
fail
!
(
"unwelcome value: %s"
,
*
val
),
None
=>
Some
(
@~
"first data"
)
None
=>
Some
(
@~
"first data"
)
}
});
local_data_modify
(
my_key
,
|
data
|
{
match
data
{
Some
(
@~
"first data"
)
=>
Some
(
@~
"next data"
),
Some
(
@
ref
val
)
=>
fail
!
(
"wrong value: %s"
,
*
val
),
Some
(
@
ref
val
)
=>
fail
!
(
"wrong value: %s"
,
*
val
),
None
=>
fail
!
(
"missing value"
)
}
});
...
...
src/libcore/num/strconv.rs
浏览文件 @
04de8f85
...
...
@@ -178,11 +178,9 @@ pub fn to_str_bytes_common<T:NumCast+Zero+One+Eq+Ord+NumStrConv+Copy+
num
:
&
T
,
radix
:
uint
,
negative_zero
:
bool
,
sign
:
SignFormat
,
digits
:
SignificantDigits
)
->
(
~
[
u8
],
bool
)
{
if
(
radix
as
int
)
<
2
{
fail
!
(
"to_str_bytes_common: radix %? to low,
\
must lie in the range [2, 36]"
,
radix
);
fail
!
(
"to_str_bytes_common: radix %? to low, must lie in the range [2, 36]"
,
radix
);
}
else
if
radix
as
int
>
36
{
fail
!
(
"to_str_bytes_common: radix %? to high,
\
must lie in the range [2, 36]"
,
radix
);
fail
!
(
"to_str_bytes_common: radix %? to high, must lie in the range [2, 36]"
,
radix
);
}
let
_0
:
T
=
Zero
::
zero
();
...
...
@@ -445,19 +443,19 @@ pub fn from_str_bytes_common<T:NumCast+Zero+One+Eq+Ord+Copy+Div<T,T>+
match
exponent
{
ExpDec
if
radix
>=
DIGIT_E_RADIX
// decimal exponent 'e'
=>
fail
!
(
"from_str_bytes_common: radix %? incompatible with
\
use of 'e' as decimal exponent"
,
radix
),
use of 'e' as decimal exponent"
,
radix
),
ExpBin
if
radix
>=
DIGIT_P_RADIX
// binary exponent 'p'
=>
fail
!
(
"from_str_bytes_common: radix %? incompatible with
\
use of 'p' as binary exponent"
,
radix
),
use of 'p' as binary exponent"
,
radix
),
_
if
special
&&
radix
>=
DIGIT_I_RADIX
// first digit of 'inf'
=>
fail
!
(
"from_str_bytes_common: radix %? incompatible with
\
special values 'inf' and 'NaN'"
,
radix
),
special values 'inf' and 'NaN'"
,
radix
),
_
if
(
radix
as
int
)
<
2
=>
fail
!
(
"from_str_bytes_common: radix %? to low,
\
must lie in the range [2, 36]"
,
radix
),
must lie in the range [2, 36]"
,
radix
),
_
if
(
radix
as
int
)
>
36
=>
fail
!
(
"from_str_bytes_common: radix %? to high,
\
must lie in the range [2, 36]"
,
radix
),
must lie in the range [2, 36]"
,
radix
),
_
=>
()
}
...
...
src/libcore/os.rs
浏览文件 @
04de8f85
...
...
@@ -178,8 +178,7 @@ unsafe fn get_env_pairs() -> ~[~str] {
};
let
ch
=
GetEnvironmentStringsA
();
if
(
ch
as
uint
==
0
)
{
fail
!
(
"os::env() failure getting env string from OS: %s"
,
os
::
last_os_error
());
fail
!
(
"os::env() failure getting env string from OS: %s"
,
os
::
last_os_error
());
}
let
mut
curr_ptr
:
uint
=
ch
as
uint
;
let
mut
result
=
~
[];
...
...
@@ -201,8 +200,7 @@ unsafe fn get_env_pairs() -> ~[~str] {
}
let
environ
=
rust_env_pairs
();
if
(
environ
as
uint
==
0
)
{
fail
!
(
"os::env() failure getting env string from OS: %s"
,
os
::
last_os_error
());
fail
!
(
"os::env() failure getting env string from OS: %s"
,
os
::
last_os_error
());
}
let
mut
result
=
~
[];
ptr
::
array_each
(
environ
,
|
e
|
{
...
...
src/libcore/run.rs
浏览文件 @
04de8f85
...
...
@@ -646,8 +646,7 @@ pub fn program_output(prog: &str, args: &[~str]) -> ProgramOutput {
errs
=
s
;
}
(
n
,
_
)
=>
{
fail
!
(
"program_output received an unexpected file
\
number: %u"
,
n
);
fail
!
(
"program_output received an unexpected file number: %u"
,
n
);
}
};
count
-=
1
;
...
...
src/libcore/str.rs
浏览文件 @
04de8f85
...
...
@@ -1052,7 +1052,7 @@ enum LengthLimit {
(
B
,
Cr
,
UnderLim
)
=>
{
B
}
(
B
,
Cr
,
OverLim
)
if
(
i
-
last_start
+
1
)
>
lim
=>
fail
!
(
"word starting with %? longer than limit!"
,
self
::
slice
(
ss
,
last_start
,
i
+
1
)),
self
::
slice
(
ss
,
last_start
,
i
+
1
)),
(
B
,
Cr
,
OverLim
)
=>
{
slice
();
slice_start
=
last_start
;
B
}
(
B
,
Ws
,
UnderLim
)
=>
{
last_end
=
i
;
C
}
(
B
,
Ws
,
OverLim
)
=>
{
last_end
=
i
;
slice
();
A
}
...
...
src/librustc/driver/driver.rs
浏览文件 @
04de8f85
...
...
@@ -917,8 +917,7 @@ fn test_switch_implies_cfg_test() {
let
matches
=
&
match
getopts
(
~
[
~
"--test"
],
optgroups
())
{
Ok
(
copy
m
)
=>
m
,
Err
(
copy
f
)
=>
fail
!
(
"test_switch_implies_cfg_test: %s"
,
getopts
::
fail_str
(
f
))
Err
(
copy
f
)
=>
fail
!
(
"test_switch_implies_cfg_test: %s"
,
getopts
::
fail_str
(
f
))
};
let
sessopts
=
build_session_options
(
@~
"rustc"
,
matches
,
diagnostic
::
emit
);
...
...
@@ -935,8 +934,7 @@ fn test_switch_implies_cfg_test_unless_cfg_test() {
&
match
getopts
(
~
[
~
"--test"
,
~
"--cfg=test"
],
optgroups
())
{
Ok
(
copy
m
)
=>
m
,
Err
(
copy
f
)
=>
{
fail
!
(
"test_switch_implies_cfg_test_unless_cfg_test: %s"
,
getopts
::
fail_str
(
f
));
fail
!
(
"test_switch_implies_cfg_test_unless_cfg_test: %s"
,
getopts
::
fail_str
(
f
));
}
};
let
sessopts
=
build_session_options
(
...
...
src/librustc/metadata/tydecode.rs
浏览文件 @
04de8f85
...
...
@@ -531,13 +531,13 @@ pub fn parse_def_id(buf: &[u8]) -> ast::def_id {
let
crate_num
=
match
uint
::
parse_bytes
(
crate_part
,
10u
)
{
Some
(
cn
)
=>
cn
as
int
,
None
=>
fail
!
(
"internal error: parse_def_id: crate number
\
expected, but found %?"
,
crate_part
)
None
=>
fail
!
(
"internal error: parse_def_id: crate number
expected, but found %?"
,
crate_part
)
};
let
def_num
=
match
uint
::
parse_bytes
(
def_part
,
10u
)
{
Some
(
dn
)
=>
dn
as
int
,
None
=>
fail
!
(
"internal error: parse_def_id: id expected, but
\
found %?"
,
def_part
)
None
=>
fail
!
(
"internal error: parse_def_id: id expected, but
found %?"
,
def_part
)
};
ast
::
def_id
{
crate
:
crate_num
,
node
:
def_num
}
}
...
...
src/librustc/middle/kind.rs
浏览文件 @
04de8f85
...
...
@@ -276,10 +276,10 @@ pub fn check_expr(e: @expr, cx: Context, v: visit::vt<Context>) {
if
ts
.len
()
!=
type_param_defs
.len
()
{
// Fail earlier to make debugging easier
fail
!
(
"internal error: in kind::check_expr, length
\
mismatch between actual and declared bounds: actual =
\
%s, declared = %s"
,
ts
.repr
(
cx
.tcx
),
type_param_defs
.repr
(
cx
.tcx
));
mismatch between actual and declared bounds: actual =
\
%s, declared = %s"
,
ts
.repr
(
cx
.tcx
),
type_param_defs
.repr
(
cx
.tcx
));
}
for
vec
::
each2
(
**
ts
,
*
type_param_defs
)
|
&
ty
,
type_param_def
|
{
check_bounds
(
cx
,
type_parameter_id
,
e
.span
,
ty
,
type_param_def
)
...
...
src/librustc/middle/typeck/infer/test.rs
浏览文件 @
04de8f85
...
...
@@ -154,16 +154,16 @@ fn is_subtype(&self, a: ty::t, b: ty::t) -> bool {
fn
assert_subtype
(
&
self
,
a
:
ty
::
t
,
b
:
ty
::
t
)
{
if
!
self
.is_subtype
(
a
,
b
)
{
fail
!
(
"%s is not a subtype of %s, but it should be"
,
self
.ty_to_str
(
a
),
self
.ty_to_str
(
b
));
self
.ty_to_str
(
a
),
self
.ty_to_str
(
b
));
}
}
fn
assert_not_subtype
(
&
self
,
a
:
ty
::
t
,
b
:
ty
::
t
)
{
if
self
.is_subtype
(
a
,
b
)
{
fail
!
(
"%s is a subtype of %s, but it shouldn't be"
,
self
.ty_to_str
(
a
),
self
.ty_to_str
(
b
));
self
.ty_to_str
(
a
),
self
.ty_to_str
(
b
));
}
}
...
...
src/librustdoc/attr_pass.rs
浏览文件 @
04de8f85
...
...
@@ -140,9 +140,8 @@ fn fold_enum(
copy
ast_variant
.node.attrs
)
}
_
=>
{
fail
!
(
"Enum variant %s has id that's
\
not bound to an enum item"
,
variant
.name
)
fail
!
(
"Enum variant %s has id that's not bound to an enum item"
,
variant
.name
)
}
}
}
...
...
src/librustpkg/rustpkg.rc
浏览文件 @
04de8f85
...
...
@@ -146,8 +146,7 @@ impl PkgScript {
}
}
Err(e) => {
fail!("Running package script, couldn't find rustpkg sysroot (%s)",
e)
fail!("Running package script, couldn't find rustpkg sysroot (%s)", e)
}
}
}
...
...
src/librustpkg/workspace.rs
浏览文件 @
04de8f85
...
...
@@ -21,10 +21,9 @@ pub fn pkg_parent_workspaces(pkgid: PkgId, action: &fn(&Path) -> bool) -> bool {
workspace_contains_package_id
(
pkgid
,
ws
));
if
workspaces
.is_empty
()
{
// tjc: make this a condition
fail
!
(
"Package %s not found in any of
\
the following workspaces: %s"
,
pkgid
.path
.to_str
(),
rust_path
()
.to_str
());
fail
!
(
"Package %s not found in any of the following workspaces: %s"
,
pkgid
.path
.to_str
(),
rust_path
()
.to_str
());
}
for
workspaces
.each
|
ws
|
{
if
action
(
ws
)
{
...
...
src/libstd/ebml.rs
浏览文件 @
04de8f85
...
...
@@ -319,9 +319,7 @@ fn _check_label(&mut self, lbl: &str) {
self
.pos
=
r_doc
.end
;
let
str
=
doc_as_str
(
r_doc
);
if
lbl
!=
str
{
fail
!
(
"Expected label %s but found %s"
,
lbl
,
str
);
fail
!
(
"Expected label %s but found %s"
,
lbl
,
str
);
}
}
}
...
...
@@ -338,12 +336,11 @@ fn next_doc(&mut self, exp_tag: EbmlEncoderTag) -> Doc {
copy
self
.parent.start
,
copy
self
.parent.end
,
copy
self
.pos
,
r_tag
,
r_doc
.start
,
r_doc
.end
);
if
r_tag
!=
(
exp_tag
as
uint
)
{
fail
!
(
"expected EBML doc with tag %? but found tag %?"
,
exp_tag
,
r_tag
);
fail
!
(
"expected EBML doc with tag %? but found tag %?"
,
exp_tag
,
r_tag
);
}
if
r_doc
.end
>
self
.parent.end
{
fail
!
(
"invalid EBML, child extends to 0x%x,
\
parent to 0x%x"
,
r_doc
.end
,
self
.parent.end
);
fail
!
(
"invalid EBML, child extends to 0x%x,
parent to 0x%x"
,
r_doc
.end
,
self
.parent.end
);
}
self
.pos
=
r_doc
.end
;
r_doc
...
...
src/libstd/net_tcp.rs
浏览文件 @
04de8f85
...
...
@@ -1687,7 +1687,7 @@ pub fn impl_gl_tcp_ipv4_server_address_in_use() {
assert
!
(
true
);
}
_
=>
{
fail
!
(
"expected address_in_use listen error,
\
fail
!
(
"expected address_in_use listen error,
\
but got a different error varient. check logs."
);
}
}
...
...
@@ -1706,7 +1706,7 @@ pub fn impl_gl_tcp_ipv4_server_access_denied() {
assert
!
(
true
);
}
_
=>
{
fail
!
(
"expected address_in_use listen error,
\
fail
!
(
"expected address_in_use listen error,
\
but got a different error varient. check logs."
);
}
}
...
...
src/libstd/sync.rs
浏览文件 @
04de8f85
...
...
@@ -329,11 +329,9 @@ fn check_cvar_bounds<U>(out_of_bounds: Option<uint>, id: uint, act: &str,
blk
:
&
fn
()
->
U
)
->
U
{
match
out_of_bounds
{
Some
(
0
)
=>
fail
!
(
"%s with illegal ID %u - this lock has no condvars!"
,
act
,
id
),
fail
!
(
"%s with illegal ID %u - this lock has no condvars!"
,
act
,
id
),
Some
(
length
)
=>
fail
!
(
"%s with illegal ID %u - ID must be less than %u"
,
act
,
id
,
length
),
fail
!
(
"%s with illegal ID %u - ID must be less than %u"
,
act
,
id
,
length
),
None
=>
blk
()
}
}
...
...
src/libsyntax/codemap.rs
浏览文件 @
04de8f85
...
...
@@ -430,8 +430,7 @@ fn lookup_filemap_idx(&self, pos: BytePos) -> uint {
}
}
if
(
a
>=
len
)
{
fail
!
(
"position %u does not resolve to a source location"
,
pos
.to_uint
())
fail
!
(
"position %u does not resolve to a source location"
,
pos
.to_uint
())
}
return
a
;
...
...
src/libsyntax/ext/expand.rs
浏览文件 @
04de8f85
...
...
@@ -468,7 +468,7 @@ pub fn core_macros() -> ~str {
let expected_val = $expected;
// check both directions of equality....
if !((given_val == expected_val) && (expected_val == given_val)) {
fail!(
\"
left: %?
!=
right: %?
\"
, given_val, expected_val);
fail!(
\"
left: %?
does not equal
right: %?
\"
, given_val, expected_val);
}
}
)
...
...
src/libsyntax/print/pprust.rs
浏览文件 @
04de8f85
...
...
@@ -2237,7 +2237,7 @@ mod test {
fn
string_check
<
T
:
Eq
>
(
given
:
&
T
,
expected
:
&
T
)
{
if
!
(
given
==
expected
)
{
fail
!
(
"given %?, expected %?"
,
given
,
expected
);
fail
!
(
"given %?, expected %?"
,
given
,
expected
);
}
}
...
...
src/test/run-fail/assert-eq-macro-fail.rs
浏览文件 @
04de8f85
// error-pattern:left: 14
!=
right: 15
// error-pattern:left: 14
does not equal
right: 15
#[deriving(Eq)]
struct
Point
{
x
:
int
}
...
...
src/test/run-fail/while-fail.rs
浏览文件 @
04de8f85
...
...
@@ -10,5 +10,5 @@
// error-pattern:giraffe
fn
main
()
{
fail
!
({
while
true
{
fail
!
(
~
"giraffe"
)
};
"clandestine"
});
fail
!
({
while
true
{
fail
!
(
"giraffe"
)
};
"clandestine"
});
}
src/test/run-pass/nullable-pointer-iotareduction.rs
浏览文件 @
04de8f85
...
...
@@ -58,7 +58,7 @@ fn get_ref<'r>(&'r self) -> (int, &'r T) {
match
t_
.get_ref
()
{
(
23
,
$v
)
=>
{
$chk
}
_
=>
fail!
(
"Thing::<%s>(23, %s).get_ref() != (23, _)"
,
stringify!
(
$T
),
stringify!
(
$e
))
stringify!
(
$T
),
stringify!
(
$e
))
}
}}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录