Files
tubestation/toolkit/library/rust/lib.rs
Ted Mielczarek 5378f69273 bug 1300152 - Add nsIDebug2::rustPanic to allow triggering Rust panic for testing. r=froydnj
For testing purposes it will be useful to be able to trigger crashes in Rust
code. Being able to trigger a panic seems like a good place to start. This
will make it easier to validate improvements in crash reporting.

MozReview-Commit-ID: Bh5rBieLLWW
2016-09-02 13:22:21 -04:00

15 lines
491 B
Rust

// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
extern crate mp4parse_capi;
use std::ffi::CStr;
use std::os::raw::c_char;
/// Used to implement `nsIDebug2::RustPanic` for testing purposes.
#[no_mangle]
pub extern fn intentional_panic(message: *const c_char) {
panic!("{}", unsafe { CStr::from_ptr(message) }.to_string_lossy());
}