Skip to content

Commit 993393d

Browse files
committed
Reorg and update attributes
1 parent e97bb87 commit 993393d

28 files changed

+879
-564
lines changed

src/SUMMARY.md

+24-16
Original file line numberDiff line numberDiff line change
@@ -21,25 +21,27 @@
2121

2222
- [Conditional compilation](conditional-compilation.md)
2323

24-
- [Items and attributes](items-and-attributes.md)
25-
- [Items](items.md)
26-
- [Modules](items/modules.md)
27-
- [Extern crates](items/extern-crates.md)
28-
- [Use declarations](items/use-declarations.md)
29-
- [Functions](items/functions.md)
30-
- [Type aliases](items/type-aliases.md)
31-
- [Structs](items/structs.md)
32-
- [Enumerations](items/enumerations.md)
33-
- [Unions](items/unions.md)
34-
- [Constant items](items/constant-items.md)
35-
- [Static items](items/static-items.md)
36-
- [Traits](items/traits.md)
37-
- [Implementations](items/implementations.md)
38-
- [External blocks](items/external-blocks.md)
24+
- [Items](items.md)
25+
- [Modules](items/modules.md)
26+
- [Extern crates](items/extern-crates.md)
27+
- [Use declarations](items/use-declarations.md)
28+
- [Functions](items/functions.md)
29+
- [Type aliases](items/type-aliases.md)
30+
- [Structs](items/structs.md)
31+
- [Enumerations](items/enumerations.md)
32+
- [Unions](items/unions.md)
33+
- [Constant items](items/constant-items.md)
34+
- [Static items](items/static-items.md)
35+
- [Traits](items/traits.md)
36+
- [Implementations](items/implementations.md)
37+
- [External blocks](items/external-blocks.md)
3938
- [Type and lifetime parameters](items/generics.md)
4039
- [Associated Items](items/associated-items.md)
4140
- [Visibility and Privacy](visibility-and-privacy.md)
42-
- [Attributes](attributes.md)
41+
42+
- [Attributes](attributes.md)
43+
- [Derive](derive.md)
44+
- [Compiler attributes](compiler-attrs.md)
4345

4446
- [Statements and expressions](statements-and-expressions.md)
4547
- [Statements](statements.md)
@@ -115,6 +117,12 @@
115117

116118
- [The Rust runtime](runtime.md)
117119

120+
- [Code generation](codegen.md)
121+
122+
- [Testing](testing.md)
123+
124+
- [Diagnostics](diagnostics.md)
125+
118126
- [Appendices](appendices.md)
119127
- [Macro Follow-Set Ambiguity Formal Specification](macro-ambiguity.md)
120128
- [Influences](influences.md)

src/abi.md

+33
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,40 @@ $ nm -C foo.o
5656
0000000000000000 T foo::quux
5757
```
5858

59+
## The `no_mangle` attribute
60+
61+
The *`no_mangle` attribute* may be used on any [item] to disable standard
62+
symbol name mangling. The symbol for the item will be the identifier of the
63+
item's name.
64+
65+
## The `link_section` attribute
66+
67+
The *`link_section` attribute* specifies the section of the object file that a
68+
[function] or [static]'s content will be placed into. It uses the
69+
[_MetaNameValueStr_] syntax to specify the section name.
70+
71+
```rust,ignore
72+
#[no_mangle]
73+
#[link_section = ".example_section"]
74+
pub static VAR1: u32 = 1;
75+
```
76+
77+
## The `export_name` attribute
78+
79+
The *`export_name` attribute* specifies the name of the symbol that will be
80+
exported on a [function] or [static]. It uses the [_MetaNameValueStr_] syntax
81+
to specify the symbol name.
82+
83+
```rust,ignore
84+
#[export_name = "exported_symbol_name"]
85+
pub fn name_in_rust() { }
86+
```
87+
88+
[_MetaNameValueStr_]: attributes.html#meta-item-attribute-syntax
5989
[`static` items]: items/static-items.html
6090
[attribute]: attributes.html
6191
[extern functions]: items/functions.html#extern-functions
6292
[external blocks]: items/external-blocks.html
93+
[function]: items/functions.html
94+
[item]: items.html
95+
[static]: items/static-items.html

src/attributes-redirect.html

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<script>
2+
(function() {
3+
var fragments = {
4+
"#cold-attribute": "codegen.html#the-cold-attribute",
5+
"#conditional-compilation": "conditional-compilation.html",
6+
"#deprecation": "diagnostics.html#the-deprecated-attribute",
7+
"#derive": "derive.html",
8+
"#documentation": "../rustdoc/the-doc-attribute.html",
9+
"#ffi-attributes": "attributes.html#built-in-attributes",
10+
"#inline-attribute": "codegen.html#the-inline-attribute",
11+
"#lint-check-attributes": "diagnostics.html#lint-check-attributes",
12+
"#macro-related-attributes": "attributes.html#built-in-attributes",
13+
"#miscellaneous-attributes": "attributes.html#built-in-attributes",
14+
"#must_use": "diagnostics.html#the-must_use-attribute",
15+
"#optimization-hints": "codegen.html#optimization-hints",
16+
"#path": "items/modules.html#the-path-attribute",
17+
"#preludes": "crates-and-source-files.html#preludes-and-no_std",
18+
"#testing": "testing.html",
19+
"#tool-lint-attributes": "diagnostics.html#tool-lint-attributes",
20+
"#crate-only-attributes": "attributes.html#built-in-attributes",
21+
};
22+
var target = fragments[window.location.hash];
23+
if (target) {
24+
var url = window.location.toString();
25+
var base = url.substring(0, url.lastIndexOf('/'));
26+
window.location.replace(base + "/" + target);
27+
}
28+
})();
29+
</script>

0 commit comments

Comments
 (0)