File tree 1 file changed +8
-3
lines changed
1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -69,6 +69,11 @@ object file, similar to the [`used` attribute](#the-used-attribute).
69
69
This attribute is unsafe as an unmangled symbol may collide with another symbol
70
70
with the same name (or with a well-known symbol), leading to undefined behavior.
71
71
72
+ ``` rust
73
+ #[unsafe (no_mangle)]
74
+ extern " C" fn foo () {}
75
+ ```
76
+
72
77
## The ` link_section ` attribute
73
78
74
79
The * ` link_section ` attribute* specifies the section of the object file that a
@@ -80,8 +85,8 @@ of memory not expecting them, such as mutable data into read-only areas.
80
85
81
86
<!-- no_run: don't link. The format of the section name is platform-specific. -->
82
87
``` rust,no_run
83
- #[no_mangle]
84
- #[link_section = ".example_section"]
88
+ #[unsafe( no_mangle) ]
89
+ #[unsafe( link_section = ".example_section") ]
85
90
pub static VAR1: u32 = 1;
86
91
```
87
92
@@ -96,7 +101,7 @@ symbol with the same name (or with a well-known symbol), leading to undefined
96
101
behavior.
97
102
98
103
``` rust
99
- #[export_name = " exported_symbol_name" ]
104
+ #[unsafe ( export_name = " exported_symbol_name" ) ]
100
105
pub fn name_in_rust () { }
101
106
```
102
107
You can’t perform that action at this time.
0 commit comments