Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
68f5c847
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,发现更多精彩内容 >>
提交
68f5c847
编写于
5月 05, 2015
作者:
M
Michael Sproul
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Markdown edits for diagnostic errors.
上级
31e3cb7c
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
26 addition
and
22 deletion
+26
-22
src/librustc/diagnostics.rs
src/librustc/diagnostics.rs
+26
-22
未找到文件。
src/librustc/diagnostics.rs
浏览文件 @
68f5c847
...
...
@@ -37,7 +37,7 @@
E0003
:
r##"
Not-a-Number (NaN) values cannot be compared for equality and hence can never
match the input to a match expression. To match against NaN values, you should
instead use the `is_nan` method in a guard, as in:
x if x.is_nan() => ...
instead use the `is_nan` method in a guard, as in:
`x if x.is_nan() => ...`
"##
,
E0004
:
r##"
...
...
@@ -71,7 +71,7 @@
E0007
:
r##"
This error indicates that the bindings in a match arm would require a value to
be moved into more than one location, thus violating unique ownership. Code like
the following is invalid as it requires the entire
Option<String>
to be moved
the following is invalid as it requires the entire
`Option<String>`
to be moved
into a variable called `op_string` while simultaneously requiring the inner
String to be moved into a variable called `s`.
...
...
@@ -99,10 +99,10 @@
}
```
The variable `s` has type
String
, and its use in the guard is as a variable of
type
String. The guard code effectively executes in a separate scope to the body
of the arm, so the value would be moved into this anonymous scope and therefore
become unavailable in the body of the arm. Although this example seems
The variable `s` has type
`String`
, and its use in the guard is as a variable of
type
`String`. The guard code effectively executes in a separate scope to the
body of the arm, so the value would be moved into this anonymous scope and
therefore
become unavailable in the body of the arm. Although this example seems
innocuous, the problem is most clear when considering functions that take their
argument by value.
...
...
@@ -140,7 +140,8 @@ struct X { x: (), }
```
You have two solutions:
1. Bind the pattern's values the same way:
Solution #1: Bind the pattern's values the same way.
```
struct X { x: (), }
...
...
@@ -153,8 +154,9 @@ struct X { x: (), }
}
```
2. Implement the `Copy` trait for the X structure (however, please
keep in mind that the first solution should be preferred!):
Solution #2: Implement the `Copy` trait for the `X` structure.
However, please keep in mind that the first solution should be preferred.
```
#[derive(Clone, Copy)]
...
...
@@ -258,11 +260,13 @@ enum Enum {
by safety checks. As such, those safety checks can be temporarily relaxed by
wrapping the unsafe instructions inside an `unsafe` block. For instance:
```
unsafe fn f() { return; }
fn main() {
unsafe { f(); }
}
```
See also http://doc.rust-lang.org/book/unsafe.html
"##
,
...
...
@@ -313,8 +317,8 @@ fn main() {
E0162
:
r##"
An if-let pattern attempts to match the pattern, and enters the body if the
match was succes
ful. If the match is irrefutable (when it cannot fail to match),
use a regular `let`-binding instead. For instance:
match was succes
sful. If the match is irrefutable (when it cannot fail to
match),
use a regular `let`-binding instead. For instance:
```
struct Irrefutable(i32);
...
...
@@ -334,8 +338,8 @@ fn main() {
E0165
:
r##"
A while-let pattern attempts to match the pattern, and enters the body if the
match was succes
ful. If the match is irrefutable (when it cannot fail to match),
use a regular `let`-binding inside a `loop` instead. For instance:
match was succes
sful. If the match is irrefutable (when it cannot fail to
match),
use a regular `let`-binding inside a `loop` instead. For instance:
```
struct Irrefutable(i32);
...
...
@@ -374,7 +378,7 @@ enum Method {
```
If you don't qualify the names, the code will bind new variables named "GET" and
"POST" instead. This behavior is likely not what you want, so
rustc
warns when
"POST" instead. This behavior is likely not what you want, so
`rustc`
warns when
that happens.
Qualified names are good practice, and most code works well with them. But if
...
...
@@ -403,16 +407,16 @@ enum Method { GET, POST }
"##
,
E0267
:
r##"
This error indicates the use of
loop keyword (break or continue
) inside a
closure but outside of any loop. Break and continue can be used as normal
inside closures as long as they are also contained within a loop. To halt the
execution
of a closure you should instead use a return statement.
This error indicates the use of
a loop keyword (`break` or `continue`
) inside a
closure but outside of any loop. Break and continue can be used as normal
inside
closures as long as they are also contained within a loop. To halt the execution
of a closure you should instead use a return statement.
"##
,
E0268
:
r##"
This error indicates the use of
loop keyword (break or continue) outside of a
loop. Without a loop to break out of or continue in, no sensible action can be
taken.
This error indicates the use of
a loop keyword (`break` or `continue`) outside
of a loop. Without a loop to break out of or continue in, no sensible action can
be
taken.
"##
,
E0296
:
r##"
...
...
@@ -507,7 +511,7 @@ enum Method { GET, POST }
}
```
The `op_string_ref` binding has type
&Option<&String>
in both cases.
The `op_string_ref` binding has type
`&Option<&String>`
in both cases.
See also https://github.com/rust-lang/rust/issues/14587
"##
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录