File tree 1 file changed +37
-1
lines changed
1 file changed +37
-1
lines changed Original file line number Diff line number Diff line change @@ -3610,6 +3610,43 @@ match r {
3610
3610
```
3611
3611
"## ,
3612
3612
3613
+ E0533 : r##"
3614
+ An item which isn't a unit struct, a variant, nor a constant has been used as a
3615
+ match pattern.
3616
+
3617
+ Erroneous code example:
3618
+
3619
+ ```compile_fail,E0533
3620
+ struct Tortoise;
3621
+
3622
+ impl Tortoise {
3623
+ fn turtle(&self) -> u32 { 0 }
3624
+ }
3625
+
3626
+ match 0u32 {
3627
+ Tortoise::turtle => {} // Error!
3628
+ _ => {}
3629
+ }
3630
+ if let Tortoise::turtle = 0u32 {} // Same error!
3631
+ ```
3632
+
3633
+ If you want to match against a value returned by a method, you need to bind the
3634
+ value first:
3635
+
3636
+ ```
3637
+ struct Tortoise;
3638
+
3639
+ impl Tortoise {
3640
+ fn turtle(&self) -> u32 { 0 }
3641
+ }
3642
+
3643
+ match 0u32 {
3644
+ x if x == Tortoise.turtle() => {} // Bound into `x` then we compare it!
3645
+ _ => {}
3646
+ }
3647
+ ```
3648
+ "## ,
3649
+
3613
3650
E0534 : r##"
3614
3651
The `inline` attribute was malformed.
3615
3652
@@ -4935,7 +4972,6 @@ and the pin is required to keep it in the same place in memory.
4935
4972
E0377 , // the trait `CoerceUnsized` may only be implemented for a coercion
4936
4973
// between structures with the same definition
4937
4974
// E0558, // replaced with a generic attribute input check
4938
- E0533 , // `{}` does not name a unit variant, unit struct or a constant
4939
4975
// E0563, // cannot determine a type for this `impl Trait` removed in 6383de15
4940
4976
E0564 , // only named lifetimes are allowed in `impl Trait`,
4941
4977
// but `{}` was found in the type `{}`
You can’t perform that action at this time.
0 commit comments