about summary refs log tree commit diff
diff options
context:
space:
mode:
authormejrs <59372212+mejrs@users.noreply.github.com>2025-04-29 18:19:26 +0200
committermejrs <59372212+mejrs@users.noreply.github.com>2025-04-29 18:19:26 +0200
commita917de445bfb26e1e9f2b9b9f99c04426606d017 (patch)
treece67e159057dc5e83a01147b9a57724a77034777
parent1f2b71e072d85dd2ecfd0e60da426e80b05e5f9b (diff)
downloadrust-a917de445bfb26e1e9f2b9b9f99c04426606d017.tar.gz
rust-a917de445bfb26e1e9f2b9b9f99c04426606d017.zip
Move tests from /ui directory
-rw-r--r--tests/ui/auxiliary/removing-extern-crate.rs1
-rw-r--r--tests/ui/catch-unwind-bang.rs10
-rw-r--r--tests/ui/codegen/cfguard-run.rs (renamed from tests/ui/cfguard-run.rs)0
-rw-r--r--tests/ui/error-emitter/error-festival.rs (renamed from tests/ui/error-festival.rs)2
-rw-r--r--tests/ui/error-emitter/error-festival.stderr (renamed from tests/ui/error-festival.stderr)24
-rw-r--r--tests/ui/panics/catch-unwind-bang.rs15
-rw-r--r--tests/ui/rust-2018/auxiliary/dummy-crate.rs2
-rw-r--r--tests/ui/rust-2018/removing-extern-crate.fixed (renamed from tests/ui/removing-extern-crate.fixed)2
-rw-r--r--tests/ui/rust-2018/removing-extern-crate.rs (renamed from tests/ui/removing-extern-crate.rs)6
-rw-r--r--tests/ui/rust-2018/removing-extern-crate.stderr (renamed from tests/ui/removing-extern-crate.stderr)8
10 files changed, 39 insertions, 31 deletions
diff --git a/tests/ui/auxiliary/removing-extern-crate.rs b/tests/ui/auxiliary/removing-extern-crate.rs
deleted file mode 100644
index 65e2cc34045..00000000000
--- a/tests/ui/auxiliary/removing-extern-crate.rs
+++ /dev/null
@@ -1 +0,0 @@
-// intentionally blank
diff --git a/tests/ui/catch-unwind-bang.rs b/tests/ui/catch-unwind-bang.rs
deleted file mode 100644
index c874c649f33..00000000000
--- a/tests/ui/catch-unwind-bang.rs
+++ /dev/null
@@ -1,10 +0,0 @@
-//@ run-pass
-//@ needs-unwind
-
-fn worker() -> ! {
-    panic!()
-}
-
-fn main() {
-    std::panic::catch_unwind(worker).unwrap_err();
-}
diff --git a/tests/ui/cfguard-run.rs b/tests/ui/codegen/cfguard-run.rs
index 52ad3e3cc04..52ad3e3cc04 100644
--- a/tests/ui/cfguard-run.rs
+++ b/tests/ui/codegen/cfguard-run.rs
diff --git a/tests/ui/error-festival.rs b/tests/ui/error-emitter/error-festival.rs
index 356564e5407..ebb5882352c 100644
--- a/tests/ui/error-festival.rs
+++ b/tests/ui/error-emitter/error-festival.rs
@@ -1,3 +1,5 @@
+//! Check that if there are a lot of errors we truncate the list of errors appropriately
+
 enum Question {
     Yes,
     No,
diff --git a/tests/ui/error-festival.stderr b/tests/ui/error-emitter/error-festival.stderr
index 9db95363791..be484bc8094 100644
--- a/tests/ui/error-festival.stderr
+++ b/tests/ui/error-emitter/error-festival.stderr
@@ -1,5 +1,5 @@
 error[E0425]: cannot find value `y` in this scope
-  --> $DIR/error-festival.rs:14:5
+  --> $DIR/error-festival.rs:16:5
    |
 LL |     y = 2;
    |     ^
@@ -15,19 +15,19 @@ LL |     let y = 2;
    |     +++
 
 error[E0603]: constant `FOO` is private
-  --> $DIR/error-festival.rs:22:10
+  --> $DIR/error-festival.rs:24:10
    |
 LL |     foo::FOO;
    |          ^^^ private constant
    |
 note: the constant `FOO` is defined here
-  --> $DIR/error-festival.rs:7:5
+  --> $DIR/error-festival.rs:9:5
    |
 LL |     const FOO: u32 = 0;
    |     ^^^^^^^^^^^^^^^^^^^
 
 error[E0368]: binary assignment operation `+=` cannot be applied to type `&str`
-  --> $DIR/error-festival.rs:12:5
+  --> $DIR/error-festival.rs:14:5
    |
 LL |     x += 2;
    |     -^^^^^
@@ -35,19 +35,19 @@ LL |     x += 2;
    |     cannot use `+=` on type `&str`
 
 error[E0599]: no method named `z` found for reference `&str` in the current scope
-  --> $DIR/error-festival.rs:16:7
+  --> $DIR/error-festival.rs:18:7
    |
 LL |     x.z();
    |       ^ method not found in `&str`
 
 error[E0600]: cannot apply unary operator `!` to type `Question`
-  --> $DIR/error-festival.rs:19:5
+  --> $DIR/error-festival.rs:21:5
    |
 LL |     !Question::Yes;
    |     ^^^^^^^^^^^^^^ cannot apply unary operator `!`
    |
 note: an implementation of `Not` might be missing for `Question`
-  --> $DIR/error-festival.rs:1:1
+  --> $DIR/error-festival.rs:3:1
    |
 LL | enum Question {
    | ^^^^^^^^^^^^^ must implement `Not`
@@ -55,7 +55,7 @@ note: the trait `Not` must be implemented
   --> $SRC_DIR/core/src/ops/bit.rs:LL:COL
 
 error[E0604]: only `u8` can be cast as `char`, not `u32`
-  --> $DIR/error-festival.rs:25:5
+  --> $DIR/error-festival.rs:27:5
    |
 LL |     0u32 as char;
    |     ^^^^^^^^^^^^
@@ -64,13 +64,13 @@ LL |     0u32 as char;
    |     help: try `char::from_u32` instead: `char::from_u32(0u32)`
 
 error[E0605]: non-primitive cast: `u8` as `Vec<u8>`
-  --> $DIR/error-festival.rs:29:5
+  --> $DIR/error-festival.rs:31:5
    |
 LL |     x as Vec<u8>;
    |     ^^^^^^^^^^^^ an `as` expression can only be used to convert between primitive types or to coerce to a specific trait object
 
 error[E0054]: cannot cast `{integer}` as `bool`
-  --> $DIR/error-festival.rs:33:24
+  --> $DIR/error-festival.rs:35:24
    |
 LL |     let x_is_nonzero = x as bool;
    |                        ^^^^^^^^^
@@ -82,7 +82,7 @@ LL +     let x_is_nonzero = x != 0;
    |
 
 error[E0606]: casting `&u8` as `u32` is invalid
-  --> $DIR/error-festival.rs:37:18
+  --> $DIR/error-festival.rs:39:18
    |
 LL |     let y: u32 = x as u32;
    |                  ^^^^^^^^
@@ -93,7 +93,7 @@ LL |     let y: u32 = *x as u32;
    |                  +
 
 error[E0607]: cannot cast thin pointer `*const u8` to wide pointer `*const [u8]`
-  --> $DIR/error-festival.rs:41:5
+  --> $DIR/error-festival.rs:43:5
    |
 LL |     v as *const [u8];
    |     ^^^^^^^^^^^^^^^^
diff --git a/tests/ui/panics/catch-unwind-bang.rs b/tests/ui/panics/catch-unwind-bang.rs
new file mode 100644
index 00000000000..80eb377e5ca
--- /dev/null
+++ b/tests/ui/panics/catch-unwind-bang.rs
@@ -0,0 +1,15 @@
+//! Check that the unwind machinery handles uninhabited types correctly.
+//! It used to call `std::mem::uninitialized::<!>();` at some point...
+//!
+//! See <https://github.com/rust-lang/rust/issues/39432>
+
+//@ run-pass
+//@ needs-unwind
+
+fn worker() -> ! {
+    panic!()
+}
+
+fn main() {
+    std::panic::catch_unwind(worker).unwrap_err();
+}
diff --git a/tests/ui/rust-2018/auxiliary/dummy-crate.rs b/tests/ui/rust-2018/auxiliary/dummy-crate.rs
new file mode 100644
index 00000000000..c9e8881600d
--- /dev/null
+++ b/tests/ui/rust-2018/auxiliary/dummy-crate.rs
@@ -0,0 +1,2 @@
+// intentionally blank, used because we need an extern crate for
+// `removing-extern-crate.rs` but don't care about what's in it.
diff --git a/tests/ui/removing-extern-crate.fixed b/tests/ui/rust-2018/removing-extern-crate.fixed
index 477161fba80..e88a84cc93e 100644
--- a/tests/ui/removing-extern-crate.fixed
+++ b/tests/ui/rust-2018/removing-extern-crate.fixed
@@ -1,5 +1,5 @@
 //@ edition:2018
-//@ aux-build:removing-extern-crate.rs
+//@ aux-build:dummy-crate.rs
 //@ run-rustfix
 //@ check-pass
 
diff --git a/tests/ui/removing-extern-crate.rs b/tests/ui/rust-2018/removing-extern-crate.rs
index 0b819482c71..844377945e0 100644
--- a/tests/ui/removing-extern-crate.rs
+++ b/tests/ui/rust-2018/removing-extern-crate.rs
@@ -1,15 +1,15 @@
 //@ edition:2018
-//@ aux-build:removing-extern-crate.rs
+//@ aux-build:dummy-crate.rs
 //@ run-rustfix
 //@ check-pass
 
 #![warn(rust_2018_idioms)]
 
-extern crate removing_extern_crate as foo; //~ WARNING unused extern crate
+extern crate dummy_crate as foo; //~ WARNING unused extern crate
 extern crate core; //~ WARNING unused extern crate
 
 mod another {
-    extern crate removing_extern_crate as foo; //~ WARNING unused extern crate
+    extern crate dummy_crate as foo; //~ WARNING unused extern crate
     extern crate core; //~ WARNING unused extern crate
 }
 
diff --git a/tests/ui/removing-extern-crate.stderr b/tests/ui/rust-2018/removing-extern-crate.stderr
index 4dddf160ce2..57312542640 100644
--- a/tests/ui/removing-extern-crate.stderr
+++ b/tests/ui/rust-2018/removing-extern-crate.stderr
@@ -1,8 +1,8 @@
 warning: unused extern crate
   --> $DIR/removing-extern-crate.rs:8:1
    |
-LL | extern crate removing_extern_crate as foo;
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove it
+LL | extern crate dummy_crate as foo;
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove it
    |
 note: the lint level is defined here
   --> $DIR/removing-extern-crate.rs:6:9
@@ -20,8 +20,8 @@ LL | extern crate core;
 warning: unused extern crate
   --> $DIR/removing-extern-crate.rs:12:5
    |
-LL |     extern crate removing_extern_crate as foo;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove it
+LL |     extern crate dummy_crate as foo;
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove it
 
 warning: unused extern crate
   --> $DIR/removing-extern-crate.rs:13:5