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