From 1091eee65b91a9968f2a0b2f0c7d6e8e27d8d033 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Thu, 15 Nov 2018 06:17:58 -0800 Subject: rustc: Switch `extern` functions to abort by default on panic This was intended to land way back in 1.24, but it was backed out due to breakage which has long since been fixed. An unstable `#[unwind]` attribute can be used to tweak the behavior here, but this is currently simply switching rustc's internal default to abort-by-default if an `extern` function panics, making our codegen sound primarily (as currently you can produce UB with safe code) Closes #52652 --- src/test/codegen/nounwind-extern.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 src/test/codegen/nounwind-extern.rs (limited to 'src/test/codegen') diff --git a/src/test/codegen/nounwind-extern.rs b/src/test/codegen/nounwind-extern.rs new file mode 100644 index 00000000000..ed07cf1d6b2 --- /dev/null +++ b/src/test/codegen/nounwind-extern.rs @@ -0,0 +1,16 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// compile-flags: -O + +#![crate_type = "lib"] + +// CHECK: Function Attrs: norecurse nounwind +pub extern fn foo() {} -- cgit 1.4.1-3-g733a5