From 64d98f8ee037282c35007b64c2649055c56af1db Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:19:03 +0200 Subject: Merging upstream version 1.68.2+dfsg1. Signed-off-by: Daniel Baumann --- tests/ui/not-panic/not-panic-safe-2.rs | 13 +++++++++ tests/ui/not-panic/not-panic-safe-2.stderr | 34 +++++++++++++++++++++++ tests/ui/not-panic/not-panic-safe-3.rs | 13 +++++++++ tests/ui/not-panic/not-panic-safe-3.stderr | 34 +++++++++++++++++++++++ tests/ui/not-panic/not-panic-safe-4.rs | 12 ++++++++ tests/ui/not-panic/not-panic-safe-4.stderr | 44 ++++++++++++++++++++++++++++++ tests/ui/not-panic/not-panic-safe-5.rs | 10 +++++++ tests/ui/not-panic/not-panic-safe-5.stderr | 17 ++++++++++++ tests/ui/not-panic/not-panic-safe-6.rs | 12 ++++++++ tests/ui/not-panic/not-panic-safe-6.stderr | 34 +++++++++++++++++++++++ tests/ui/not-panic/not-panic-safe.rs | 10 +++++++ tests/ui/not-panic/not-panic-safe.stderr | 22 +++++++++++++++ 12 files changed, 255 insertions(+) create mode 100644 tests/ui/not-panic/not-panic-safe-2.rs create mode 100644 tests/ui/not-panic/not-panic-safe-2.stderr create mode 100644 tests/ui/not-panic/not-panic-safe-3.rs create mode 100644 tests/ui/not-panic/not-panic-safe-3.stderr create mode 100644 tests/ui/not-panic/not-panic-safe-4.rs create mode 100644 tests/ui/not-panic/not-panic-safe-4.stderr create mode 100644 tests/ui/not-panic/not-panic-safe-5.rs create mode 100644 tests/ui/not-panic/not-panic-safe-5.stderr create mode 100644 tests/ui/not-panic/not-panic-safe-6.rs create mode 100644 tests/ui/not-panic/not-panic-safe-6.stderr create mode 100644 tests/ui/not-panic/not-panic-safe.rs create mode 100644 tests/ui/not-panic/not-panic-safe.stderr (limited to 'tests/ui/not-panic') 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() {} + +fn main() { + assert::>>(); + //~^ ERROR the type `UnsafeCell` may contain interior mutability and a + //~| ERROR the type `UnsafeCell` 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` 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::>>(); + | ^^^^^^^^^^^^^^^^ `UnsafeCell` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary + | + = help: within `RefCell`, the trait `RefUnwindSafe` is not implemented for `UnsafeCell` + = note: required because it appears within the type `RefCell` + = note: required for `Rc>` to implement `UnwindSafe` +note: required by a bound in `assert` + --> $DIR/not-panic-safe-2.rs:7:14 + | +LL | fn assert() {} + | ^^^^^^^^^^ required by this bound in `assert` + +error[E0277]: the type `UnsafeCell` 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::>>(); + | ^^^^^^^^^^^^^^^^ `UnsafeCell` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary + | + = help: within `RefCell`, the trait `RefUnwindSafe` is not implemented for `UnsafeCell` + = note: required because it appears within the type `Cell` + = note: required because it appears within the type `RefCell` + = note: required for `Rc>` to implement `UnwindSafe` +note: required by a bound in `assert` + --> $DIR/not-panic-safe-2.rs:7:14 + | +LL | fn assert() {} + | ^^^^^^^^^^ 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() {} + +fn main() { + assert::>>(); + //~^ ERROR the type `UnsafeCell` may contain interior mutability and a + //~| ERROR the type `UnsafeCell` 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` 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::>>(); + | ^^^^^^^^^^^^^^^^^ `UnsafeCell` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary + | + = help: within `RefCell`, the trait `RefUnwindSafe` is not implemented for `UnsafeCell` + = note: required because it appears within the type `RefCell` + = note: required for `Arc>` to implement `UnwindSafe` +note: required by a bound in `assert` + --> $DIR/not-panic-safe-3.rs:7:14 + | +LL | fn assert() {} + | ^^^^^^^^^^ required by this bound in `assert` + +error[E0277]: the type `UnsafeCell` 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::>>(); + | ^^^^^^^^^^^^^^^^^ `UnsafeCell` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary + | + = help: within `RefCell`, the trait `RefUnwindSafe` is not implemented for `UnsafeCell` + = note: required because it appears within the type `Cell` + = note: required because it appears within the type `RefCell` + = note: required for `Arc>` to implement `UnwindSafe` +note: required by a bound in `assert` + --> $DIR/not-panic-safe-3.rs:7:14 + | +LL | fn assert() {} + | ^^^^^^^^^^ 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() {} + +fn main() { + assert::<&RefCell>(); + //~^ ERROR the type `UnsafeCell` may contain interior mutability and a + //~| ERROR the type `UnsafeCell` 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` 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>(); + | ^^^^^^^^^^^^^ `UnsafeCell` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary + | + = help: within `RefCell`, the trait `RefUnwindSafe` is not implemented for `UnsafeCell` + = note: required because it appears within the type `RefCell` + = note: required for `&RefCell` to implement `UnwindSafe` +note: required by a bound in `assert` + --> $DIR/not-panic-safe-4.rs:6:14 + | +LL | fn assert() {} + | ^^^^^^^^^^ required by this bound in `assert` +help: consider removing the leading `&`-reference + | +LL - assert::<&RefCell>(); +LL + assert::>(); + | + +error[E0277]: the type `UnsafeCell` 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>(); + | ^^^^^^^^^^^^^ `UnsafeCell` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary + | + = help: within `RefCell`, the trait `RefUnwindSafe` is not implemented for `UnsafeCell` + = note: required because it appears within the type `Cell` + = note: required because it appears within the type `RefCell` + = note: required for `&RefCell` to implement `UnwindSafe` +note: required by a bound in `assert` + --> $DIR/not-panic-safe-4.rs:6:14 + | +LL | fn assert() {} + | ^^^^^^^^^^ required by this bound in `assert` +help: consider removing the leading `&`-reference + | +LL - assert::<&RefCell>(); +LL + 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 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() {} + +fn main() { + assert::<*const UnsafeCell>(); //~ 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` 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>(); + | ^^^^^^^^^^^^^^^^^^^^^^ `UnsafeCell` 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` + = note: required for `*const UnsafeCell` to implement `UnwindSafe` +note: required by a bound in `assert` + --> $DIR/not-panic-safe-5.rs:6:14 + | +LL | fn assert() {} + | ^^^^^^^^^^ 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() {} + +fn main() { + assert::<*mut RefCell>(); + //~^ ERROR the type `UnsafeCell` may contain interior mutability and a + //~| ERROR the type `UnsafeCell` 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` 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>(); + | ^^^^^^^^^^^^^^^^^ `UnsafeCell` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary + | + = help: within `RefCell`, the trait `RefUnwindSafe` is not implemented for `UnsafeCell` + = note: required because it appears within the type `RefCell` + = note: required for `*mut RefCell` to implement `UnwindSafe` +note: required by a bound in `assert` + --> $DIR/not-panic-safe-6.rs:6:14 + | +LL | fn assert() {} + | ^^^^^^^^^^ required by this bound in `assert` + +error[E0277]: the type `UnsafeCell` 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>(); + | ^^^^^^^^^^^^^^^^^ `UnsafeCell` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary + | + = help: within `RefCell`, the trait `RefUnwindSafe` is not implemented for `UnsafeCell` + = note: required because it appears within the type `Cell` + = note: required because it appears within the type `RefCell` + = note: required for `*mut RefCell` to implement `UnwindSafe` +note: required by a bound in `assert` + --> $DIR/not-panic-safe-6.rs:6:14 + | +LL | fn assert() {} + | ^^^^^^^^^^ 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() {} + +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() {} + | ^^^^^^^^^^ 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`. -- cgit v1.2.3