File tree 1 file changed +36
-2
lines changed
1 file changed +36
-2
lines changed Original file line number Diff line number Diff line change @@ -1270,7 +1270,42 @@ trait Foo {}
1270
1270
1271
1271
impl Foo for i32 {}
1272
1272
```
1273
- "##
1273
+ "## ,
1274
+
1275
+ E0530 : r##"
1276
+ A binding shadowed something it shouldn't.
1277
+
1278
+ Erroneous code example:
1279
+
1280
+ ```compile_fail,E0530
1281
+ static TEST: i32 = 0;
1282
+
1283
+ let r: (i32, i32) = (0, 0);
1284
+ match r {
1285
+ TEST => {} // error: match bindings cannot shadow statics
1286
+ }
1287
+ ```
1288
+
1289
+ To fix this error, just change the binding's name in order to avoid shadowing
1290
+ one of the following:
1291
+
1292
+ * struct name
1293
+ * struct/enum variant
1294
+ * static
1295
+ * const
1296
+ * associated const
1297
+
1298
+ Fixed example:
1299
+
1300
+ ```
1301
+ static TEST: i32 = 0;
1302
+
1303
+ let r: (i32, i32) = (0, 0);
1304
+ match r {
1305
+ something => {} // ok!
1306
+ }
1307
+ ```
1308
+ "## ,
1274
1309
1275
1310
}
1276
1311
@@ -1289,7 +1324,6 @@ register_diagnostics! {
1289
1324
// E0419, merged into 531
1290
1325
// E0420, merged into 532
1291
1326
// E0421, merged into 531
1292
- E0530 , // X bindings cannot shadow Ys
1293
1327
E0531 , // unresolved pattern path kind `name`
1294
1328
E0532 , // expected pattern path kind, found another pattern path kind
1295
1329
// E0427, merged into 530
You can’t perform that action at this time.
0 commit comments