diff --git a/Makefile b/Makefile index cf5e15fd53a..f64666f5a1b 100644 --- a/Makefile +++ b/Makefile @@ -229,10 +229,13 @@ test-packages: cargo test -p wasmer-wasi --release cargo test -p wasmer-object --release cargo test -p wasmer-engine-native --release --no-default-features + cargo test -p wasmer-engine-jit --release --no-default-features + cargo test -p wasmer-compiler --release cargo test -p wasmer-cli --release cargo test -p wasmer-cache --release cargo test -p wasmer-engine --release + # The test-capi rules depend on the build-capi rules to build the .a files to # link the tests against. cargo test doesn't know that the tests will be running test-capi: $(foreach compiler_engine,$(test_compilers_engines),test-capi-$(compiler_engine)) @@ -355,10 +358,26 @@ endif update-testsuite: git subtree pull --prefix tests/wast/spec https://github.com/WebAssembly/testsuite.git master --squash -RUSTFLAGS := "-D dead-code -D nonstandard-style -D unused-imports -D unused-mut -D unused-variables -D unused-unsafe -D unreachable-patterns -D bad-style -D improper-ctypes -D unused-allocation -D unused-comparisons -D while-true -D unconditional-recursion -D bare-trait-objects -D function_item_references" # TODO: add `-D missing-docs` -lint: +RUSTFLAGS := "-D dead-code -D nonstandard-style -D unused-imports -D unused-mut -D unused-variables -D unused-unsafe -D unreachable-patterns -D bad-style -D improper-ctypes -D unused-allocation -D unused-comparisons -D while-true -D unconditional-recursion -D bare-trait-objects" # TODO: add `-D missing-docs` # TODO: add `-D function_item_references` (not available on Rust 1.47, try when upgrading) +lint-packages: + RUSTFLAGS=${RUSTFLAGS} cargo clippy -p wasmer + RUSTFLAGS=${RUSTFLAGS} cargo clippy -p wasmer-vm + RUSTFLAGS=${RUSTFLAGS} cargo clippy -p wasmer-types + RUSTFLAGS=${RUSTFLAGS} cargo clippy -p wasmer-wasi + RUSTFLAGS=${RUSTFLAGS} cargo clippy -p wasmer-object + RUSTFLAGS=${RUSTFLAGS} cargo clippy -p wasmer-engine-native + RUSTFLAGS=${RUSTFLAGS} cargo clippy -p wasmer-engine-jit + RUSTFLAGS=${RUSTFLAGS} cargo clippy -p wasmer-compiler + RUSTFLAGS=${RUSTFLAGS} cargo clippy -p wasmer-compiler-cranelift + RUSTFLAGS=${RUSTFLAGS} cargo clippy -p wasmer-compiler-singlepass + RUSTFLAGS=${RUSTFLAGS} cargo clippy -p wasmer-cli + RUSTFLAGS=${RUSTFLAGS} cargo clippy -p wasmer-cache + RUSTFLAGS=${RUSTFLAGS} cargo clippy -p wasmer-engine + +lint-formatting: cargo fmt --all -- --check - RUSTFLAGS=${RUSTFLAGS} cargo clippy $(compiler_features) + +lint: lint-formatting lint-packages install-local: package tar -C ~/.wasmer -zxvf wasmer.tar.gz diff --git a/lib/compiler-cranelift/src/translator/code_translator.rs b/lib/compiler-cranelift/src/translator/code_translator.rs index b52d34e0b01..4afc3d4cbe2 100644 --- a/lib/compiler-cranelift/src/translator/code_translator.rs +++ b/lib/compiler-cranelift/src/translator/code_translator.rs @@ -216,15 +216,15 @@ pub fn translate_operator( // destination block following the whole `if...end`. If we do end // up discovering an `else`, then we will allocate a block for it // and go back and patch the jump. - let destination = block_with_params(builder, results.clone(), environ)?; + let destination = block_with_params(builder, results, environ)?; let branch_inst = canonicalise_then_brz(builder, val, destination, state.peekn(params.len())); (destination, ElseData::NoElse { branch_inst }) } else { // The `if` type signature is not valid without an `else` block, // so we eagerly allocate the `else` block here. - let destination = block_with_params(builder, results.clone(), environ)?; - let else_block = block_with_params(builder, params.clone(), environ)?; + let destination = block_with_params(builder, results, environ)?; + let else_block = block_with_params(builder, params, environ)?; canonicalise_then_brz(builder, val, else_block, state.peekn(params.len())); builder.seal_block(else_block); (destination, ElseData::WithElse { else_block }) @@ -271,8 +271,7 @@ pub fn translate_operator( let (params, _results) = module_translation_state.blocktype_params_results(blocktype)?; debug_assert_eq!(params.len(), num_return_values); - let else_block = - block_with_params(builder, params.clone(), environ)?; + let else_block = block_with_params(builder, params, environ)?; canonicalise_then_jump( builder, destination,