about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/crashes/131342-2.rs40
-rw-r--r--tests/crashes/131342.rs1
-rw-r--r--tests/ui/layout/post-mono-layout-cycle-2.rs1
-rw-r--r--tests/ui/layout/post-mono-layout-cycle-2.stderr10
-rw-r--r--tests/ui/layout/post-mono-layout-cycle.rs1
-rw-r--r--tests/ui/layout/post-mono-layout-cycle.stderr10
-rw-r--r--tests/ui/simd-abi-checks.rs81
-rw-r--r--tests/ui/simd-abi-checks.stderr93
-rw-r--r--tests/ui/sse-abi-checks.rs24
-rw-r--r--tests/ui/sse-abi-checks.stderr13
10 files changed, 53 insertions, 221 deletions
diff --git a/tests/crashes/131342-2.rs b/tests/crashes/131342-2.rs
new file mode 100644
index 00000000000..79b6a837a49
--- /dev/null
+++ b/tests/crashes/131342-2.rs
@@ -0,0 +1,40 @@
+//@ known-bug: #131342
+// see also: 131342.rs
+
+fn main() {
+    problem_thingy(Once);
+}
+
+struct Once;
+
+impl Iterator for Once {
+    type Item = ();
+}
+
+fn problem_thingy(items: impl Iterator) {
+    let peeker = items.peekable();
+    problem_thingy(&peeker);
+}
+
+trait Iterator {
+    type Item;
+
+    fn peekable(self) -> Peekable<Self>
+    where
+        Self: Sized,
+    {
+        loop {}
+    }
+}
+
+struct Peekable<I: Iterator> {
+    _peeked: I::Item,
+}
+
+impl<I: Iterator> Iterator for Peekable<I> {
+    type Item = I::Item;
+}
+
+impl<I: Iterator + ?Sized> Iterator for &I {
+    type Item = I::Item;
+}
diff --git a/tests/crashes/131342.rs b/tests/crashes/131342.rs
index 266aa0da97d..7f7ee9c9ac1 100644
--- a/tests/crashes/131342.rs
+++ b/tests/crashes/131342.rs
@@ -1,4 +1,5 @@
 //@ known-bug: #131342
+// see also: 131342-2.rs
 
 fn main() {
   let mut items = vec![1, 2, 3, 4, 5].into_iter();
diff --git a/tests/ui/layout/post-mono-layout-cycle-2.rs b/tests/ui/layout/post-mono-layout-cycle-2.rs
index e9a5292fbbd..356f1e777c7 100644
--- a/tests/ui/layout/post-mono-layout-cycle-2.rs
+++ b/tests/ui/layout/post-mono-layout-cycle-2.rs
@@ -45,6 +45,7 @@ where
     T: Blah,
 {
     async fn ice(&mut self) {
+        //~^ ERROR a cycle occurred during layout computation
         let arr: [(); 0] = [];
         self.t.iter(arr.into_iter()).await;
     }
diff --git a/tests/ui/layout/post-mono-layout-cycle-2.stderr b/tests/ui/layout/post-mono-layout-cycle-2.stderr
index ea69b39706f..ad01c2694fa 100644
--- a/tests/ui/layout/post-mono-layout-cycle-2.stderr
+++ b/tests/ui/layout/post-mono-layout-cycle-2.stderr
@@ -12,12 +12,12 @@ LL |           Blah::iter(self, iterator).await
    |
    = note: a recursive `async fn` call must introduce indirection such as `Box::pin` to avoid an infinitely sized future
 
-note: the above error was encountered while instantiating `fn main::{closure#0}`
-  --> $DIR/post-mono-layout-cycle-2.rs:16:15
+error: a cycle occurred during layout computation
+  --> $DIR/post-mono-layout-cycle-2.rs:47:5
    |
-LL |         match fut.as_mut().poll(ctx) {
-   |               ^^^^^^^^^^^^^^^^^^^^^^
+LL |     async fn ice(&mut self) {
+   |     ^^^^^^^^^^^^^^^^^^^^^^^
 
-error: aborting due to 1 previous error
+error: aborting due to 2 previous errors
 
 For more information about this error, try `rustc --explain E0733`.
diff --git a/tests/ui/layout/post-mono-layout-cycle.rs b/tests/ui/layout/post-mono-layout-cycle.rs
index 6753c01267e..8d136190c00 100644
--- a/tests/ui/layout/post-mono-layout-cycle.rs
+++ b/tests/ui/layout/post-mono-layout-cycle.rs
@@ -14,6 +14,7 @@ struct Wrapper<T: Trait> {
 }
 
 fn abi<T: Trait>(_: Option<Wrapper<T>>) {}
+//~^ ERROR a cycle occurred during layout computation
 
 fn indirect<T: Trait>() {
     abi::<T>(None);
diff --git a/tests/ui/layout/post-mono-layout-cycle.stderr b/tests/ui/layout/post-mono-layout-cycle.stderr
index e2f6ac595d0..47f7f30b1cb 100644
--- a/tests/ui/layout/post-mono-layout-cycle.stderr
+++ b/tests/ui/layout/post-mono-layout-cycle.stderr
@@ -5,12 +5,12 @@ error[E0391]: cycle detected when computing layout of `Wrapper<()>`
    = note: cycle used when computing layout of `core::option::Option<Wrapper<()>>`
    = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
 
-note: the above error was encountered while instantiating `fn indirect::<()>`
-  --> $DIR/post-mono-layout-cycle.rs:23:5
+error: a cycle occurred during layout computation
+  --> $DIR/post-mono-layout-cycle.rs:16:1
    |
-LL |     indirect::<()>();
-   |     ^^^^^^^^^^^^^^^^
+LL | fn abi<T: Trait>(_: Option<Wrapper<T>>) {}
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
-error: aborting due to 1 previous error
+error: aborting due to 2 previous errors
 
 For more information about this error, try `rustc --explain E0391`.
diff --git a/tests/ui/simd-abi-checks.rs b/tests/ui/simd-abi-checks.rs
deleted file mode 100644
index 094c89930b7..00000000000
--- a/tests/ui/simd-abi-checks.rs
+++ /dev/null
@@ -1,81 +0,0 @@
-//@ only-x86_64
-//@ build-pass
-//@ ignore-pass (test emits codegen-time warnings)
-
-#![feature(avx512_target_feature)]
-#![feature(portable_simd)]
-#![allow(improper_ctypes_definitions)]
-
-use std::arch::x86_64::*;
-
-#[repr(transparent)]
-struct Wrapper(__m256);
-
-unsafe extern "C" fn w(_: Wrapper) {
-    //~^ ABI error: this function definition uses a vector type that requires the `avx` target feature, which is not enabled
-    //~| WARNING this was previously accepted by the compiler
-    todo!()
-}
-
-unsafe extern "C" fn f(_: __m256) {
-    //~^ ABI error: this function definition uses a vector type that requires the `avx` target feature, which is not enabled
-    //~| WARNING this was previously accepted by the compiler
-    todo!()
-}
-
-unsafe extern "C" fn g() -> __m256 {
-    //~^ ABI error: this function definition uses a vector type that requires the `avx` target feature, which is not enabled
-    //~| WARNING this was previously accepted by the compiler
-    todo!()
-}
-
-#[target_feature(enable = "avx")]
-unsafe extern "C" fn favx() -> __m256 {
-    todo!()
-}
-
-// avx2 implies avx, so no error here.
-#[target_feature(enable = "avx2")]
-unsafe extern "C" fn gavx(_: __m256) {
-    todo!()
-}
-
-// No error because of "Rust" ABI.
-fn as_f64x8(d: __m512d) -> std::simd::f64x8 {
-    unsafe { std::mem::transmute(d) }
-}
-
-unsafe fn test() {
-    let arg = std::mem::transmute([0.0f64; 8]);
-    as_f64x8(arg);
-}
-
-fn main() {
-    unsafe {
-        f(g());
-        //~^ WARNING ABI error: this function call uses a vector type that requires the `avx` target feature, which is not enabled in the caller
-        //~| WARNING ABI error: this function call uses a vector type that requires the `avx` target feature, which is not enabled in the caller
-        //~| WARNING this was previously accepted by the compiler
-        //~| WARNING this was previously accepted by the compiler
-    }
-
-    unsafe {
-        gavx(favx());
-        //~^ WARNING ABI error: this function call uses a vector type that requires the `avx` target feature, which is not enabled in the caller
-        //~| WARNING ABI error: this function call uses a vector type that requires the `avx` target feature, which is not enabled in the caller
-        //~| WARNING this was previously accepted by the compiler
-        //~| WARNING this was previously accepted by the compiler
-    }
-
-    unsafe {
-        test();
-    }
-
-    unsafe {
-        w(Wrapper(g()));
-        //~^ WARNING ABI error: this function call uses a vector type that requires the `avx` target feature, which is not enabled in the caller
-        //~| WARNING ABI error: this function call uses a vector type that requires the `avx` target feature, which is not enabled in the caller
-        //~| WARNING this was previously accepted by the compiler
-        //~| WARNING this was previously accepted by the compiler
-    }
-}
diff --git a/tests/ui/simd-abi-checks.stderr b/tests/ui/simd-abi-checks.stderr
deleted file mode 100644
index aa7e9400169..00000000000
--- a/tests/ui/simd-abi-checks.stderr
+++ /dev/null
@@ -1,93 +0,0 @@
-warning: ABI error: this function call uses a vector type that requires the `avx` target feature, which is not enabled in the caller
-  --> $DIR/simd-abi-checks.rs:55:11
-   |
-LL |         f(g());
-   |           ^^^ function called here
-   |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-   = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558>
-   = help: consider enabling it globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`)
-   = note: `#[warn(abi_unsupported_vector_types)]` on by default
-
-warning: ABI error: this function call uses a vector type that requires the `avx` target feature, which is not enabled in the caller
-  --> $DIR/simd-abi-checks.rs:55:9
-   |
-LL |         f(g());
-   |         ^^^^^^ function called here
-   |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-   = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558>
-   = help: consider enabling it globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`)
-
-warning: ABI error: this function call uses a vector type that requires the `avx` target feature, which is not enabled in the caller
-  --> $DIR/simd-abi-checks.rs:63:14
-   |
-LL |         gavx(favx());
-   |              ^^^^^^ function called here
-   |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-   = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558>
-   = help: consider enabling it globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`)
-
-warning: ABI error: this function call uses a vector type that requires the `avx` target feature, which is not enabled in the caller
-  --> $DIR/simd-abi-checks.rs:63:9
-   |
-LL |         gavx(favx());
-   |         ^^^^^^^^^^^^ function called here
-   |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-   = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558>
-   = help: consider enabling it globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`)
-
-warning: ABI error: this function call uses a vector type that requires the `avx` target feature, which is not enabled in the caller
-  --> $DIR/simd-abi-checks.rs:75:19
-   |
-LL |         w(Wrapper(g()));
-   |                   ^^^ function called here
-   |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-   = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558>
-   = help: consider enabling it globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`)
-
-warning: ABI error: this function call uses a vector type that requires the `avx` target feature, which is not enabled in the caller
-  --> $DIR/simd-abi-checks.rs:75:9
-   |
-LL |         w(Wrapper(g()));
-   |         ^^^^^^^^^^^^^^^ function called here
-   |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-   = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558>
-   = help: consider enabling it globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`)
-
-warning: ABI error: this function definition uses a vector type that requires the `avx` target feature, which is not enabled
-  --> $DIR/simd-abi-checks.rs:26:1
-   |
-LL | unsafe extern "C" fn g() -> __m256 {
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here
-   |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-   = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558>
-   = help: consider enabling it globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`)
-
-warning: ABI error: this function definition uses a vector type that requires the `avx` target feature, which is not enabled
-  --> $DIR/simd-abi-checks.rs:20:1
-   |
-LL | unsafe extern "C" fn f(_: __m256) {
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here
-   |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-   = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558>
-   = help: consider enabling it globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`)
-
-warning: ABI error: this function definition uses a vector type that requires the `avx` target feature, which is not enabled
-  --> $DIR/simd-abi-checks.rs:14:1
-   |
-LL | unsafe extern "C" fn w(_: Wrapper) {
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here
-   |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-   = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558>
-   = help: consider enabling it globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`)
-
-warning: 9 warnings emitted
-
diff --git a/tests/ui/sse-abi-checks.rs b/tests/ui/sse-abi-checks.rs
deleted file mode 100644
index d2afd38fcc8..00000000000
--- a/tests/ui/sse-abi-checks.rs
+++ /dev/null
@@ -1,24 +0,0 @@
-//! Ensure we trigger abi_unsupported_vector_types for target features that are usually enabled
-//! on a target, but disabled in this file via a `-C` flag.
-//@ compile-flags: --crate-type=rlib --target=i686-unknown-linux-gnu -C target-feature=-sse,-sse2
-//@ build-pass
-//@ ignore-pass (test emits codegen-time warnings)
-//@ needs-llvm-components: x86
-#![feature(no_core, lang_items, repr_simd)]
-#![no_core]
-#![allow(improper_ctypes_definitions)]
-
-#[lang = "sized"]
-trait Sized {}
-
-#[lang = "copy"]
-trait Copy {}
-
-#[repr(simd)]
-pub struct SseVector([i64; 2]);
-
-#[no_mangle]
-pub unsafe extern "C" fn f(_: SseVector) {
-    //~^ ABI error: this function definition uses a vector type that requires the `sse` target feature, which is not enabled
-    //~| WARNING this was previously accepted by the compiler
-}
diff --git a/tests/ui/sse-abi-checks.stderr b/tests/ui/sse-abi-checks.stderr
deleted file mode 100644
index 77c4e1fc07a..00000000000
--- a/tests/ui/sse-abi-checks.stderr
+++ /dev/null
@@ -1,13 +0,0 @@
-warning: ABI error: this function definition uses a vector type that requires the `sse` target feature, which is not enabled
-  --> $DIR/sse-abi-checks.rs:21:1
-   |
-LL | pub unsafe extern "C" fn f(_: SseVector) {
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here
-   |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-   = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558>
-   = help: consider enabling it globally (`-C target-feature=+sse`) or locally (`#[target_feature(enable="sse")]`)
-   = note: `#[warn(abi_unsupported_vector_types)]` on by default
-
-warning: 1 warning emitted
-