File tree Expand file tree Collapse file tree 2 files changed +8
-12
lines changed
compiler/rustc_error_codes/src/error_codes Expand file tree Collapse file tree 2 files changed +8
-12
lines changed Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ Erroneous code example:
44
55``` edition2021,compile_fail,E782
66trait Foo {}
7- fn test(arg: Box<Foo>) {}
7+ fn test(arg: Box<Foo>) {} // error!
88```
99
1010Trait 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```
2222trait Foo {}
23- fn test(arg: Box<dyn Foo>) {}
23+ fn test(arg: Box<dyn Foo>) {} // ok!
2424```
2525
2626This used to be allowed before edition 2021, but is now an error.
Original file line number Diff line number Diff line change @@ -3,11 +3,9 @@ The range pattern `...` is no longer allowed.
33Erroneous 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 `..=`.
1715To 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```
You can’t perform that action at this time.
0 commit comments