Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reorg and update attributes #537

Merged
merged 4 commits into from
Mar 17, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 21 additions & 16 deletions src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,25 +21,30 @@

- [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)
- [Testing](attributes/testing.md)
- [Derive](attributes/derive.md)
- [Diagnostics](attributes/diagnostics.md)
- [Code generation](attributes/codegen.md)
- [Limits](attributes/limits.md)

- [Statements and expressions](statements-and-expressions.md)
- [Statements](statements.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
Centril marked this conversation as resolved.
Show resolved Hide resolved

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
Centril marked this conversation as resolved.
Show resolved Hide resolved

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": "attributes/derive.html",
"#documentation": "../rustdoc/the-doc-attribute.html",
"#ffi-attributes": "attributes.html#built-in-attributes-index",
"#inline-attribute": "codegen.html#the-inline-attribute",
"#lint-check-attributes": "diagnostics.html#lint-check-attributes",
"#macro-related-attributes": "attributes.html#built-in-attributes-index",
"#miscellaneous-attributes": "attributes.html#built-in-attributes-index",
"#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-index",
};
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