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