Update error code docs even more
This commit is contained in:
parent
4f67392c48
commit
2c1429ca5e
@ -4,7 +4,7 @@ Erroneous code example:
|
||||
|
||||
```edition2021,compile_fail,E782
|
||||
trait Foo {}
|
||||
fn test(arg: Box<Foo>) {}
|
||||
fn test(arg: Box<Foo>) {} // error!
|
||||
```
|
||||
|
||||
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.
|
||||
|
||||
```
|
||||
trait Foo {}
|
||||
fn test(arg: Box<dyn Foo>) {}
|
||||
fn test(arg: Box<dyn Foo>) {} // ok!
|
||||
```
|
||||
|
||||
This used to be allowed before edition 2021, but is now an error.
|
||||
|
@ -3,11 +3,9 @@ The range pattern `...` is no longer allowed.
|
||||
Erroneous code example:
|
||||
|
||||
```edition2021,compile_fail,E782
|
||||
fn main() {
|
||||
match 2u8 {
|
||||
0...9 => println!("Got a number less than 10"),
|
||||
_ => println!("Got a number 10 or more")
|
||||
}
|
||||
match 2u8 {
|
||||
0...9 => println!("Got a number less than 10"), // error!
|
||||
_ => println!("Got a number 10 or more"),
|
||||
}
|
||||
```
|
||||
|
||||
@ -17,10 +15,8 @@ ranges which are now signified using `..=`.
|
||||
To make this code compile replace the `...` with `..=`.
|
||||
|
||||
```
|
||||
fn main() {
|
||||
match 2u8 {
|
||||
0..=9 => println!("Got a number less than 10"),
|
||||
_ => println!("Got a number 10 or more")
|
||||
}
|
||||
match 2u8 {
|
||||
0..=9 => println!("Got a number less than 10"), // ok!
|
||||
_ => println!("Got a number 10 or more"),
|
||||
}
|
||||
```
|
||||
|
Loading…
Reference in New Issue
Block a user