about summary refs log tree commit diff
path: root/tests/ui/not-panic
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-01-11 11:17:22 +0000
committerbors <bors@rust-lang.org>2023-01-11 11:17:22 +0000
commitb22c152958eade17a71d899b29a2d39bcc77aa48 (patch)
treeec6da75dc598a0a4086c0cc032c86d7241be1bc1 /tests/ui/not-panic
parent8ecaad85f61375b18e1667b51a3ef350121d2ca0 (diff)
parent40ba0e84d53f605ccf01836e9c2d27892728ae81 (diff)
downloadrust-b22c152958eade17a71d899b29a2d39bcc77aa48.tar.gz
rust-b22c152958eade17a71d899b29a2d39bcc77aa48.zip
Auto merge of #106458 - albertlarsan68:move-tests, r=jyn514
Move src/test to the root

See MCP at rust-lang/compiler-team#573

There may be more changes needed.

The first commit is just the move of the files:
You can check that the first commit did not do anything else than renames by running
```
git diff --diff-filter=r -M100% <rust-lang remote>/master <first commit hash>
```
The output should be empty, because the filter excludes renames, and the match threshold for qualifying a rename is 100%.

The second one is mostly a "find and replace" of `src/test` to `tests` and whatever is needed to make CI pass.

What is left to do:
---

- [x] Move directory
- [ ] Change references to `src/test`
    - [x] Change references in-tree
    - [ ] Change references in submodules / out-of-tree docs
- [x] Make CI pass:
    - [x] Fix tidy
    - [x] Fix tests
    - [x] Bless tests if needed (shouldn't normally)
- [ ] Merge it !
Diffstat (limited to 'tests/ui/not-panic')
-rw-r--r--tests/ui/not-panic/not-panic-safe-2.rs13
-rw-r--r--tests/ui/not-panic/not-panic-safe-2.stderr34
-rw-r--r--tests/ui/not-panic/not-panic-safe-3.rs13
-rw-r--r--tests/ui/not-panic/not-panic-safe-3.stderr34
-rw-r--r--tests/ui/not-panic/not-panic-safe-4.rs12
-rw-r--r--tests/ui/not-panic/not-panic-safe-4.stderr34
-rw-r--r--tests/ui/not-panic/not-panic-safe-5.rs10
-rw-r--r--tests/ui/not-panic/not-panic-safe-5.stderr17
-rw-r--r--tests/ui/not-panic/not-panic-safe-6.rs12
-rw-r--r--tests/ui/not-panic/not-panic-safe-6.stderr34
-rw-r--r--tests/ui/not-panic/not-panic-safe.rs10
-rw-r--r--tests/ui/not-panic/not-panic-safe.stderr20
12 files changed, 243 insertions, 0 deletions
diff --git a/tests/ui/not-panic/not-panic-safe-2.rs b/tests/ui/not-panic/not-panic-safe-2.rs
new file mode 100644
index 00000000000..f3faa704329
--- /dev/null
+++ b/tests/ui/not-panic/not-panic-safe-2.rs
@@ -0,0 +1,13 @@
+#![allow(dead_code)]
+
+use std::panic::UnwindSafe;
+use std::rc::Rc;
+use std::cell::RefCell;
+
+fn assert<T: UnwindSafe + ?Sized>() {}
+
+fn main() {
+    assert::<Rc<RefCell<i32>>>();
+    //~^ ERROR the type `UnsafeCell<i32>` may contain interior mutability and a
+    //~| ERROR the type `UnsafeCell<isize>` may contain interior mutability and a
+}
diff --git a/tests/ui/not-panic/not-panic-safe-2.stderr b/tests/ui/not-panic/not-panic-safe-2.stderr
new file mode 100644
index 00000000000..3b0f83b3b9a
--- /dev/null
+++ b/tests/ui/not-panic/not-panic-safe-2.stderr
@@ -0,0 +1,34 @@
+error[E0277]: the type `UnsafeCell<i32>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary
+  --> $DIR/not-panic-safe-2.rs:10:14
+   |
+LL |     assert::<Rc<RefCell<i32>>>();
+   |              ^^^^^^^^^^^^^^^^ `UnsafeCell<i32>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary
+   |
+   = help: within `RefCell<i32>`, the trait `RefUnwindSafe` is not implemented for `UnsafeCell<i32>`
+   = note: required because it appears within the type `RefCell<i32>`
+   = note: required for `Rc<RefCell<i32>>` to implement `UnwindSafe`
+note: required by a bound in `assert`
+  --> $DIR/not-panic-safe-2.rs:7:14
+   |
+LL | fn assert<T: UnwindSafe + ?Sized>() {}
+   |              ^^^^^^^^^^ required by this bound in `assert`
+
+error[E0277]: the type `UnsafeCell<isize>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary
+  --> $DIR/not-panic-safe-2.rs:10:14
+   |
+LL |     assert::<Rc<RefCell<i32>>>();
+   |              ^^^^^^^^^^^^^^^^ `UnsafeCell<isize>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary
+   |
+   = help: within `RefCell<i32>`, the trait `RefUnwindSafe` is not implemented for `UnsafeCell<isize>`
+   = note: required because it appears within the type `Cell<isize>`
+   = note: required because it appears within the type `RefCell<i32>`
+   = note: required for `Rc<RefCell<i32>>` to implement `UnwindSafe`
+note: required by a bound in `assert`
+  --> $DIR/not-panic-safe-2.rs:7:14
+   |
+LL | fn assert<T: UnwindSafe + ?Sized>() {}
+   |              ^^^^^^^^^^ required by this bound in `assert`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/not-panic/not-panic-safe-3.rs b/tests/ui/not-panic/not-panic-safe-3.rs
new file mode 100644
index 00000000000..21f0c099312
--- /dev/null
+++ b/tests/ui/not-panic/not-panic-safe-3.rs
@@ -0,0 +1,13 @@
+#![allow(dead_code)]
+
+use std::panic::UnwindSafe;
+use std::sync::Arc;
+use std::cell::RefCell;
+
+fn assert<T: UnwindSafe + ?Sized>() {}
+
+fn main() {
+    assert::<Arc<RefCell<i32>>>();
+    //~^ ERROR the type `UnsafeCell<i32>` may contain interior mutability and a
+    //~| ERROR the type `UnsafeCell<isize>` may contain interior mutability and a
+}
diff --git a/tests/ui/not-panic/not-panic-safe-3.stderr b/tests/ui/not-panic/not-panic-safe-3.stderr
new file mode 100644
index 00000000000..9e9a12764a4
--- /dev/null
+++ b/tests/ui/not-panic/not-panic-safe-3.stderr
@@ -0,0 +1,34 @@
+error[E0277]: the type `UnsafeCell<i32>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary
+  --> $DIR/not-panic-safe-3.rs:10:14
+   |
+LL |     assert::<Arc<RefCell<i32>>>();
+   |              ^^^^^^^^^^^^^^^^^ `UnsafeCell<i32>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary
+   |
+   = help: within `RefCell<i32>`, the trait `RefUnwindSafe` is not implemented for `UnsafeCell<i32>`
+   = note: required because it appears within the type `RefCell<i32>`
+   = note: required for `Arc<RefCell<i32>>` to implement `UnwindSafe`
+note: required by a bound in `assert`
+  --> $DIR/not-panic-safe-3.rs:7:14
+   |
+LL | fn assert<T: UnwindSafe + ?Sized>() {}
+   |              ^^^^^^^^^^ required by this bound in `assert`
+
+error[E0277]: the type `UnsafeCell<isize>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary
+  --> $DIR/not-panic-safe-3.rs:10:14
+   |
+LL |     assert::<Arc<RefCell<i32>>>();
+   |              ^^^^^^^^^^^^^^^^^ `UnsafeCell<isize>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary
+   |
+   = help: within `RefCell<i32>`, the trait `RefUnwindSafe` is not implemented for `UnsafeCell<isize>`
+   = note: required because it appears within the type `Cell<isize>`
+   = note: required because it appears within the type `RefCell<i32>`
+   = note: required for `Arc<RefCell<i32>>` to implement `UnwindSafe`
+note: required by a bound in `assert`
+  --> $DIR/not-panic-safe-3.rs:7:14
+   |
+LL | fn assert<T: UnwindSafe + ?Sized>() {}
+   |              ^^^^^^^^^^ required by this bound in `assert`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/not-panic/not-panic-safe-4.rs b/tests/ui/not-panic/not-panic-safe-4.rs
new file mode 100644
index 00000000000..ba93af5c0aa
--- /dev/null
+++ b/tests/ui/not-panic/not-panic-safe-4.rs
@@ -0,0 +1,12 @@
+#![allow(dead_code)]
+
+use std::panic::UnwindSafe;
+use std::cell::RefCell;
+
+fn assert<T: UnwindSafe + ?Sized>() {}
+
+fn main() {
+    assert::<&RefCell<i32>>();
+    //~^ ERROR the type `UnsafeCell<i32>` may contain interior mutability and a
+    //~| ERROR the type `UnsafeCell<isize>` may contain interior mutability and a
+}
diff --git a/tests/ui/not-panic/not-panic-safe-4.stderr b/tests/ui/not-panic/not-panic-safe-4.stderr
new file mode 100644
index 00000000000..fc1c594d0d4
--- /dev/null
+++ b/tests/ui/not-panic/not-panic-safe-4.stderr
@@ -0,0 +1,34 @@
+error[E0277]: the type `UnsafeCell<i32>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary
+  --> $DIR/not-panic-safe-4.rs:9:14
+   |
+LL |     assert::<&RefCell<i32>>();
+   |              ^^^^^^^^^^^^^ `UnsafeCell<i32>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary
+   |
+   = help: within `RefCell<i32>`, the trait `RefUnwindSafe` is not implemented for `UnsafeCell<i32>`
+   = note: required because it appears within the type `RefCell<i32>`
+   = note: required for `&RefCell<i32>` to implement `UnwindSafe`
+note: required by a bound in `assert`
+  --> $DIR/not-panic-safe-4.rs:6:14
+   |
+LL | fn assert<T: UnwindSafe + ?Sized>() {}
+   |              ^^^^^^^^^^ required by this bound in `assert`
+
+error[E0277]: the type `UnsafeCell<isize>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary
+  --> $DIR/not-panic-safe-4.rs:9:14
+   |
+LL |     assert::<&RefCell<i32>>();
+   |              ^^^^^^^^^^^^^ `UnsafeCell<isize>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary
+   |
+   = help: within `RefCell<i32>`, the trait `RefUnwindSafe` is not implemented for `UnsafeCell<isize>`
+   = note: required because it appears within the type `Cell<isize>`
+   = note: required because it appears within the type `RefCell<i32>`
+   = note: required for `&RefCell<i32>` to implement `UnwindSafe`
+note: required by a bound in `assert`
+  --> $DIR/not-panic-safe-4.rs:6:14
+   |
+LL | fn assert<T: UnwindSafe + ?Sized>() {}
+   |              ^^^^^^^^^^ required by this bound in `assert`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/not-panic/not-panic-safe-5.rs b/tests/ui/not-panic/not-panic-safe-5.rs
new file mode 100644
index 00000000000..e0d37517dd4
--- /dev/null
+++ b/tests/ui/not-panic/not-panic-safe-5.rs
@@ -0,0 +1,10 @@
+#![allow(dead_code)]
+
+use std::panic::UnwindSafe;
+use std::cell::UnsafeCell;
+
+fn assert<T: UnwindSafe + ?Sized>() {}
+
+fn main() {
+    assert::<*const UnsafeCell<i32>>(); //~ ERROR E0277
+}
diff --git a/tests/ui/not-panic/not-panic-safe-5.stderr b/tests/ui/not-panic/not-panic-safe-5.stderr
new file mode 100644
index 00000000000..cb78370b48a
--- /dev/null
+++ b/tests/ui/not-panic/not-panic-safe-5.stderr
@@ -0,0 +1,17 @@
+error[E0277]: the type `UnsafeCell<i32>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary
+  --> $DIR/not-panic-safe-5.rs:9:14
+   |
+LL |     assert::<*const UnsafeCell<i32>>();
+   |              ^^^^^^^^^^^^^^^^^^^^^^ `UnsafeCell<i32>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary
+   |
+   = help: the trait `RefUnwindSafe` is not implemented for `UnsafeCell<i32>`
+   = note: required for `*const UnsafeCell<i32>` to implement `UnwindSafe`
+note: required by a bound in `assert`
+  --> $DIR/not-panic-safe-5.rs:6:14
+   |
+LL | fn assert<T: UnwindSafe + ?Sized>() {}
+   |              ^^^^^^^^^^ required by this bound in `assert`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/not-panic/not-panic-safe-6.rs b/tests/ui/not-panic/not-panic-safe-6.rs
new file mode 100644
index 00000000000..4915096dc3b
--- /dev/null
+++ b/tests/ui/not-panic/not-panic-safe-6.rs
@@ -0,0 +1,12 @@
+#![allow(dead_code)]
+
+use std::panic::UnwindSafe;
+use std::cell::RefCell;
+
+fn assert<T: UnwindSafe + ?Sized>() {}
+
+fn main() {
+    assert::<*mut RefCell<i32>>();
+    //~^ ERROR the type `UnsafeCell<i32>` may contain interior mutability and a
+    //~| ERROR the type `UnsafeCell<isize>` may contain interior mutability and a
+}
diff --git a/tests/ui/not-panic/not-panic-safe-6.stderr b/tests/ui/not-panic/not-panic-safe-6.stderr
new file mode 100644
index 00000000000..7986e341eb0
--- /dev/null
+++ b/tests/ui/not-panic/not-panic-safe-6.stderr
@@ -0,0 +1,34 @@
+error[E0277]: the type `UnsafeCell<i32>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary
+  --> $DIR/not-panic-safe-6.rs:9:14
+   |
+LL |     assert::<*mut RefCell<i32>>();
+   |              ^^^^^^^^^^^^^^^^^ `UnsafeCell<i32>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary
+   |
+   = help: within `RefCell<i32>`, the trait `RefUnwindSafe` is not implemented for `UnsafeCell<i32>`
+   = note: required because it appears within the type `RefCell<i32>`
+   = note: required for `*mut RefCell<i32>` to implement `UnwindSafe`
+note: required by a bound in `assert`
+  --> $DIR/not-panic-safe-6.rs:6:14
+   |
+LL | fn assert<T: UnwindSafe + ?Sized>() {}
+   |              ^^^^^^^^^^ required by this bound in `assert`
+
+error[E0277]: the type `UnsafeCell<isize>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary
+  --> $DIR/not-panic-safe-6.rs:9:14
+   |
+LL |     assert::<*mut RefCell<i32>>();
+   |              ^^^^^^^^^^^^^^^^^ `UnsafeCell<isize>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary
+   |
+   = help: within `RefCell<i32>`, the trait `RefUnwindSafe` is not implemented for `UnsafeCell<isize>`
+   = note: required because it appears within the type `Cell<isize>`
+   = note: required because it appears within the type `RefCell<i32>`
+   = note: required for `*mut RefCell<i32>` to implement `UnwindSafe`
+note: required by a bound in `assert`
+  --> $DIR/not-panic-safe-6.rs:6:14
+   |
+LL | fn assert<T: UnwindSafe + ?Sized>() {}
+   |              ^^^^^^^^^^ required by this bound in `assert`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/not-panic/not-panic-safe.rs b/tests/ui/not-panic/not-panic-safe.rs
new file mode 100644
index 00000000000..4165c5dc13a
--- /dev/null
+++ b/tests/ui/not-panic/not-panic-safe.rs
@@ -0,0 +1,10 @@
+#![allow(dead_code)]
+
+use std::panic::UnwindSafe;
+
+fn assert<T: UnwindSafe + ?Sized>() {}
+
+fn main() {
+    assert::<&mut i32>();
+    //~^ ERROR the type `&mut i32` may not be safely transferred across an unwind boundary
+}
diff --git a/tests/ui/not-panic/not-panic-safe.stderr b/tests/ui/not-panic/not-panic-safe.stderr
new file mode 100644
index 00000000000..2cd51a43998
--- /dev/null
+++ b/tests/ui/not-panic/not-panic-safe.stderr
@@ -0,0 +1,20 @@
+error[E0277]: the type `&mut i32` may not be safely transferred across an unwind boundary
+  --> $DIR/not-panic-safe.rs:8:14
+   |
+LL |     assert::<&mut i32>();
+   |              -^^^^^^^
+   |              |
+   |              `&mut i32` may not be safely transferred across an unwind boundary
+   |              help: consider removing the leading `&`-reference
+   |
+   = help: the trait `UnwindSafe` is not implemented for `&mut i32`
+   = note: `UnwindSafe` is implemented for `&i32`, but not for `&mut i32`
+note: required by a bound in `assert`
+  --> $DIR/not-panic-safe.rs:5:14
+   |
+LL | fn assert<T: UnwindSafe + ?Sized>() {}
+   |              ^^^^^^^^^^ required by this bound in `assert`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.