]> git.lizzy.rs Git - rust.git/blob - src/libsyntax_ext/error_codes.rs
Update to use new librustc_error_codes library
[rust.git] / src / libsyntax_ext / error_codes.rs
1 // Error messages for EXXXX errors.
2 // Each message should start and end with a new line, and be wrapped to 80
3 // characters.  In vim you can `:set tw=80` and use `gq` to wrap paragraphs. Use
4 // `:set tw=0` to disable.
5 syntax::register_diagnostics! {
6 E0660: r##"
7 The argument to the `asm` macro is not well-formed.
8
9 Erroneous code example:
10
11 ```compile_fail,E0660
12 asm!("nop" "nop");
13 ```
14
15 Considering that this would be a long explanation, we instead recommend you to
16 take a look at the unstable book:
17 https://doc.rust-lang.org/unstable-book/language-features/asm.html
18 "##,
19
20 E0661: r##"
21 An invalid syntax was passed to the second argument of an `asm` macro line.
22
23 Erroneous code example:
24
25 ```compile_fail,E0661
26 let a;
27 asm!("nop" : "r"(a));
28 ```
29
30 Considering that this would be a long explanation, we instead recommend you to
31 take a look at the unstable book:
32 https://doc.rust-lang.org/unstable-book/language-features/asm.html
33 "##,
34
35 E0662: r##"
36 An invalid input operand constraint was passed to the `asm` macro (third line).
37
38 Erroneous code example:
39
40 ```compile_fail,E0662
41 asm!("xor %eax, %eax"
42      :
43      : "=test"("a")
44     );
45 ```
46
47 Considering that this would be a long explanation, we instead recommend you to
48 take a look at the unstable book:
49 https://doc.rust-lang.org/unstable-book/language-features/asm.html
50 "##,
51
52 E0663: r##"
53 An invalid input operand constraint was passed to the `asm` macro (third line).
54
55 Erroneous code example:
56
57 ```compile_fail,E0663
58 asm!("xor %eax, %eax"
59      :
60      : "+test"("a")
61     );
62 ```
63
64 Considering that this would be a long explanation, we instead recommend you to
65 take a look at the unstable book:
66 https://doc.rust-lang.org/unstable-book/language-features/asm.html
67 "##,
68
69 E0664: r##"
70 A clobber was surrounded by braces in the `asm` macro.
71
72 Erroneous code example:
73
74 ```compile_fail,E0664
75 asm!("mov $$0x200, %eax"
76      :
77      :
78      : "{eax}"
79     );
80 ```
81
82 Considering that this would be a long explanation, we instead recommend you to
83 take a look at the unstable book:
84 https://doc.rust-lang.org/unstable-book/language-features/asm.html
85 "##,
86
87 E0665: r##"
88 The `Default` trait was derived on an enum.
89
90 Erroneous code example:
91
92 ```compile_fail,E0665
93 #[derive(Default)]
94 enum Food {
95     Sweet,
96     Salty,
97 }
98 ```
99
100 The `Default` cannot be derived on an enum for the simple reason that the
101 compiler doesn't know which value to pick by default whereas it can for a
102 struct as long as all its fields implement the `Default` trait as well.
103
104 If you still want to implement `Default` on your enum, you'll have to do it "by
105 hand":
106
107 ```
108 enum Food {
109     Sweet,
110     Salty,
111 }
112
113 impl Default for Food {
114     fn default() -> Food {
115         Food::Sweet
116     }
117 }
118 ```
119 "##,
120 }