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