From c33f1b17287cdd8f4379324f68f3d5bca741cf1c Mon Sep 17 00:00:00 2001 From: Jonas Wolf Date: Fri, 17 Jan 2025 09:35:03 +0100 Subject: [PATCH 1/3] Add statements. --- .../src/core_unsafety/intrinsics.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 subcommittee/coding-guidelines/initiatives/safe-use-of-unsafe-guidelines/learn_unsafe_rust/src/core_unsafety/intrinsics.md diff --git a/subcommittee/coding-guidelines/initiatives/safe-use-of-unsafe-guidelines/learn_unsafe_rust/src/core_unsafety/intrinsics.md b/subcommittee/coding-guidelines/initiatives/safe-use-of-unsafe-guidelines/learn_unsafe_rust/src/core_unsafety/intrinsics.md new file mode 100644 index 00000000..d7a07d01 --- /dev/null +++ b/subcommittee/coding-guidelines/initiatives/safe-use-of-unsafe-guidelines/learn_unsafe_rust/src/core_unsafety/intrinsics.md @@ -0,0 +1,13 @@ + +# Intrinsics + +Rust provides a set of compiler intrinsics as part of `core` and `std` respectively (https://doc.rust-lang.org/std/intrinsics/index.html). + +Most of them are marked as experimental, unstable and useable in nightly versions of the compiler. + +For many, there is already stabilized API available. + +Thus, the clear recommendation is not using the experimental compiler intrinsics in a safety-critical project. + +With `transmute` there is one major exception. However, `transmute` is handled in other parts of the guidelines. + From ab3e76c7f358e6acf6c180a5c9dea963c2a24700 Mon Sep 17 00:00:00 2001 From: vjonaswolf Date: Mon, 10 Feb 2025 10:48:55 +0100 Subject: [PATCH 2/3] Update subcommittee/coding-guidelines/initiatives/safe-use-of-unsafe-guidelines/learn_unsafe_rust/src/core_unsafety/intrinsics.md Co-authored-by: Douglas Deslauriers --- .../learn_unsafe_rust/src/core_unsafety/intrinsics.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subcommittee/coding-guidelines/initiatives/safe-use-of-unsafe-guidelines/learn_unsafe_rust/src/core_unsafety/intrinsics.md b/subcommittee/coding-guidelines/initiatives/safe-use-of-unsafe-guidelines/learn_unsafe_rust/src/core_unsafety/intrinsics.md index d7a07d01..ba90d1c4 100644 --- a/subcommittee/coding-guidelines/initiatives/safe-use-of-unsafe-guidelines/learn_unsafe_rust/src/core_unsafety/intrinsics.md +++ b/subcommittee/coding-guidelines/initiatives/safe-use-of-unsafe-guidelines/learn_unsafe_rust/src/core_unsafety/intrinsics.md @@ -5,7 +5,7 @@ Rust provides a set of compiler intrinsics as part of `core` and `std` respectiv Most of them are marked as experimental, unstable and useable in nightly versions of the compiler. -For many, there is already stabilized API available. +Many intrinsics are accessible though a stabilized API located elsewhere in the Standard or Core Library. The documentation for each intrinsic typically references the stabilized API. Thus, the clear recommendation is not using the experimental compiler intrinsics in a safety-critical project. From bfb9b03c80fa44161713004b7d5fd9c187f8cc19 Mon Sep 17 00:00:00 2001 From: Jonas Wolf Date: Wed, 12 Feb 2025 07:49:50 +0100 Subject: [PATCH 3/3] Improve based on review comments. --- .../learn_unsafe_rust/src/core_unsafety/intrinsics.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/subcommittee/coding-guidelines/initiatives/safe-use-of-unsafe-guidelines/learn_unsafe_rust/src/core_unsafety/intrinsics.md b/subcommittee/coding-guidelines/initiatives/safe-use-of-unsafe-guidelines/learn_unsafe_rust/src/core_unsafety/intrinsics.md index d7a07d01..86609f8b 100644 --- a/subcommittee/coding-guidelines/initiatives/safe-use-of-unsafe-guidelines/learn_unsafe_rust/src/core_unsafety/intrinsics.md +++ b/subcommittee/coding-guidelines/initiatives/safe-use-of-unsafe-guidelines/learn_unsafe_rust/src/core_unsafety/intrinsics.md @@ -9,5 +9,7 @@ For many, there is already stabilized API available. Thus, the clear recommendation is not using the experimental compiler intrinsics in a safety-critical project. -With `transmute` there is one major exception. However, `transmute` is handled in other parts of the guidelines. +There are only few functions that are not marked as experimental: `copy`, `copy_nonoverlapping`, `write_bytes`, `transmute`. +`transmute` is probably the most well-known and widely used of these APIs. +`transmute` is handled in other parts of the guidelines.