Skip to content

Commit a3b91c0

Browse files
gnzlbgCentril
andcommitted
Incorporate initial feedback from Centril and Ehuss
Co-Authored-By: Mazdak Farrokhzad <[email protected]>
1 parent 8ce3484 commit a3b91c0

File tree

1 file changed

+18
-15
lines changed

1 file changed

+18
-15
lines changed

src/items/functions.md

+18-15
Original file line numberDiff line numberDiff line change
@@ -112,23 +112,22 @@ sufficient context to determine the type parameters. For example,
112112
Extern function _definitions_ allow defining functions that can be called
113113
with a particular ABI:
114114

115-
```rust,norun
115+
```rust,no_run
116116
extern "ABI" fn foo() { ... }
117117
```
118118

119119
An extern function _declaration_ via an [external block] can be used to
120120
provide an item for these functions that can be called by Rust code without
121121
providing their definition.
122122

123-
The default ABI of Rust functions like `fn foo() {}` is `"Rust"`. While we
124-
abbreviate the type of Rust functions like `foo` as `fn()`, this is actually a
125-
synonym for `extern "Rust" fn()`. That is, this:
123+
When `"extern" Abi?*` is omitted from `FunctionQualifiers`, the ABI `"Rust"` is
124+
assigned. For example:
126125

127126
```rust
128127
fn foo() {}
129128
```
130129

131-
is identical to
130+
is equivalent to:
132131

133132
```rust
134133
extern "Rust" fn foo() {}
@@ -148,30 +147,34 @@ extern "stdcall" fn new_i32_stdcall() -> i32 { 0 }
148147
```
149148

150149
Just as with [external block], when the `extern` keyword is used and the `"ABI`
151-
is omitted, the ABI used defaults to `"C"`. That is, this
150+
is omitted, the ABI used defaults to `"C"`. That is, this:
152151

153152
```rust
154153
extern fn new_i32() -> i32 { 0 }
155154
let fptr: extern fn() -> i32 = new_i32;
156155
```
157156

158-
is identical to
157+
is equivalent to:
159158

160159
```rust
161160
extern "C" fn new_i32() -> i32 { 0 }
162161
let fptr: extern "C" fn() -> i32 = new_i32;
163162
```
164163

165-
Since functions with an ABI that differs from `"Rust"` do not support
166-
unwinding in the exact same way that Rust does, unwinding past the end
167-
of functions with such ABIs causes the process to abort. In LLVM, this is
168-
implemented by executing an illegal instruction.
164+
Functions with an ABI that differs from `"Rust"` do not support unwinding in the
165+
exact same way that Rust does. Therefore, unwinding past the end of functions
166+
with such ABIs causes the process to abort.
169167

170-
Some ABIs that are identical to `"Rust"` are:
168+
**Non-normative note**: The LLVM backend of the current Rust implementation
169+
aborts the process by executing an illegal instruction.
171170

172-
* `"rust-call"`
173-
* `"platform-intrinsic"`
174-
* `"rust-intrinsic"`
171+
**Non-normative note**: There are other ABIs available in unstable Rust that are
172+
equivalent to the `"Rust"` ABI, e.g.,
173+
[`"rust-intrinsic"`](https://doc.rust-lang.org/unstable-book/language-features/intrinsics.html?highlight=rust-intrin#intrinsics)
174+
or
175+
[`"platform-intrinsic"`](https://doc.rust-lang.org/unstable-book/language-features/platform-intrinsics.html).
176+
Refer to the [Unstable Book](https://doc.rust-lang.org/unstable-book) for more
177+
information about these.
175178

176179
## Const functions
177180

0 commit comments

Comments
 (0)