Skip to content

Commit 72f163c

Browse files
authored
Rollup merge of #151892 - chahar-ritik:e0423-enum-doc, r=Kivooeo
Document enum types used as values for E0423 ### Problem The E0423 error explanation did not include an example for enum types being used as values, which is a common source of confusion for users. For example, the following code: ```rust fn main() { let x = Option::<i32>; } ```
2 parents 29fcd63 + daaff44 commit 72f163c

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

  • compiler/rustc_error_codes/src/error_codes

compiler/rustc_error_codes/src/error_codes/E0423.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,14 @@ fn h1() -> i32 {
4444
// did you mean `a::I`?
4545
}
4646
```
47+
48+
### Enum types used as values
49+
50+
Enums are types and cannot be used directly as values.
51+
52+
```compile_fail,E0423
53+
fn main(){
54+
let x = Option::<i32>;
55+
//~^ ERROR expected value,found enum `Option`
56+
}
57+
```

0 commit comments

Comments
 (0)