未验证 提交 5c73be16 编写于 作者: G Guillaume Gomez 提交者: GitHub

Rollup merge of #67837 - GuillaumeGomez:clean-up-err-codes, r=Dylan-DPC

Clean up err codes

r? @Dylan-DPC
A binary can only have one entry point, and by default that entry point is the
function `main()`. If there are multiple such functions, please rename one.
More than one `main` function was found.
Erroneous code example:
......@@ -14,3 +13,7 @@ fn main() { // error!
// ...
}
```
A binary can only have one entry point, and by default that entry point is the
`main()` function. If there are multiple instances of this function, please
rename one of them.
A value was moved. However, its size was not known at compile time, and only
values of a known size can be moved.
A value was moved whose size was not known at compile time.
Erroneous code example:
......
This error means that an attempt was made to match a struct type enum
variant as a non-struct type:
Something which is neither a tuple struct nor a tuple variant was used as a
pattern.
Erroneous code example:
```compile_fail,E0164
enum Foo { B { i: u32 } }
enum A {
B,
C,
}
impl A {
fn new() {}
}
fn bar(foo: Foo) -> u32 {
fn bar(foo: A) {
match foo {
Foo::B(i) => i, // error E0164
A::new() => (), // error!
_ => {}
}
}
```
Try using `{}` instead:
This error means that an attempt was made to match something which is neither a
tuple struct nor a tuple variant. Only these two elements are allowed as a
pattern:
```
enum Foo { B { i: u32 } }
enum A {
B,
C,
}
impl A {
fn new() {}
}
fn bar(foo: Foo) -> u32 {
fn bar(foo: A) {
match foo {
Foo::B{i} => i,
A::B => (), // ok!
_ => {}
}
}
```
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册