@@ -281,6 +281,8 @@ exists, convert the result of the expression to the given type.
281
281
282
282
## Attributes
283
283
284
+ <a name="conditional></a >
285
+
284
286
Every definition can be annotated with attributes. Attributes are meta
285
287
information that can serve a variety of purposes. One of those is
286
288
conditional compilation:
@@ -289,14 +291,20 @@ conditional compilation:
289
291
fn register_win_service() { /* ... */ }
290
292
291
293
This will cause the function to vanish without a trace during
292
- compilation on a non-Windows platform. Attributes always look like
293
- ` #[attr] ` , where ` attr ` can be simply a name (as in ` #[test] ` , which
294
- is used by the [ built-in test framework] ( test.html ) ), a name followed
295
- by ` = ` and then a literal (as in ` #[license = "BSD"] ` , which is a
296
- valid way to annotate a Rust program as being released under a
297
- BSD-style license), or a name followed by a comma-separated list of
298
- nested attributes, as in the ` cfg ` example above, or in this
299
- [ crate] ( mod.html ) metadata declaration:
294
+ compilation on a non-Windows platform, much like ` #ifdef ` in C (it
295
+ allows ` cfg(flag=value) ` and ` cfg(flag) ` forms, where the second
296
+ simply checks whether the configuration flag is defined at all). Flags
297
+ for ` target_os ` and ` target_arch ` are set by the compiler. It is
298
+ possible to set additional flags with the ` --cfg ` command-line option.
299
+
300
+ Attributes always look like ` #[attr] ` , where ` attr ` can be simply a
301
+ name (as in ` #[test] ` , which is used by the [ built-in test
302
+ framework] ( test.html ) ), a name followed by ` = ` and then a literal (as
303
+ in ` #[license = "BSD"] ` , which is a valid way to annotate a Rust
304
+ program as being released under a BSD-style license), or a name
305
+ followed by a comma-separated list of nested attributes, as in the
306
+ ` cfg ` example above, or in this [ crate] ( mod.html ) metadata
307
+ declaration:
300
308
301
309
#[link(name = "std",
302
310
vers = "0.1",
0 commit comments