Skip to content

Commit 30872d0

Browse files
committed
doc: mention that intrinsics should not be called in user code
Intrinsic functions declared in `std::intrinsics` are an implementation detail and should not be called directly by the user. The compiler explicitly warns against their use in user code: ``` warning: the feature `core_intrinsics` is internal to the compiler or standard library --> src/lib.rs:1:12 | 1 | #![feature(core_intrinsics)] | ^^^^^^^^^^^^^^^ | = note: using it is strongly discouraged = note: `#[warn(internal_features)]` on by default ``` [**Playground link**] This PR documents what the compiler warning says: these intrinsics should not be called outside the standard library. [**Playground link**]: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2024&gist=1c893b0698291f550bbdde0151fd221b
1 parent 6c8138d commit 30872d0

File tree

1 file changed

+3
-0
lines changed
  • library/core/src/intrinsics

1 file changed

+3
-0
lines changed

library/core/src/intrinsics/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
//! and <https://github.com/rust-lang/rust/blob/master/compiler/rustc_codegen_llvm/src/intrinsic.rs>,
77
//! and for const evaluation in <https://github.com/rust-lang/rust/blob/master/compiler/rustc_const_eval/src/interpret/intrinsics.rs>.
88
//!
9+
//! The functions in this module are implementation details of `core` and should
10+
//! not be used outside of the standard library.
11+
//!
912
//! # Const intrinsics
1013
//!
1114
//! In order to make an intrinsic unstable usable at compile-time, copy the implementation from

0 commit comments

Comments
 (0)