Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: fix all warnings #5363

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion benches/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ pub fn run_fn(c: &mut Criterion, module: &[u8], name: &str, input: i64) {
.unwrap();

b.iter(|| {
func.call(&mut store, input);
let _ = func.call(&mut store, input);
})
});
}
Expand Down
1 change: 1 addition & 0 deletions lib/c-api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ wasmer-artifact-create = ["wasmer-compiler/wasmer-artifact-create"]
static-artifact-load = ["wasmer-compiler/static-artifact-load"]
static-artifact-create = ["wasmer-compiler/static-artifact-create"]
webc_runner = ["virtual-fs", "webc"]
dylib = []
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feature was deprecated long ago. We shouldn't add it back

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You use it in

#[cfg(all(feature = "compiler", any(feature = "compiler", feature = "dylib")))]
- generating compiler warning because dylib is not declared. Should it be removed there?

# Deprecated features.
jit = ["compiler"]

Expand Down
3 changes: 3 additions & 0 deletions lib/c-api/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ macro_rules! map_feature_as_c_define {
}

fn main() {
// TODO: perhaps the "yes" value is not needed here?
println!(r#"cargo::rustc-check-cfg=cfg(__cbindgen_hack__, values("yes"))"#);

if !running_self() {
return;
}
Expand Down
2 changes: 2 additions & 0 deletions lib/cli-compiler/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ cranelift = ["wasmer-compiler-cranelift", "compiler"]
debug = ["fern", "log"]
disable-all-logging = []
jit = []
llvm = []
run = []
Comment on lines +78 to +79
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This create will be deprecated (removed from the repo) very soon, we shouldn't add new features to it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the features are used in code, they should be declared in cargo.toml - otherwise its like using a variable without declaring it first - ok for some languages, but usually a bad form for Rust :) Should they be removed there, or should these be added here until then?


[package.metadata.docs.rs]
rustc-args = ["--cfg", "docsrs"]
4 changes: 2 additions & 2 deletions lib/compiler/src/engine/inner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use wasmer_types::{
entity::PrimaryMap, DeserializeError, FunctionIndex, FunctionType, LocalFunctionIndex,
SignatureIndex,
};
use wasmer_types::{CompileError, Features, HashAlgorithm, ModuleInfo};
use wasmer_types::{CompileError, Features, HashAlgorithm};

#[cfg(not(target_arch = "wasm32"))]
use wasmer_vm::{
Expand Down Expand Up @@ -350,7 +350,7 @@ impl EngineInner {
#[allow(clippy::type_complexity)]
pub(crate) fn allocate<'a, FunctionBody, CustomSection>(
&'a mut self,
_module: &ModuleInfo,
_module: &wasmer_types::ModuleInfo,
functions: impl ExactSizeIterator<Item = &'a FunctionBody> + 'a,
function_call_trampolines: impl ExactSizeIterator<Item = &'a FunctionBody> + 'a,
dynamic_function_trampolines: impl ExactSizeIterator<Item = &'a FunctionBody> + 'a,
Expand Down
4 changes: 4 additions & 0 deletions lib/sys-utils/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,7 @@ tracing = "0.1.37"

[package.metadata.docs.rs]
rustc-args = ["--cfg", "docsrs"]

[features]
default = []
tracing = []
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is tracing a feature if it's not used anywhere?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is used in

#[cfg(feature = "tracing")]
and
#[cfg(feature = "tracing")]

12 changes: 9 additions & 3 deletions tests/compilers/issues.rs
Original file line number Diff line number Diff line change
Expand Up @@ -324,14 +324,20 @@ fn test_popcnt(mut config: crate::Config) -> Result<()> {
let mut num = 1;
for _ in 1..10000 {
let result = popcnt_i32.call(&mut store, &[Value::I32(num)]).unwrap();
assert_eq!(&Value::I32(num.count_ones() as i32), result.get(0).unwrap());
assert_eq!(
&Value::I32(num.count_ones() as i32),
result.first().unwrap()
);
num = get_next_number_i32(num);
}

let mut num = 1;
for _ in 1..10000 {
let result = popcnt_i64.call(&mut store, &[Value::I64(num)]).unwrap();
assert_eq!(&Value::I64(num.count_ones() as i64), result.get(0).unwrap());
assert_eq!(
&Value::I64(num.count_ones() as i64),
result.first().unwrap()
);
num = get_next_number_i64(num);
}

Expand Down Expand Up @@ -439,7 +445,7 @@ fn large_number_local(mut config: crate::Config) -> Result<()> {
.get_function("large_local")?
.call(&mut store, &[])
.unwrap();
assert_eq!(&Value::I64(1_i64), result.get(0).unwrap());
assert_eq!(&Value::I64(1_i64), result.first().unwrap());
Ok(())
}

Expand Down
4 changes: 2 additions & 2 deletions tests/integration/cli/tests/create_exe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ impl Default for WasmerCreateExe {
Self {
current_dir: std::env::current_dir().unwrap(),
wasmer_path: get_wasmer_path(),
wasm_path: PathBuf::from(fixtures::qjs()),
wasm_path: fixtures::qjs(),
native_executable_path,
compiler: Compiler::Cranelift,
extra_cli_flags: vec![],
Expand Down Expand Up @@ -116,7 +116,7 @@ impl Default for WasmerCreateObj {
Self {
current_dir: std::env::current_dir().unwrap(),
wasmer_path: get_wasmer_path(),
wasm_path: PathBuf::from(fixtures::qjs()),
wasm_path: fixtures::qjs(),
output_object_path,
compiler: Compiler::Cranelift,
extra_cli_flags: vec![],
Expand Down
Loading