File tree Expand file tree Collapse file tree 1 file changed +37
-1
lines changed Expand file tree Collapse file tree 1 file changed +37
-1
lines changed Original file line number Diff line number Diff line change @@ -3610,6 +3610,43 @@ match r {
36103610```
36113611"## ,
36123612
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+
36133650E0534 : r##"
36143651The `inline` attribute was malformed.
36153652
@@ -4935,7 +4972,6 @@ and the pin is required to keep it in the same place in memory.
49354972 E0377 , // the trait `CoerceUnsized` may only be implemented for a coercion
49364973 // between structures with the same definition
49374974// E0558, // replaced with a generic attribute input check
4938- E0533 , // `{}` does not name a unit variant, unit struct or a constant
49394975// E0563, // cannot determine a type for this `impl Trait` removed in 6383de15
49404976 E0564 , // only named lifetimes are allowed in `impl Trait`,
49414977 // but `{}` was found in the type `{}`
You can’t perform that action at this time.
0 commit comments