Skip to content

Commit 7588081

Browse files
---
yaml --- r: 234902 b: refs/heads/stable c: 7b4eb1a h: refs/heads/master v: v3
1 parent 4279f79 commit 7588081

File tree

3 files changed

+38
-4
lines changed

3 files changed

+38
-4
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ refs/heads/tmp: afae2ff723393b3ab4ccffef6ac7c6d1809e2da0
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
3030
refs/tags/homu-tmp: f859507de8c410b648d934d8f5ec1c52daac971d
3131
refs/tags/1.0.0-beta: 8cbb92b53468ee2b0c2d3eeb8567005953d40828
32-
refs/heads/stable: b7e41d9aeaade8a42ee9e71de34fdf2d982c664f
32+
refs/heads/stable: 7b4eb1aa90e49f6d068052b6e2baa5f59336ee13
3333
refs/tags/1.0.0: 55bd4f8ff2b323f317ae89e254ce87162d52a375
3434
refs/tags/1.1.0: bc3c16f09287e5545c1d3f76b7abd54f2eca868b
3535
refs/tags/1.2.0: f557861f822c34f07270347b94b5280de20a597e

branches/stable/src/librustc/diagnostics.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1018,7 +1018,7 @@ const foo: i32 = 42;
10181018
const baz: *const i32 = (&foo as *const i32);
10191019
10201020
const deref: i32 = *baz;
1021-
// error: raw pointers cannot be dereferenced in constants!
1021+
// error: raw pointers cannot be dereferenced in constants
10221022
```
10231023
10241024
To fix this error, please do not assign this value to a constant expression.

branches/stable/src/librustc_typeck/diagnostics.rs

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1457,6 +1457,42 @@ impl Foo for Bar {
14571457
```
14581458
"##,
14591459

1460+
E0327: r##"
1461+
You cannot use associated items other than constant items as patterns. This
1462+
includes method items. Example of erroneous code:
1463+
1464+
```
1465+
enum B {}
1466+
1467+
impl B {
1468+
fn bb() -> i32 { 0 }
1469+
}
1470+
1471+
fn main() {
1472+
match 0 {
1473+
B::bb => {} // error: associated items in match patterns must
1474+
// be constants
1475+
}
1476+
}
1477+
```
1478+
1479+
Please check that you're not using a method as a pattern. Example:
1480+
1481+
```
1482+
enum B {
1483+
ba,
1484+
bb
1485+
}
1486+
1487+
fn main() {
1488+
match B::ba {
1489+
B::bb => {} // ok!
1490+
_ => {}
1491+
}
1492+
}
1493+
```
1494+
"##,
1495+
14601496
E0368: r##"
14611497
This error indicates that a binary assignment operator like `+=` or `^=` was
14621498
applied to the wrong types. For example:
@@ -1540,7 +1576,6 @@ For more information see the [opt-in builtin traits RFC](https://github.com/rust
15401576

15411577
}
15421578

1543-
15441579
register_diagnostics! {
15451580
E0068,
15461581
E0074,
@@ -1640,7 +1675,6 @@ register_diagnostics! {
16401675
E0323, // implemented an associated const when another trait item expected
16411676
E0324, // implemented a method when another trait item expected
16421677
E0325, // implemented an associated type when another trait item expected
1643-
E0327, // referred to method instead of constant in match pattern
16441678
E0328, // cannot implement Unsize explicitly
16451679
E0329, // associated const depends on type parameter or Self.
16461680
E0366, // dropck forbid specialization to concrete type or region

0 commit comments

Comments
 (0)