From e3010e84dbf2e06424c91c5a3d4206c1911813bd Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Thu, 7 Nov 2024 08:59:43 +0100 Subject: remove support for rustc_safe_intrinsic attribute; use rustc_intrinsic functions instead --- .../rustc_error_codes/src/error_codes/E0094.md | 22 +++++++++++++--------- .../rustc_error_codes/src/error_codes/E0211.md | 10 ++++------ 2 files changed, 17 insertions(+), 15 deletions(-) (limited to 'compiler/rustc_error_codes/src') diff --git a/compiler/rustc_error_codes/src/error_codes/E0094.md b/compiler/rustc_error_codes/src/error_codes/E0094.md index d8c1a3cb55c..efbfa0851a8 100644 --- a/compiler/rustc_error_codes/src/error_codes/E0094.md +++ b/compiler/rustc_error_codes/src/error_codes/E0094.md @@ -3,13 +3,15 @@ An invalid number of generic parameters was passed to an intrinsic function. Erroneous code example: ```compile_fail,E0094 -#![feature(intrinsics, rustc_attrs)] +#![feature(intrinsics)] #![allow(internal_features)] -extern "rust-intrinsic" { - #[rustc_safe_intrinsic] - fn size_of() -> usize; // error: intrinsic has wrong number - // of type parameters +#[rustc_intrinsic] +#[rustc_intrinsic_must_be_overridden] +fn size_of() -> usize // error: intrinsic has wrong number + // of type parameters +{ + loop {} } ``` @@ -18,11 +20,13 @@ and verify with the function declaration in the Rust source code. Example: ``` -#![feature(intrinsics, rustc_attrs)] +#![feature(intrinsics)] #![allow(internal_features)] -extern "rust-intrinsic" { - #[rustc_safe_intrinsic] - fn size_of() -> usize; // ok! +#[rustc_intrinsic] +#[rustc_intrinsic_must_be_overridden] +fn size_of() -> usize // ok! +{ + loop {} } ``` diff --git a/compiler/rustc_error_codes/src/error_codes/E0211.md b/compiler/rustc_error_codes/src/error_codes/E0211.md index 19a482f6c93..7aa42628549 100644 --- a/compiler/rustc_error_codes/src/error_codes/E0211.md +++ b/compiler/rustc_error_codes/src/error_codes/E0211.md @@ -4,12 +4,11 @@ You used a function or type which doesn't fit the requirements for where it was used. Erroneous code examples: ```compile_fail -#![feature(intrinsics, rustc_attrs)] +#![feature(intrinsics)] #![allow(internal_features)] extern "rust-intrinsic" { - #[rustc_safe_intrinsic] - fn size_of(); // error: intrinsic has wrong type + fn unreachable(); // error: intrinsic has wrong type } // or: @@ -41,12 +40,11 @@ impl Foo { For the first code example, please check the function definition. Example: ``` -#![feature(intrinsics, rustc_attrs)] +#![feature(intrinsics)] #![allow(internal_features)] extern "rust-intrinsic" { - #[rustc_safe_intrinsic] - fn size_of() -> usize; // ok! + fn unreachable() -> !; // ok! } ``` -- cgit 1.4.1-3-g733a5