Skip to content

Commit 6dfb296

Browse files
committed
update docs
- src\doc\nomicon\src\ffi.md should also have its ABI list updated
1 parent 51b51b5 commit 6dfb296

File tree

5 files changed

+7
-57
lines changed

5 files changed

+7
-57
lines changed

compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
//! Codegen of intrinsics. This includes `extern "rust-intrinsic"`,
2-
//! functions marked with the `#[rustc_intrinsic]` attribute
1+
//! Codegen of intrinsics. This includes functions marked with the `#[rustc_intrinsic]` attribute
32
//! and LLVM intrinsics that have symbol names starting with `llvm.`.
43
54
macro_rules! intrinsic_args {

compiler/rustc_feature/src/unstable.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ declare_features! (
211211
(internal, custom_mir, "1.65.0", None),
212212
/// Outputs useful `assert!` messages
213213
(unstable, generic_assert, "1.63.0", None),
214-
/// Allows using the `rust-intrinsic`'s "ABI".
214+
/// Allows using the #[rustc_intrinsic] attribute.
215215
(internal, intrinsics, "1.0.0", None),
216216
/// Allows using `#[lang = ".."]` attribute for linking items to special compiler logic.
217217
(internal, lang_items, "1.0.0", None),

library/core/src/intrinsics/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
//! Note: any changes to the constness of intrinsics should be discussed with the language team.
99
//! This includes changes in the stability of the constness.
1010
//!
11+
//! //FIXME(#132735) "old" style intrinsics support has been removed
1112
//! In order to make an intrinsic usable at compile-time, it needs to be declared in the "new"
1213
//! style, i.e. as a `#[rustc_intrinsic]` function, not inside an `extern` block. Then copy the
1314
//! implementation from <https://github.com/rust-lang/miri/blob/master/src/intrinsics> to

src/doc/unstable-book/src/language-features/intrinsics.md

+2-28
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,8 @@ with any regular function.
5252
Various intrinsics have native MIR operations that they correspond to. Instead of requiring
5353
backends to implement both the intrinsic and the MIR operation, the `lower_intrinsics` pass
5454
will convert the calls to the MIR operation. Backends do not need to know about these intrinsics
55-
at all. These intrinsics only make sense without a body, and can either be declared as a "rust-intrinsic"
56-
or as a `#[rustc_intrinsic]`. The body is never used, as calls to the intrinsic do not exist
57-
anymore after MIR analyses.
55+
at all. These intrinsics only make sense without a body, and can be declared as a `#[rustc_intrinsic]`.
56+
The body is never used, as calls to the intrinsic do not exist anymore after MIR analyses.
5857

5958
## Intrinsics without fallback logic
6059

@@ -70,28 +69,3 @@ These are written without a body:
7069
#[rustc_intrinsic]
7170
pub fn abort() -> !;
7271
```
73-
74-
### Legacy extern ABI based intrinsics
75-
76-
*This style is deprecated, always prefer the above form.*
77-
78-
These are imported as if they were FFI functions, with the special
79-
`rust-intrinsic` ABI. For example, if one was in a freestanding
80-
context, but wished to be able to `transmute` between types, and
81-
perform efficient pointer arithmetic, one would import those functions
82-
via a declaration like
83-
84-
```rust
85-
#![feature(intrinsics)]
86-
#![allow(internal_features)]
87-
# fn main() {}
88-
89-
extern "rust-intrinsic" {
90-
fn transmute<T, U>(x: T) -> U;
91-
92-
fn arith_offset<T>(dst: *const T, offset: isize) -> *const T;
93-
}
94-
```
95-
96-
As with any other FFI functions, these are by default always `unsafe` to call.
97-
You can add `#[rustc_safe_intrinsic]` to the intrinsic to make it safe to call.

src/tools/rust-analyzer/crates/ide/src/hover/tests.rs

+2-26
Original file line numberDiff line numberDiff line change
@@ -6945,9 +6945,8 @@ fn hover_feature() {
69456945
Various intrinsics have native MIR operations that they correspond to. Instead of requiring
69466946
backends to implement both the intrinsic and the MIR operation, the `lower_intrinsics` pass
69476947
will convert the calls to the MIR operation. Backends do not need to know about these intrinsics
6948-
at all. These intrinsics only make sense without a body, and can either be declared as a "rust-intrinsic"
6949-
or as a `#[rustc_intrinsic]`. The body is never used, as calls to the intrinsic do not exist
6950-
anymore after MIR analyses.
6948+
at all. These intrinsics only make sense without a body, and can be as a `#[rustc_intrinsic]`.
6949+
The body is never used, as calls to the intrinsic do not exist anymore after MIR analyses.
69516950
69526951
## Intrinsics without fallback logic
69536952
@@ -6960,29 +6959,6 @@ fn hover_feature() {
69606959
`#[rustc_intrinsic_must_be_overridden]` to the function to ensure that backends don't
69616960
invoke the body.
69626961
6963-
### Legacy extern ABI based intrinsics
6964-
6965-
These are imported as if they were FFI functions, with the special
6966-
`rust-intrinsic` ABI. For example, if one was in a freestanding
6967-
context, but wished to be able to `transmute` between types, and
6968-
perform efficient pointer arithmetic, one would import those functions
6969-
via a declaration like
6970-
6971-
```rust
6972-
#![feature(intrinsics)]
6973-
#![allow(internal_features)]
6974-
# fn main() {}
6975-
6976-
extern "rust-intrinsic" {
6977-
fn transmute<T, U>(x: T) -> U;
6978-
6979-
fn arith_offset<T>(dst: *const T, offset: isize) -> *const T;
6980-
}
6981-
```
6982-
6983-
As with any other FFI functions, these are by default always `unsafe` to call.
6984-
You can add `#[rustc_safe_intrinsic]` to the intrinsic to make it safe to call.
6985-
69866962
"#]],
69876963
)
69886964
}

0 commit comments

Comments
 (0)