@@ -1304,9 +1304,8 @@ Attributes may appear as any of
1304
1304
* An identifier followed by the equals sign '=' and a literal, providing a key/value pair
1305
1305
* An identifier followed by a parenthesized list of sub-attribute arguments
1306
1306
1307
- Attributes are applied to an entity by placing them within a hash-list
1308
- (` #[...] ` ) as either a prefix to the entity or as a semicolon-delimited
1309
- declaration within the entity body.
1307
+ Attributes terminated by a semi-colon apply to the entity that the attribute is declared
1308
+ within. Attributes that are not terminated by a semi-colon apply to the next entity.
1310
1309
1311
1310
An example of attributes:
1312
1311
@@ -1326,9 +1325,9 @@ mod bar {
1326
1325
...
1327
1326
}
1328
1327
1329
- // A documentation attribute
1330
- #[doc = "Add two numbers together." ]
1331
- fn add(x: int, y: int) { x + y }
1328
+ // A lint attribute used to suppress a warning/error
1329
+ #[allow(non_camel_case_types) ]
1330
+ pub type int8_t = i8;
1332
1331
~~~~~~~~
1333
1332
1334
1333
> ** Note:** In future versions of Rust, user-provided extensions to the compiler will be able to interpret attributes.
@@ -1341,6 +1340,8 @@ names are effectively reserved. Some significant attributes include:
1341
1340
* The ` cfg ` attribute, for conditional-compilation by build-configuration.
1342
1341
* The ` link ` attribute, for describing linkage metadata for a crate.
1343
1342
* The ` test ` attribute, for marking functions as unit tests.
1343
+ * The ` allow ` , ` warn ` , ` forbid ` , and ` deny ` attributes, for controling lint checks. Lint checks supported
1344
+ by the compiler can be found via ` rustc -W help ` .
1344
1345
1345
1346
Other attributes may be added or removed during development of the language.
1346
1347
0 commit comments