Skip to content

Clean up err codes #67837

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jan 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/librustc_error_codes/error_codes/E0136.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
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:

Expand All @@ -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.
3 changes: 1 addition & 2 deletions src/librustc_error_codes/error_codes/E0161.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
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:

Expand Down
38 changes: 29 additions & 9 deletions src/librustc_error_codes/error_codes/E0164.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,44 @@
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!
_ => {}
}
}
```