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
15 lines
491 B
Rust
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());
|
|
}
|