diff options
| author | Ryan Levick <me@ryanlevick.com> | 2021-03-18 17:45:30 +0100 |
|---|---|---|
| committer | Ryan Levick <me@ryanlevick.com> | 2021-04-08 15:36:29 +0200 |
| commit | 2c1429ca5ebccecb463d268bc1628a9d330d57b0 (patch) | |
| tree | 60af707e3a3d4ed210ad50ad909ec3afc2c91897 /compiler/rustc_error_codes/src | |
| parent | 4f67392c485b746b6264e81bbd1b66e40725a95f (diff) | |
| download | rust-2c1429ca5ebccecb463d268bc1628a9d330d57b0.tar.gz rust-2c1429ca5ebccecb463d268bc1628a9d330d57b0.zip | |
Update error code docs even more
Diffstat (limited to 'compiler/rustc_error_codes/src')
| -rw-r--r-- | compiler/rustc_error_codes/src/error_codes/E0782.md | 4 | ||||
| -rw-r--r-- | compiler/rustc_error_codes/src/error_codes/E0783.md | 16 |
2 files changed, 8 insertions, 12 deletions
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<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. 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"), } ``` |
