diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:18:58 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:18:58 +0000 |
commit | a4b7ed7a42c716ab9f05e351f003d589124fd55d (patch) | |
tree | b620cd3f223850b28716e474e80c58059dca5dd4 /tests/ui/not-panic | |
parent | Adding upstream version 1.67.1+dfsg1. (diff) | |
download | rustc-a4b7ed7a42c716ab9f05e351f003d589124fd55d.tar.xz rustc-a4b7ed7a42c716ab9f05e351f003d589124fd55d.zip |
Adding upstream version 1.68.2+dfsg1.upstream/1.68.2+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/ui/not-panic')
-rw-r--r-- | tests/ui/not-panic/not-panic-safe-2.rs | 13 | ||||
-rw-r--r-- | tests/ui/not-panic/not-panic-safe-2.stderr | 34 | ||||
-rw-r--r-- | tests/ui/not-panic/not-panic-safe-3.rs | 13 | ||||
-rw-r--r-- | tests/ui/not-panic/not-panic-safe-3.stderr | 34 | ||||
-rw-r--r-- | tests/ui/not-panic/not-panic-safe-4.rs | 12 | ||||
-rw-r--r-- | tests/ui/not-panic/not-panic-safe-4.stderr | 44 | ||||
-rw-r--r-- | tests/ui/not-panic/not-panic-safe-5.rs | 10 | ||||
-rw-r--r-- | tests/ui/not-panic/not-panic-safe-5.stderr | 17 | ||||
-rw-r--r-- | tests/ui/not-panic/not-panic-safe-6.rs | 12 | ||||
-rw-r--r-- | tests/ui/not-panic/not-panic-safe-6.stderr | 34 | ||||
-rw-r--r-- | tests/ui/not-panic/not-panic-safe.rs | 10 | ||||
-rw-r--r-- | tests/ui/not-panic/not-panic-safe.stderr | 22 |
12 files changed, 255 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 000000000..f3faa7043 --- /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 000000000..3b0f83b3b --- /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 000000000..21f0c0993 --- /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 000000000..9e9a12764 --- /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 000000000..ba93af5c0 --- /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 000000000..9428c1256 --- /dev/null +++ b/tests/ui/not-panic/not-panic-safe-4.stderr @@ -0,0 +1,44 @@ +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` +help: consider removing the leading `&`-reference + | +LL - assert::<&RefCell<i32>>(); +LL + assert::<RefCell<i32>>(); + | + +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` +help: consider removing the leading `&`-reference + | +LL - assert::<&RefCell<i32>>(); +LL + assert::<RefCell<i32>>(); + | + +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 000000000..e0d37517d --- /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 000000000..cb78370b4 --- /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 000000000..4915096dc --- /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 000000000..7986e341e --- /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 000000000..1b3c6482c --- /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 &mut &i32>(); + //~^ ERROR the type `&mut &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 000000000..37a6aee39 --- /dev/null +++ b/tests/ui/not-panic/not-panic-safe.stderr @@ -0,0 +1,22 @@ +error[E0277]: the type `&mut &mut &i32` may not be safely transferred across an unwind boundary + --> $DIR/not-panic-safe.rs:8:14 + | +LL | assert::<&mut &mut &i32>(); + | ^^^^^^^^^^^^^^ `&mut &mut &i32` may not be safely transferred across an unwind boundary + | + = help: the trait `UnwindSafe` is not implemented for `&mut &mut &i32` + = note: `UnwindSafe` is implemented for `&&mut &i32`, but not for `&mut &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` +help: consider removing 2 leading `&`-references + | +LL - assert::<&mut &mut &i32>(); +LL + assert::<&i32>(); + | + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. |