Skip to content

Commit 92bac86

Browse files
michaelsproulbrson
authored andcommitted
---
yaml --- r: 174725 b: refs/heads/snap-stage3 c: 9a4401f h: refs/heads/master i: 174723: 309965c v: v3
1 parent e747f28 commit 92bac86

File tree

3 files changed

+41
-7
lines changed

3 files changed

+41
-7
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: a0f86de49748b472d4d189d9688b0d856c000914
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 9f59f7e0525ad44a11fb0614ef1626274ddaa918
4+
refs/heads/snap-stage3: 9a4401fe828f2f29c359bc3c83f6f3b7eed27d83
55
refs/heads/try: 08f6380a9f0b866796080094f44fe25ea5636547
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d

branches/snap-stage3/src/librustc/diagnostics.rs

Lines changed: 34 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,49 @@
1010

1111
#![allow(non_snake_case)]
1212

13-
register_diagnostic! { E0001, r##"
13+
register_long_diagnostics! {
14+
E0001: r##"
1415
This error suggests that the expression arm corresponding to the noted pattern
1516
will never be reached as for all possible values of the expression being matched,
1617
one of the preceeding patterns will match.
1718
1819
This means that perhaps some of the preceeding patterns are too general, this
1920
one is too specific or the ordering is incorrect.
20-
"## }
21+
"##,
22+
23+
E0003: r##"
24+
Not-a-Number (NaN) values can not be compared for equality and hence can never match
25+
the input to a match expression. To match against NaN values, you should instead use
26+
the `is_nan` method in a guard, as in: x if x.is_nan() => ...
27+
"##,
28+
29+
E0004: r##"
30+
This error indicates that the compiler can not guarantee a matching pattern for one
31+
or more possible inputs to a match expression. Guaranteed matches are required in order
32+
to assign values to match expressions, or alternatively, determine the flow of execution.
33+
34+
If you encounter this error you must alter your patterns so that every possible value of
35+
the input type is matched. For types with a small number of variants (like enums) you
36+
should probably cover all cases explicitly. Alternatively, the underscore `_` wildcard
37+
pattern can be added after all other patterns to match "anything else".
38+
"##,
39+
40+
// FIXME: Remove duplication here?
41+
E0005: r##"
42+
Patterns used to bind names must be irrefutable, that is, they must guarantee that a
43+
name will be extracted in all cases. If you encounter this error you probably need
44+
to use a `match` or `if let` to deal with the possibility of failure.
45+
"##,
46+
47+
E0006: r##"
48+
Patterns used to bind names must be irrefutable, that is, they must guarantee that a
49+
name will be extracted in all cases. If you encounter this error you probably need
50+
to use a `match` or `if let` to deal with the possibility of failure.
51+
"##
52+
}
2153

2254
register_diagnostics! {
2355
E0002,
24-
E0003,
25-
E0004,
26-
E0005,
27-
E0006,
2856
E0007,
2957
E0008,
3058
E0009,

branches/snap-stage3/src/libsyntax/diagnostics/macros.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,9 @@ macro_rules! register_diagnostics {
5959
)
6060
}
6161

62+
#[macro_export]
63+
macro_rules! register_long_diagnostics {
64+
($($code:tt: $description:tt),*) => (
65+
$(register_diagnostic! { $code, $description })*
66+
)
67+
}

0 commit comments

Comments
 (0)