diff --git a/lib/ngx-wasm-rs/lib/backtrace/src/c_api.rs b/lib/ngx-wasm-rs/lib/backtrace/src/c_api.rs index 4f26f45be..812d3b03e 100644 --- a/lib/ngx-wasm-rs/lib/backtrace/src/c_api.rs +++ b/lib/ngx-wasm-rs/lib/backtrace/src/c_api.rs @@ -39,9 +39,10 @@ impl Drop for ngx_wasm_backtrace_name_table_t { fn vec_into_wasm_byte_vec_t(bv: *mut wasm_byte_vec_t, v: Vec) { unsafe { - let (ptr, len, _cap) = v.into_raw_parts(); - (*bv).size = len; - (*bv).data = ptr; + // FIXME Update this when vec_into_raw_parts is stabilized + let mut v = mem::ManuallyDrop::new(v); + (*bv).size = v.len(); + (*bv).data = v.as_mut_ptr(); } } @@ -63,22 +64,24 @@ pub unsafe extern "C" fn ngx_wasm_backtrace_get_name_table( let mut names = Vec::::with_capacity(table.len()); for (idx, name) in table.drain(..) { - let (bytes, len, _cap) = name.into_raw_parts(); + // FIXME Update this when vec_into_raw_parts is stabilized + let mut name = mem::ManuallyDrop::new(name); let name_t = ngx_wasm_backtrace_name_t { idx, name: Box::new(wasm_byte_vec_t { - size: len, - data: bytes, + size: name.len(), + data: name.as_mut_ptr(), }), }; names.push(name_t); } - let (bytes, len, _cap) = names.into_raw_parts(); + // FIXME Update this when vec_into_raw_parts is stabilized + let mut names = mem::ManuallyDrop::new(names); Some(Box::new(ngx_wasm_backtrace_name_table_t { - size: len, - table: bytes, + size: names.len(), + table: names.as_mut_ptr(), })) } else { None diff --git a/lib/ngx-wasm-rs/lib/backtrace/src/lib.rs b/lib/ngx-wasm-rs/lib/backtrace/src/lib.rs index e692a8848..9cb0a85c9 100644 --- a/lib/ngx-wasm-rs/lib/backtrace/src/lib.rs +++ b/lib/ngx-wasm-rs/lib/backtrace/src/lib.rs @@ -1,3 +1,2 @@ -#![feature(vec_into_raw_parts)] pub(crate) mod backtrace; pub mod c_api; diff --git a/lib/ngx-wasm-rs/lib/wat/src/lib.rs b/lib/ngx-wasm-rs/lib/wat/src/lib.rs index 460f9e123..91cdec419 100644 --- a/lib/ngx-wasm-rs/lib/wat/src/lib.rs +++ b/lib/ngx-wasm-rs/lib/wat/src/lib.rs @@ -1,4 +1,3 @@ -#![feature(vec_into_raw_parts)] use ngx_wasm_c_api::*; use regex::Regex; use std::mem; @@ -26,9 +25,10 @@ fn extract_message(err: &str) -> Option { fn vec_into_wasm_byte_vec_t(bv: *mut wasm_byte_vec_t, v: Vec) -> () { unsafe { - let (ptr, len, _cap) = v.into_raw_parts(); - (*bv).size = len; - (*bv).data = ptr; + // FIXME Update this when vec_into_raw_parts is stabilized + let mut v = mem::ManuallyDrop::new(v); + (*bv).size = v.len(); + (*bv).data = v.as_mut_ptr(); } } diff --git a/rust-toolchain b/rust-toolchain index bf867e0ae..2bf5ad044 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -1 +1 @@ -nightly +stable diff --git a/util/test.sh b/util/test.sh index 8712672ff..202f9fd8e 100755 --- a/util/test.sh +++ b/util/test.sh @@ -106,9 +106,14 @@ export RUSTFLAGS="$TEST_NGINX_CARGO_RUSTFLAGS" eval cargo build \ --lib \ "${args[@]}" \ - --target wasm32-wasi \ - --out-dir $DIR_TESTS_LIB_WASM \ - -Z unstable-options + --target wasm32-wasi + +if [ "$TEST_NGINX_CARGO_PROFILE" = release ]; then + cp target/wasm32-wasi/release/*.wasm $DIR_TESTS_LIB_WASM + +else + cp target/wasm32-wasi/debug/*.wasm $DIR_TESTS_LIB_WASM +fi if [ $(uname -s) = Linux ]; then export TEST_NGINX_EVENT_TYPE=epoll