diff options
author | Matt Mastracci <matthew@mastracci.com> | 2023-07-01 18:00:14 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-02 00:00:14 +0000 |
commit | e746b6d80654ba4e4e26370fe6e4f784ce841d92 (patch) | |
tree | 153ffad92a96126b9ab8e906dcdabf7648755931 /core/examples/panik.rs | |
parent | b9c0e7cd550ab14fa7da7e33ed87cbeeeb9785a0 (diff) |
refactor(core): Extract deno_core (#19658)
`deno_core` is moving out! You'll find it at
https://github.com/denoland/deno_core/ once this PR lands.
Diffstat (limited to 'core/examples/panik.rs')
-rw-r--r-- | core/examples/panik.rs | 36 |
1 files changed, 0 insertions, 36 deletions
diff --git a/core/examples/panik.rs b/core/examples/panik.rs deleted file mode 100644 index 54b46d337..000000000 --- a/core/examples/panik.rs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license. -//! This example shows that op-panics currently result in UB (likely "failed to initiate panic") -//! without a custom panic hook that aborts the process or -C panic=abort. -//! -//! This happens due to the UB of panicking in an extern "C", -//! given how ops are reduced via rusty_v8::MapFnTo -//! See: -//! - https://github.com/rust-lang/rust/issues/74990 -//! - https://rust-lang.github.io/rfcs/2945-c-unwind-abi.html - -use deno_core::op; -use deno_core::Extension; -use deno_core::JsRuntime; -use deno_core::RuntimeOptions; - -// This is a hack to make the `#[op]` macro work with -// deno_core examples. -// You can remove this: -use deno_core::*; - -fn main() { - #[op] - fn op_panik() { - panic!("panik !!!") - } - - let extensions = vec![Extension::builder("my_ext") - .ops(vec![op_panik::decl()]) - .build()]; - let mut rt = JsRuntime::new(RuntimeOptions { - extensions, - ..Default::default() - }); - rt.execute_script_static("panik", "Deno.core.ops.op_panik()") - .unwrap(); -} |