diff --git a/Cargo.lock b/Cargo.lock index 45cbf163..a13b7c38 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -138,10 +138,10 @@ dependencies = [ [[package]] name = "marine-macro" -version = "0.6.15" +version = "0.7.0" dependencies = [ - "marine-macro-impl 0.6.15", - "marine-rs-sdk-main 0.6.15", + "marine-macro-impl 0.7.0", + "marine-rs-sdk-main 0.7.0", ] [[package]] @@ -160,7 +160,7 @@ dependencies = [ [[package]] name = "marine-macro-impl" -version = "0.6.15" +version = "0.7.0" dependencies = [ "marine-macro-testing-utils", "pretty_assertions", @@ -183,10 +183,10 @@ dependencies = [ [[package]] name = "marine-rs-sdk" -version = "0.6.15" +version = "0.7.0" dependencies = [ - "marine-macro 0.6.15", - "marine-rs-sdk-main 0.6.15", + "marine-macro 0.7.0", + "marine-rs-sdk-main 0.7.0", "marine-timestamp-macro", "polyplets", "serde", @@ -206,7 +206,7 @@ dependencies = [ [[package]] name = "marine-rs-sdk-main" -version = "0.6.15" +version = "0.7.0" dependencies = [ "lazy_static", "log", @@ -216,7 +216,7 @@ dependencies = [ [[package]] name = "marine-timestamp-macro" -version = "0.6.15" +version = "0.7.0" dependencies = [ "chrono", "quote", diff --git a/Cargo.toml b/Cargo.toml index 9acbfa4e..2c359b93 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "marine-rs-sdk" -version = "0.6.15" # remember to update html_root_url +version = "0.7.0" # remember to update html_root_url description = "Fluence backend SDK for developing backend applications for the Fluence network" documentation = "https://docs.rs/fluence" repository = "https://github.com/fluencelabs/marine-rs-sdk" @@ -18,10 +18,10 @@ path = "src/lib.rs" doctest = false [dependencies] -marine-macro = { path = "crates/marine-macro", version = "=0.6.15" } -marine-rs-sdk-main = { path = "crates/main", version = "=0.6.15" } -marine-timestamp-macro = { path = "crates/timestamp-macro", version = "=0.6.15" } -polyplets = "0.2.0" +marine-macro = { path = "crates/marine-macro", version = "=0.7.0" } +marine-rs-sdk-main = { path = "crates/main", version = "=0.7.0" } +marine-timestamp-macro = { path = "crates/timestamp-macro", version = "=0.7.0" } +polyplets = "0.3.0" serde = { version = "1.0.118", features = ["derive"]} @@ -35,6 +35,9 @@ debug = ["marine-rs-sdk-main/debug"] # Enable logger (this will cause log_utf8_string to appear in imports) logger = ["marine-rs-sdk-main/logger"] +# Remove _initialize function with explicit call to __wasm_call_ctors +no-explicit-ctors-call = [] + [workspace] members = [ "crates/main", diff --git a/crates/main/Cargo.toml b/crates/main/Cargo.toml index b0da7be8..434e64b9 100644 --- a/crates/main/Cargo.toml +++ b/crates/main/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "marine-rs-sdk-main" -version = "0.6.15" # remember to update html_root_url +version = "0.7.0" # remember to update html_root_url edition = "2018" description = "Contains logger, allocators and several other modules for marine-rs-sdk" documentation = "https://docs.rs/marine-rs-sdk-main" diff --git a/crates/main/src/lib.rs b/crates/main/src/lib.rs index 79167dcf..8240953e 100644 --- a/crates/main/src/lib.rs +++ b/crates/main/src/lib.rs @@ -19,7 +19,7 @@ #![allow(clippy::missing_safety_doc)] #![allow(clippy::needless_doctest_main)] -#![doc(html_root_url = "https://docs.rs/marine-rs-sdk-main/0.6.15")] +#![doc(html_root_url = "https://docs.rs/marine-rs-sdk-main/0.7.0")] #![deny( dead_code, nonstandard_style, diff --git a/crates/marine-macro-impl/Cargo.toml b/crates/marine-macro-impl/Cargo.toml index cc153948..1e51bd5f 100644 --- a/crates/marine-macro-impl/Cargo.toml +++ b/crates/marine-macro-impl/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "marine-macro-impl" -version = "0.6.15" # remember to update html_root_url +version = "0.7.0" # remember to update html_root_url edition = "2018" description = "Implementation of the `#[marine]` macro" documentation = "https://docs.rs/fluence/marine-macro-impl" diff --git a/crates/marine-macro-impl/src/lib.rs b/crates/marine-macro-impl/src/lib.rs index 379e664b..398b2f05 100644 --- a/crates/marine-macro-impl/src/lib.rs +++ b/crates/marine-macro-impl/src/lib.rs @@ -14,7 +14,7 @@ * limitations under the License. */ -#![doc(html_root_url = "https://docs.rs/marine-macro-impl/0.6.15")] +#![doc(html_root_url = "https://docs.rs/marine-macro-impl/0.7.0")] #![deny( dead_code, nonstandard_style, diff --git a/crates/marine-macro/Cargo.toml b/crates/marine-macro/Cargo.toml index c48ca639..59c56d3e 100644 --- a/crates/marine-macro/Cargo.toml +++ b/crates/marine-macro/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "marine-macro" -version = "0.6.15" # remember to update html_root_url +version = "0.7.0" # remember to update html_root_url edition = "2018" description = "Definition of the `#[marine]` macro" documentation = "https://docs.rs/fluence/marine-macro" @@ -18,5 +18,5 @@ proc-macro = true doctest = false [dependencies] -marine-macro-impl = { path = "../marine-macro-impl", version = "=0.6.15" } -marine-rs-sdk-main = { path = "../main", version = "=0.6.15" } +marine-macro-impl = { path = "../marine-macro-impl", version = "=0.7.0" } +marine-rs-sdk-main = { path = "../main", version = "=0.7.0" } diff --git a/crates/marine-macro/src/lib.rs b/crates/marine-macro/src/lib.rs index 8f4c5b8e..c8b0f1b3 100644 --- a/crates/marine-macro/src/lib.rs +++ b/crates/marine-macro/src/lib.rs @@ -50,7 +50,7 @@ //! //! ``` -#![doc(html_root_url = "https://docs.rs/marine-macro/0.6.15")] +#![doc(html_root_url = "https://docs.rs/marine-macro/0.7.0")] #![deny( dead_code, nonstandard_style, diff --git a/crates/timestamp-macro/Cargo.toml b/crates/timestamp-macro/Cargo.toml index 462221c2..4c4c8af6 100644 --- a/crates/timestamp-macro/Cargo.toml +++ b/crates/timestamp-macro/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "marine-timestamp-macro" -version = "0.6.15" # remember to update html_root_url +version = "0.7.0" # remember to update html_root_url edition = "2018" description = "Definition of the `#[build_timestamp]` macro" documentation = "https://docs.rs/fluence/marine-timestamp-macro" diff --git a/src/lib.rs b/src/lib.rs index 86251a25..984d718a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -55,7 +55,7 @@ //! pub fn curl_get(url: String) -> String; //! } //! ``` -#![doc(html_root_url = "https://docs.rs/sdk/0.6.15")] +#![doc(html_root_url = "https://docs.rs/sdk/0.7.0")] #![deny( dead_code, nonstandard_style, @@ -103,3 +103,25 @@ pub mod internal { pub use marine_rs_sdk_main::add_object_to_release; pub use marine_timestamp_macro::build_timestamp; } + +#[cfg(not(feature = "no-explicit-ctors-call"))] +#[cfg(target_arch = "wasm32")] +#[doc(hidden)] +extern "C" { + // For internal use. Not an API function. + fn __wasm_call_ctors(); +} + +/// Adds an explicit __wasm_call_ctors call to tell LLVM not to +/// wrap every export in __wasm_call_ctors/__wasm_call_dtors calls. +/// The most referenced issue about it is https://github.com/WebAssembly/WASI/issues/471 +/// For internal use. Not an API function. +#[cfg(not(feature = "no-explicit-ctors-call"))] +#[cfg(target_arch = "wasm32")] +#[doc(hidden)] +#[no_mangle] +pub fn _initialize() { + unsafe { + __wasm_call_ctors(); + } +} diff --git a/tests/compilation_tests/export_functions/array_inner_refs.stderr b/tests/compilation_tests/export_functions/array_inner_refs.stderr index 76e4aeea..b3343310 100644 --- a/tests/compilation_tests/export_functions/array_inner_refs.stderr +++ b/tests/compilation_tests/export_functions/array_inner_refs.stderr @@ -2,28 +2,28 @@ error: a vector type in arguments of export functions shouldn't contain referenc --> $DIR/array_inner_refs.rs:13:23 | 13 | pub fn inner_arrays_1(_arg: Vec<&Vec>>>) -> Vec>>> { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^ error: a vector type in arguments of export functions shouldn't contain references --> $DIR/array_inner_refs.rs:18:23 | 18 | pub fn inner_arrays_2(_arg: Vec>>>) -> Vec>>> { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^ error: a vector type in arguments of export functions shouldn't contain references --> $DIR/array_inner_refs.rs:23:23 | 23 | pub fn inner_arrays_3(_arg: Vec>>>) -> Vec>>> { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^ error: a vector type in arguments of export functions shouldn't contain references --> $DIR/array_inner_refs.rs:28:23 | 28 | pub fn inner_arrays_4(_arg: Vec>>>) -> Vec>>> { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^ error: a vector type in arguments of export functions shouldn't contain references --> $DIR/array_inner_refs.rs:33:35 | 33 | pub fn inner_arrays_5(_arg1: i32, _arg2: Vec>>>, _arg3: i32) -> Vec>>> { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^ diff --git a/tests/compilation_tests/export_functions/improper_types.stderr b/tests/compilation_tests/export_functions/improper_types.stderr index 757423b0..23593384 100644 --- a/tests/compilation_tests/export_functions/improper_types.stderr +++ b/tests/compilation_tests/export_functions/improper_types.stderr @@ -2,19 +2,19 @@ error: types with lifetimes or generics aren't allowed --> $DIR/improper_types.rs:8:17 | 8 | fn test(_arg_1: Box) {} - | ^^^^^^^^ + | ^^^ error: types with lifetimes or generics aren't allowed --> $DIR/improper_types.rs:11:27 | 11 | fn test2(_arg_1: std::rc::Rc) {} - | ^^^^^^^ + | ^^ error: types with lifetimes or generics aren't allowed --> $DIR/improper_types.rs:14:36 | 14 | fn test3(_arg_1: std::collections::HashMap) {} - | ^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^ error: Incorrect argument type, only path or reference are available on this position --> $DIR/improper_types.rs:17:26 @@ -26,4 +26,4 @@ error: types with lifetimes or generics aren't allowed --> $DIR/improper_types.rs:22:26 | 22 | fn test5(_arg_1: i32) -> Box { - | ^^^^^^^^ + | ^^^ diff --git a/tests/compilation_tests/export_functions/inner_vec_refs.stderr b/tests/compilation_tests/export_functions/inner_vec_refs.stderr index b5f773c5..c5123554 100644 --- a/tests/compilation_tests/export_functions/inner_vec_refs.stderr +++ b/tests/compilation_tests/export_functions/inner_vec_refs.stderr @@ -2,10 +2,10 @@ error: a vector type in output types of export functions shouldn't contain refer --> $DIR/inner_vec_refs.rs:8:54 | 8 | pub fn inner_arrays_2(_arg: &Vec>>>) -> &Vec>>> { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^ error: a vector type in output types of export functions shouldn't contain references --> $DIR/inner_vec_refs.rs:13:54 | 13 | pub fn inner_arrays_3(_arg: &Vec>>>) -> &Vec<&Vec<&Vec<&Vec<&u8>>>> { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^ diff --git a/tests/compilation_tests/import_functions/arrays_out_inner_refs.stderr b/tests/compilation_tests/import_functions/arrays_out_inner_refs.stderr index 59a635e9..a019d91d 100644 --- a/tests/compilation_tests/import_functions/arrays_out_inner_refs.stderr +++ b/tests/compilation_tests/import_functions/arrays_out_inner_refs.stderr @@ -1,6 +1,5 @@ error: import function can't return a value with references --> $DIR/arrays_out_inner_refs.rs:10:5 | -10 | / #[marine] -11 | | pub fn func_1() -> &String; - | |_______________________________^ +10 | #[marine] + | ^ diff --git a/tests/compilation_tests/import_functions/improper_types.stderr b/tests/compilation_tests/import_functions/improper_types.stderr index af4f71d8..0f53f662 100644 --- a/tests/compilation_tests/import_functions/improper_types.stderr +++ b/tests/compilation_tests/import_functions/improper_types.stderr @@ -2,4 +2,4 @@ error: types with lifetimes or generics aren't allowed --> $DIR/improper_types.rs:11:21 | 11 | fn test(_arg_1: Box); - | ^^^^^^^^ + | ^^^ diff --git a/tests/compilation_tests/records/struct_with_improper_types.stderr b/tests/compilation_tests/records/struct_with_improper_types.stderr index 4b519f77..b0dad2c5 100644 --- a/tests/compilation_tests/records/struct_with_improper_types.stderr +++ b/tests/compilation_tests/records/struct_with_improper_types.stderr @@ -2,16 +2,16 @@ error: types with lifetimes or generics aren't allowed --> $DIR/struct_with_improper_types.rs:7:12 | 7 | pub a: Box, - | ^^^^^^^^ + | ^^^ error: types with lifetimes or generics aren't allowed --> $DIR/struct_with_improper_types.rs:12:21 | 12 | pub a: std::rc::Rc, - | ^^^^^^^ + | ^^ error: types with lifetimes or generics aren't allowed --> $DIR/struct_with_improper_types.rs:17:30 | 17 | pub a: std::collections::HashMap, - | ^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^ diff --git a/tests/compilation_tests/records/unnamed_structs.stderr b/tests/compilation_tests/records/unnamed_structs.stderr index c219748b..a43ef8b4 100644 --- a/tests/compilation_tests/records/unnamed_structs.stderr +++ b/tests/compilation_tests/records/unnamed_structs.stderr @@ -2,4 +2,4 @@ error: only named fields are allowed in structs --> $DIR/unnamed_structs.rs:8:1 | 8 | struct A(pub i32, pub u32); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^