about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2021-07-18 20:33:23 +0000
committerbors <bors@rust-lang.org>2021-07-18 20:33:23 +0000
commit59216858a323978a97593cba22b5ed84350a3783 (patch)
treeaefe5dbab6851fbb1cbc03f28cc4495531e5909e /src
parent331da5820cfeb937dcdd76192d97a5fc4dd115c8 (diff)
parentf612ba1f846c0e9ee16b0f19dd7a3719d1dddd4b (diff)
downloadrust-59216858a323978a97593cba22b5ed84350a3783.tar.gz
rust-59216858a323978a97593cba22b5ed84350a3783.zip
Auto merge of #86950 - tmiasko:personality, r=nagisa
Use existing declaration of rust_eh_personality

If crate declares `rust_eh_personality`, re-use existing declaration
as otherwise attempts to set function attributes that follow the
declaration will fail (unless it happens to have exactly the same
type signature as the one predefined in the compiler).

Fixes #70117.
Fixes https://github.com/rust-lang/rust/pull/81469#issuecomment-809428126; probably.
Diffstat (limited to 'src')
-rw-r--r--src/test/ui/panic-runtime/incompatible-type.rs24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/test/ui/panic-runtime/incompatible-type.rs b/src/test/ui/panic-runtime/incompatible-type.rs
new file mode 100644
index 00000000000..026364a2058
--- /dev/null
+++ b/src/test/ui/panic-runtime/incompatible-type.rs
@@ -0,0 +1,24 @@
+// Check that rust_eh_personality can have a different type signature than the
+// one hardcoded in the compiler.  Regression test for #70117. Used to fail with:
+//
+// Assertion `isa<X>(Val) && "cast<Ty>() argument of incompatible type!"' failed.
+//
+// build-pass
+// compile-flags: --crate-type=lib -Ccodegen-units=1
+#![no_std]
+#![panic_runtime]
+#![feature(panic_runtime)]
+#![feature(rustc_attrs)]
+
+pub struct DropMe;
+
+impl Drop for DropMe {
+    fn drop(&mut self) {}
+}
+
+pub fn test(_: DropMe) {
+    unreachable!();
+}
+
+#[rustc_std_internal_symbol]
+pub unsafe extern "C" fn rust_eh_personality() {}