Skip to content

Commit

Permalink
Reorg and update attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
ehuss committed Mar 15, 2019
1 parent 3c10c95 commit 7651fd1
Show file tree
Hide file tree
Showing 30 changed files with 884 additions and 571 deletions.
40 changes: 24 additions & 16 deletions src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,25 +21,27 @@

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

- [Items and attributes](items-and-attributes.md)
- [Items](items.md)
- [Modules](items/modules.md)
- [Extern crates](items/extern-crates.md)
- [Use declarations](items/use-declarations.md)
- [Functions](items/functions.md)
- [Type aliases](items/type-aliases.md)
- [Structs](items/structs.md)
- [Enumerations](items/enumerations.md)
- [Unions](items/unions.md)
- [Constant items](items/constant-items.md)
- [Static items](items/static-items.md)
- [Traits](items/traits.md)
- [Implementations](items/implementations.md)
- [External blocks](items/external-blocks.md)
- [Items](items.md)
- [Modules](items/modules.md)
- [Extern crates](items/extern-crates.md)
- [Use declarations](items/use-declarations.md)
- [Functions](items/functions.md)
- [Type aliases](items/type-aliases.md)
- [Structs](items/structs.md)
- [Enumerations](items/enumerations.md)
- [Unions](items/unions.md)
- [Constant items](items/constant-items.md)
- [Static items](items/static-items.md)
- [Traits](items/traits.md)
- [Implementations](items/implementations.md)
- [External blocks](items/external-blocks.md)
- [Type and lifetime parameters](items/generics.md)
- [Associated Items](items/associated-items.md)
- [Visibility and Privacy](visibility-and-privacy.md)
- [Attributes](attributes.md)

- [Attributes](attributes.md)
- [Derive](derive.md)
- [Compiler attributes](compiler-attrs.md)

- [Statements and expressions](statements-and-expressions.md)
- [Statements](statements.md)
Expand Down Expand Up @@ -115,6 +117,12 @@

- [The Rust runtime](runtime.md)

- [Code generation](codegen.md)

- [Testing](testing.md)

- [Diagnostics](diagnostics.md)

- [Appendices](appendices.md)
- [Macro Follow-Set Ambiguity Formal Specification](macro-ambiguity.md)
- [Influences](influences.md)
Expand Down
33 changes: 33 additions & 0 deletions src/abi.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,40 @@ $ nm -C foo.o
0000000000000000 T foo::quux
```

## The `no_mangle` attribute

The *`no_mangle` attribute* may be used on any [item] to disable standard
symbol name mangling. The symbol for the item will be the identifier of the
item's name.

## The `link_section` attribute

The *`link_section` attribute* specifies the section of the object file that a
[function] or [static]'s content will be placed into. It uses the
[_MetaNameValueStr_] syntax to specify the section name.

```rust,ignore
#[no_mangle]
#[link_section = ".example_section"]
pub static VAR1: u32 = 1;
```

## The `export_name` attribute

The *`export_name` attribute* specifies the name of the symbol that will be
exported on a [function] or [static]. It uses the [_MetaNameValueStr_] syntax
to specify the symbol name.

```rust,ignore
#[export_name = "exported_symbol_name"]
pub fn name_in_rust() { }
```

[_MetaNameValueStr_]: attributes.html#meta-item-attribute-syntax
[`static` items]: items/static-items.html
[attribute]: attributes.html
[extern functions]: items/functions.html#extern-functions
[external blocks]: items/external-blocks.html
[function]: items/functions.html
[item]: items.html
[static]: items/static-items.html
29 changes: 29 additions & 0 deletions src/attributes-redirect.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<script>
(function() {
var fragments = {
"#cold-attribute": "codegen.html#the-cold-attribute",
"#conditional-compilation": "conditional-compilation.html",
"#deprecation": "diagnostics.html#the-deprecated-attribute",
"#derive": "derive.html",
"#documentation": "../rustdoc/the-doc-attribute.html",
"#ffi-attributes": "attributes.html#built-in-attributes",
"#inline-attribute": "codegen.html#the-inline-attribute",
"#lint-check-attributes": "diagnostics.html#lint-check-attributes",
"#macro-related-attributes": "attributes.html#built-in-attributes",
"#miscellaneous-attributes": "attributes.html#built-in-attributes",
"#must_use": "diagnostics.html#the-must_use-attribute",
"#optimization-hints": "codegen.html#optimization-hints",
"#path": "items/modules.html#the-path-attribute",
"#preludes": "crates-and-source-files.html#preludes-and-no_std",
"#testing": "testing.html",
"#tool-lint-attributes": "diagnostics.html#tool-lint-attributes",
"#crate-only-attributes": "attributes.html#built-in-attributes",
};
var target = fragments[window.location.hash];
if (target) {
var url = window.location.toString();
var base = url.substring(0, url.lastIndexOf('/'));
window.location.replace(base + "/" + target);
}
})();
</script>
Loading

0 comments on commit 7651fd1

Please sign in to comment.