summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2025-07-31 08:54:41 +0000
committerbors <bors@rust-lang.org>2025-07-31 08:54:41 +0000
commit64ca23b6235732fa61c0a2b957c5d7e591e7c972 (patch)
tree4688ea8f1bef26095df721f0a4344b64e2e66f03 /tests
parentcc0a5b73053c62a3df5f84b3ee85079c9b65fa87 (diff)
parent017586c93abe3b7e6f495a1f2bf34df4f3693411 (diff)
downloadrust-64ca23b6235732fa61c0a2b957c5d7e591e7c972.tar.gz
rust-64ca23b6235732fa61c0a2b957c5d7e591e7c972.zip
Auto merge of #144723 - Zalathar:rollup-f9e0rfo, r=Zalathar
Rollup of 3 pull requests

Successful merges:

 - rust-lang/rust#144657 (fix: Only "close the window" when its the last annotated file)
 - rust-lang/rust#144665 (Re-block SRoA on SIMD types)
 - rust-lang/rust#144713 (`rustc_middle::ty` cleanups)

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'tests')
-rw-r--r--tests/mir-opt/sroa/simd_sroa.foo.ScalarReplacementOfAggregates.diff32
-rw-r--r--tests/mir-opt/sroa/simd_sroa.rs18
-rw-r--r--tests/ui/error-emitter/auxiliary/close_window.rs4
-rw-r--r--tests/ui/error-emitter/close_window.ascii.stderr14
-rw-r--r--tests/ui/error-emitter/close_window.rs11
-rw-r--r--tests/ui/error-emitter/close_window.unicode.stderr14
6 files changed, 93 insertions, 0 deletions
diff --git a/tests/mir-opt/sroa/simd_sroa.foo.ScalarReplacementOfAggregates.diff b/tests/mir-opt/sroa/simd_sroa.foo.ScalarReplacementOfAggregates.diff
new file mode 100644
index 00000000000..74403247108
--- /dev/null
+++ b/tests/mir-opt/sroa/simd_sroa.foo.ScalarReplacementOfAggregates.diff
@@ -0,0 +1,32 @@
+- // MIR for `foo` before ScalarReplacementOfAggregates
++ // MIR for `foo` after ScalarReplacementOfAggregates
+  
+  fn foo(_1: &[Simd<u8, 16>], _2: Simd<u8, 16>) -> () {
+      debug simds => _1;
+      debug _unused => _2;
+      let mut _0: ();
+      let _3: std::simd::Simd<u8, 16>;
+      let _4: usize;
+      let mut _5: usize;
+      let mut _6: bool;
+      scope 1 {
+          debug a => _3;
+      }
+  
+      bb0: {
+          StorageLive(_3);
+          StorageLive(_4);
+          _4 = const 0_usize;
+          _5 = PtrMetadata(copy _1);
+          _6 = Lt(copy _4, copy _5);
+          assert(move _6, "index out of bounds: the length is {} but the index is {}", move _5, copy _4) -> [success: bb1, unwind continue];
+      }
+  
+      bb1: {
+          _3 = copy (*_1)[_4];
+          StorageDead(_4);
+          StorageDead(_3);
+          return;
+      }
+  }
+  
diff --git a/tests/mir-opt/sroa/simd_sroa.rs b/tests/mir-opt/sroa/simd_sroa.rs
new file mode 100644
index 00000000000..1ae84d3f975
--- /dev/null
+++ b/tests/mir-opt/sroa/simd_sroa.rs
@@ -0,0 +1,18 @@
+//@ needs-unwind
+#![feature(portable_simd)]
+
+// SRoA expands things even if they're unused
+// <https://github.com/rust-lang/rust/issues/144621>
+
+use std::simd::Simd;
+
+// EMIT_MIR simd_sroa.foo.ScalarReplacementOfAggregates.diff
+pub(crate) fn foo(simds: &[Simd<u8, 16>], _unused: Simd<u8, 16>) {
+    // CHECK-LABEL: fn foo
+    // CHECK-NOT: [u8; 16]
+    // CHECK: let [[SIMD:_.+]]: std::simd::Simd<u8, 16>;
+    // CHECK-NOT: [u8; 16]
+    // CHECK: [[SIMD]] = copy (*_1)[0 of 1];
+    // CHECK-NOT: [u8; 16]
+    let a = simds[0];
+}
diff --git a/tests/ui/error-emitter/auxiliary/close_window.rs b/tests/ui/error-emitter/auxiliary/close_window.rs
new file mode 100644
index 00000000000..e41313b6ab3
--- /dev/null
+++ b/tests/ui/error-emitter/auxiliary/close_window.rs
@@ -0,0 +1,4 @@
+pub struct S;
+impl S {
+    fn method(&self) {}
+}
diff --git a/tests/ui/error-emitter/close_window.ascii.stderr b/tests/ui/error-emitter/close_window.ascii.stderr
new file mode 100644
index 00000000000..e208b709393
--- /dev/null
+++ b/tests/ui/error-emitter/close_window.ascii.stderr
@@ -0,0 +1,14 @@
+error[E0624]: method `method` is private
+  --> $DIR/close_window.rs:9:7
+   |
+LL |     s.method();
+   |       ^^^^^^ private method
+   |
+  ::: $DIR/auxiliary/close_window.rs:3:5
+   |
+LL |     fn method(&self) {}
+   |     ---------------- private method defined here
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0624`.
diff --git a/tests/ui/error-emitter/close_window.rs b/tests/ui/error-emitter/close_window.rs
new file mode 100644
index 00000000000..879507c287a
--- /dev/null
+++ b/tests/ui/error-emitter/close_window.rs
@@ -0,0 +1,11 @@
+//@ aux-build:close_window.rs
+//@ revisions: ascii unicode
+//@[unicode] compile-flags: -Zunstable-options --error-format=human-unicode
+
+extern crate close_window;
+
+fn main() {
+   let s = close_window::S;
+    s.method();
+   //[ascii]~^ ERROR method `method` is private
+}
diff --git a/tests/ui/error-emitter/close_window.unicode.stderr b/tests/ui/error-emitter/close_window.unicode.stderr
new file mode 100644
index 00000000000..56ab6daa278
--- /dev/null
+++ b/tests/ui/error-emitter/close_window.unicode.stderr
@@ -0,0 +1,14 @@
+error[E0624]: method `method` is private
+   ╭▸ $DIR/close_window.rs:9:7
+   │
+LL │     s.method();
+   │       ━━━━━━ private method
+   │
+   ⸬ $DIR/auxiliary/close_window.rs:3:5
+   │
+LL │     fn method(&self) {}
+   ╰╴    ──────────────── private method defined here
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0624`.