Extract null check throw to a separate function

Slightly smaller callsite!
This commit is contained in:
Alex Crichton 2017-12-21 12:25:13 -08:00
parent 6aacff6a80
commit 44a9555313

View File

@ -55,6 +55,7 @@ impl Drop for JsObject {
}
#[cold]
#[inline(never)]
pub fn throw(s: &str) -> ! {
extern {
fn __wbindgen_throw(a: *const u8, b: usize) -> !;
@ -72,10 +73,16 @@ pub mod __rt {
#[inline]
pub fn assert_not_null<T>(s: *mut T) {
if s.is_null() {
super::throw("null pointer passed to rust");
throw_null();
}
}
#[cold]
#[inline(never)]
fn throw_null() -> ! {
super::throw("null pointer passed to rust");
}
/// A vendored version of `RefCell` from the standard library.
///
/// Now why, you may ask, would we do that? Surely `RefCell` in libstd is