Skip to content

Commit 2c1429c

Browse files
committed
Update error code docs even more
1 parent 4f67392 commit 2c1429c

File tree

2 files changed

+8
-12
lines changed

2 files changed

+8
-12
lines changed

compiler/rustc_error_codes/src/error_codes/E0782.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Erroneous code example:
44

55
```edition2021,compile_fail,E782
66
trait Foo {}
7-
fn test(arg: Box<Foo>) {}
7+
fn test(arg: Box<Foo>) {} // error!
88
```
99

1010
Trait objects are a way to call methods on types that are not known until
@@ -20,7 +20,7 @@ To fix this issue, add `dyn` before the trait name.
2020

2121
```
2222
trait Foo {}
23-
fn test(arg: Box<dyn Foo>) {}
23+
fn test(arg: Box<dyn Foo>) {} // ok!
2424
```
2525

2626
This used to be allowed before edition 2021, but is now an error.

compiler/rustc_error_codes/src/error_codes/E0783.md

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,9 @@ The range pattern `...` is no longer allowed.
33
Erroneous code example:
44

55
```edition2021,compile_fail,E782
6-
fn main() {
7-
match 2u8 {
8-
0...9 => println!("Got a number less than 10"),
9-
_ => println!("Got a number 10 or more")
10-
}
6+
match 2u8 {
7+
0...9 => println!("Got a number less than 10"), // error!
8+
_ => println!("Got a number 10 or more"),
119
}
1210
```
1311

@@ -17,10 +15,8 @@ ranges which are now signified using `..=`.
1715
To make this code compile replace the `...` with `..=`.
1816

1917
```
20-
fn main() {
21-
match 2u8 {
22-
0..=9 => println!("Got a number less than 10"),
23-
_ => println!("Got a number 10 or more")
24-
}
18+
match 2u8 {
19+
0..=9 => println!("Got a number less than 10"), // ok!
20+
_ => println!("Got a number 10 or more"),
2521
}
2622
```

0 commit comments

Comments
 (0)