diff --git a/compiler/rustc_error_codes/src/error_codes/E0782.md b/compiler/rustc_error_codes/src/error_codes/E0782.md index 63c48506e7f..b19d5209e4f 100644 --- a/compiler/rustc_error_codes/src/error_codes/E0782.md +++ b/compiler/rustc_error_codes/src/error_codes/E0782.md @@ -4,7 +4,7 @@ Erroneous code example: ```edition2021,compile_fail,E782 trait Foo {} -fn test(arg: Box) {} +fn test(arg: Box) {} // 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) {} +fn test(arg: Box) {} // ok! ``` This used to be allowed before edition 2021, but is now an error. diff --git a/compiler/rustc_error_codes/src/error_codes/E0783.md b/compiler/rustc_error_codes/src/error_codes/E0783.md index 41989b3ba2f..1d398660fb3 100644 --- a/compiler/rustc_error_codes/src/error_codes/E0783.md +++ b/compiler/rustc_error_codes/src/error_codes/E0783.md @@ -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"), } ```