about summary refs log tree commit diff
diff options
context:
space:
mode:
authorOliver Scherer <github35764891676564198441@oli-obk.de>2019-12-21 00:07:36 +0100
committerOliver Scherer <github35764891676564198441@oli-obk.de>2019-12-21 00:07:36 +0100
commit032d810e24a39aad311c15d05dfef4dc4d6829c4 (patch)
treedce820120c84f1c393740d5c5e232d5f0927cb02
parent9ee16e14c51668309f446636e8960b7fbbac066d (diff)
downloadrust-032d810e24a39aad311c15d05dfef4dc4d6829c4.tar.gz
rust-032d810e24a39aad311c15d05dfef4dc4d6829c4.zip
Add a big notice about const intrinsics
-rw-r--r--src/libcore/intrinsics.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/libcore/intrinsics.rs b/src/libcore/intrinsics.rs
index a194db52eb2..544fd4fb99f 100644
--- a/src/libcore/intrinsics.rs
+++ b/src/libcore/intrinsics.rs
@@ -1,6 +1,22 @@
 //! Compiler intrinsics.
 //!
 //! The corresponding definitions are in `librustc_codegen_llvm/intrinsic.rs`.
+//! The corresponding const implementations are in `librustc_mir/interpret/intrinsics.rs`
+//!
+//! # Const intrinsics
+//!
+//! Note: any changes to the constness of intrinsics should be discussed with the language team.
+//! This includes changes in the stability of the constness.
+//!
+//! In order to make an intrinsic usable at compile-time, one needs to copy the implementation
+//! from https://github.com/rust-lang/miri/blob/master/src/shims/intrinsics.rs to
+//! `librustc_mir/interpret/intrinsics.rs` and add a
+//! `#[rustc_const_unstable(feature = "foo", issue = "01234")]` to the intrinsic.
+//!
+//! If an intrinsic is supposed to be used from a `const fn` with a `rustc_const_stable` attribute,
+//! the intrinsic's attribute must be `rustc_const_stable`, too. Such a change should not be done
+//! without T-lang consulation, because it bakes a feature into the language that cannot be
+//! replicated in user code without compiler support.
 //!
 //! # Volatiles
 //!