Skip to content

Commit

Permalink
Merge pull request rust-lang#537 from ehuss/attribute-reorg-syntax
Browse files Browse the repository at this point in the history
Reorg and update attributes
  • Loading branch information
Centril authored Mar 17, 2019
2 parents e97bb87 + 53c5cff commit c207931
Show file tree
Hide file tree
Showing 28 changed files with 862 additions and 564 deletions.
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

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": "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

0 comments on commit c207931

Please sign in to comment.