about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2025-02-23 17:34:50 +0100
committerRalf Jung <post@ralfj.de>2025-02-24 07:53:59 +0100
commit6eea027aa9453b685ac636ea40fc826267afab2a (patch)
treef5021a6137ff4a0be0a88a92cbee6d5990c4096a /tests
parent5a58a922e21438d70f1be738754dc257cc8c649b (diff)
downloadrust-6eea027aa9453b685ac636ea40fc826267afab2a.tar.gz
rust-6eea027aa9453b685ac636ea40fc826267afab2a.zip
remove support for rustc_intrinsic_must_be_overridden from the compiler
Diffstat (limited to 'tests')
-rw-r--r--tests/assembly/rust-abi-arg-attr.rs5
-rw-r--r--tests/rustdoc/const-intrinsic.rs10
-rw-r--r--tests/rustdoc/safe-intrinsic.rs10
-rw-r--r--tests/ui-fulldeps/stable-mir/check_intrinsics.rs6
-rw-r--r--tests/ui/error-codes/E0094.rs7
-rw-r--r--tests/ui/error-codes/E0094.stderr4
-rw-r--r--tests/ui/error-codes/E0308.rs7
-rw-r--r--tests/ui/error-codes/E0308.stderr4
-rw-r--r--tests/ui/intrinsics/always-gets-overridden.rs4
-rw-r--r--tests/ui/repr/16-bit-repr-c-enum.rs5
-rw-r--r--tests/ui/target-feature/feature-hierarchy.rs5
11 files changed, 19 insertions, 48 deletions
diff --git a/tests/assembly/rust-abi-arg-attr.rs b/tests/assembly/rust-abi-arg-attr.rs
index e55a53fbdeb..5b5eeb29f0f 100644
--- a/tests/assembly/rust-abi-arg-attr.rs
+++ b/tests/assembly/rust-abi-arg-attr.rs
@@ -51,10 +51,7 @@ enum Ordering {
 }
 
 #[rustc_intrinsic]
-#[rustc_intrinsic_must_be_overridden]
-fn three_way_compare<T: Copy>(lhs: T, rhs: T) -> Ordering {
-    loop {}
-}
+fn three_way_compare<T: Copy>(lhs: T, rhs: T) -> Ordering;
 
 // ^^^^^ core
 
diff --git a/tests/rustdoc/const-intrinsic.rs b/tests/rustdoc/const-intrinsic.rs
index 8444d4a3aa7..7dedb083b7d 100644
--- a/tests/rustdoc/const-intrinsic.rs
+++ b/tests/rustdoc/const-intrinsic.rs
@@ -9,19 +9,13 @@
 #[stable(since="1.0.0", feature="rust1")]
 #[rustc_const_stable(feature = "const_transmute", since = "1.56.0")]
 #[rustc_intrinsic]
-#[rustc_intrinsic_must_be_overridden]
-pub const unsafe fn transmute<T, U>(_: T) -> U {
-    loop {}
-}
+pub const unsafe fn transmute<T, U>(_: T) -> U;
 
 //@ has 'foo/fn.unreachable.html'
 //@ has - '//pre[@class="rust item-decl"]' 'pub unsafe fn unreachable() -> !'
 #[stable(since="1.0.0", feature="rust1")]
 #[rustc_intrinsic]
-#[rustc_intrinsic_must_be_overridden]
-pub unsafe fn unreachable() -> ! {
-    loop {}
-}
+pub unsafe fn unreachable() -> !;
 
 extern "C" {
     //@ has 'foo/fn.needs_drop.html'
diff --git a/tests/rustdoc/safe-intrinsic.rs b/tests/rustdoc/safe-intrinsic.rs
index 1edc1d9f79b..0d2ee89415d 100644
--- a/tests/rustdoc/safe-intrinsic.rs
+++ b/tests/rustdoc/safe-intrinsic.rs
@@ -11,14 +11,8 @@ trait Sized {}
 //@ has 'foo/fn.abort.html'
 //@ has - '//pre[@class="rust item-decl"]' 'pub fn abort() -> !'
 #[rustc_intrinsic]
-#[rustc_intrinsic_must_be_overridden]
-pub fn abort() -> ! {
-    loop {}
-}
+pub fn abort() -> !;
 //@ has 'foo/fn.unreachable.html'
 //@ has - '//pre[@class="rust item-decl"]' 'pub unsafe fn unreachable() -> !'
 #[rustc_intrinsic]
-#[rustc_intrinsic_must_be_overridden]
-pub unsafe fn unreachable() -> ! {
-    loop {}
-}
+pub unsafe fn unreachable() -> !;
diff --git a/tests/ui-fulldeps/stable-mir/check_intrinsics.rs b/tests/ui-fulldeps/stable-mir/check_intrinsics.rs
index 2f772b97886..07a2a62e066 100644
--- a/tests/ui-fulldeps/stable-mir/check_intrinsics.rs
+++ b/tests/ui-fulldeps/stable-mir/check_intrinsics.rs
@@ -51,13 +51,11 @@ fn test_intrinsics() -> ControlFlow<()> {
 
 /// This check is unfortunately tight to the implementation of intrinsics.
 ///
-/// We want to ensure that StableMIR can handle intrinsics with and without fallback body.
+/// We want to ensure that StableMIR can handle intrinsics with and without fallback body:
+/// for intrinsics without a body, obviously we cannot expose anything.
 ///
 /// If by any chance this test breaks because you changed how an intrinsic is implemented, please
 /// update the test to invoke a different intrinsic.
-///
-/// In StableMIR, we only expose intrinsic body if they are not marked with
-/// `rustc_intrinsic_must_be_overridden`.
 fn check_instance(instance: &Instance) {
     assert_eq!(instance.kind, InstanceKind::Intrinsic);
     let name = instance.intrinsic_name().unwrap();
diff --git a/tests/ui/error-codes/E0094.rs b/tests/ui/error-codes/E0094.rs
index da59d3decac..2067179b26a 100644
--- a/tests/ui/error-codes/E0094.rs
+++ b/tests/ui/error-codes/E0094.rs
@@ -1,10 +1,7 @@
 #![feature(intrinsics)]
 
 #[rustc_intrinsic]
-#[rustc_intrinsic_must_be_overridden]
-fn size_of<T, U>() -> usize {
-    //~^ ERROR E0094
-    loop {}
-}
+fn size_of<T, U>() -> usize;
+//~^ ERROR E0094
 
 fn main() {}
diff --git a/tests/ui/error-codes/E0094.stderr b/tests/ui/error-codes/E0094.stderr
index e45cc0ea063..da29987f8b1 100644
--- a/tests/ui/error-codes/E0094.stderr
+++ b/tests/ui/error-codes/E0094.stderr
@@ -1,7 +1,7 @@
 error[E0094]: intrinsic has wrong number of type parameters: found 2, expected 1
-  --> $DIR/E0094.rs:5:11
+  --> $DIR/E0094.rs:4:11
    |
-LL | fn size_of<T, U>() -> usize {
+LL | fn size_of<T, U>() -> usize;
    |           ^^^^^^ expected 1 type parameter
 
 error: aborting due to 1 previous error
diff --git a/tests/ui/error-codes/E0308.rs b/tests/ui/error-codes/E0308.rs
index f8f93d49a8e..c27d4245471 100644
--- a/tests/ui/error-codes/E0308.rs
+++ b/tests/ui/error-codes/E0308.rs
@@ -2,10 +2,7 @@
 #![feature(rustc_attrs)]
 
 #[rustc_intrinsic]
-#[rustc_intrinsic_must_be_overridden]
-fn size_of<T>() {
-    //~^ ERROR E0308
-    loop {}
-}
+fn size_of<T>();
+//~^ ERROR E0308
 
 fn main() {}
diff --git a/tests/ui/error-codes/E0308.stderr b/tests/ui/error-codes/E0308.stderr
index 77e5c06e06a..a1077481a81 100644
--- a/tests/ui/error-codes/E0308.stderr
+++ b/tests/ui/error-codes/E0308.stderr
@@ -1,7 +1,7 @@
 error[E0308]: intrinsic has wrong type
-  --> $DIR/E0308.rs:6:16
+  --> $DIR/E0308.rs:5:16
    |
-LL | fn size_of<T>() {
+LL | fn size_of<T>();
    |                ^ expected `usize`, found `()`
    |
    = note: expected signature `fn() -> usize`
diff --git a/tests/ui/intrinsics/always-gets-overridden.rs b/tests/ui/intrinsics/always-gets-overridden.rs
index 2fb64f96d83..aaac5415c21 100644
--- a/tests/ui/intrinsics/always-gets-overridden.rs
+++ b/tests/ui/intrinsics/always-gets-overridden.rs
@@ -1,5 +1,5 @@
-//! Check that `vtable_size` gets overridden by llvm backend even if there is no
-//! `rustc_intrinsic_must_be_overridden` attribute on this usage.
+//! Check that `vtable_size` gets overridden by llvm backend even if there is a
+//! fallback body.
 #![feature(intrinsics)]
 //@run-pass
 
diff --git a/tests/ui/repr/16-bit-repr-c-enum.rs b/tests/ui/repr/16-bit-repr-c-enum.rs
index 011076882d2..8c2d2fafce0 100644
--- a/tests/ui/repr/16-bit-repr-c-enum.rs
+++ b/tests/ui/repr/16-bit-repr-c-enum.rs
@@ -24,10 +24,7 @@ enum Foo {
 #[stable(feature = "intrinsics_for_test", since = "3.3.3")]
 #[rustc_const_stable(feature = "intrinsics_for_test", since = "3.3.3")]
 #[rustc_intrinsic]
-#[rustc_intrinsic_must_be_overridden]
-const fn size_of<T>() -> usize {
-    loop {}
-}
+const fn size_of<T>() -> usize;
 
 #[lang="sized"]
 trait Sized {}
diff --git a/tests/ui/target-feature/feature-hierarchy.rs b/tests/ui/target-feature/feature-hierarchy.rs
index d62b86693c2..315ec983a19 100644
--- a/tests/ui/target-feature/feature-hierarchy.rs
+++ b/tests/ui/target-feature/feature-hierarchy.rs
@@ -21,10 +21,7 @@ impl Copy for bool {}
 #[stable(feature = "test", since = "1.0.0")]
 #[rustc_const_stable(feature = "test", since = "1.0.0")]
 #[rustc_intrinsic]
-#[rustc_intrinsic_must_be_overridden]
-const unsafe fn unreachable() -> ! {
-    loop {}
-}
+const unsafe fn unreachable() -> !;
 
 #[rustc_builtin_macro]
 macro_rules! cfg {