Skip to content

Commit ed2bf57

Browse files
Add E0537 error explanation
1 parent ebebb31 commit ed2bf57

File tree

1 file changed

+31
-1
lines changed

1 file changed

+31
-1
lines changed

src/libsyntax/diagnostic_list.rs

+31-1
Original file line numberDiff line numberDiff line change
@@ -128,10 +128,40 @@ For more information about the cfg attribute, take a look here:
128128
https://doc.rust-lang.org/reference.html#conditional-compilation
129129
"##,
130130

131+
E0537: r##"
132+
A unknown predicate was used inside the cfg attribute.
133+
134+
Erroneous code example:
135+
136+
```compile_fail,E0537
137+
#[cfg(unknown())] // error: invalid predicate `unknown`
138+
pub fn something() {}
139+
140+
pub fn main() {}
141+
```
142+
143+
There are only three predicates for the cfg attribute:
144+
145+
* any
146+
* all
147+
* not
148+
149+
Example:
150+
151+
```
152+
#[cfg(not(target_os = "linux"))] // ok!
153+
pub fn something() {}
154+
155+
pub fn main() {}
156+
```
157+
158+
For more information about the cfg attribute, take a look here:
159+
https://doc.rust-lang.org/reference.html#conditional-compilation
160+
"##,
161+
131162
}
132163

133164
register_diagnostics! {
134-
E0537, // invalid predicate
135165
E0538, // multiple [same] items
136166
E0539, // incorrect meta item
137167
E0540, // multiple rustc_deprecated attributes

0 commit comments

Comments
 (0)